Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
d5456de0
Commit
d5456de0
authored
Jan 15, 2008
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Jan 15, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Do not allow to create too large device dependent bitmaps like Windows does.
parent
4111ea93
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
8 deletions
+30
-8
bitmap.c
dlls/gdi32/bitmap.c
+12
-8
bitmap.c
dlls/gdi32/tests/bitmap.c
+18
-0
No files found.
dlls/gdi32/bitmap.c
View file @
d5456de0
...
...
@@ -136,13 +136,6 @@ HBITMAP WINAPI CreateCompatibleBitmap( HDC hdc, INT width, INT height)
TRACE
(
"(%p,%d,%d) =
\n
"
,
hdc
,
width
,
height
);
if
((
width
>=
0x10000
)
||
(
height
>=
0x10000
))
{
FIXME
(
"got bad width %d or height %d, please look for reason
\n
"
,
width
,
height
);
}
else
{
if
(
!
(
dc
=
DC_GetDCPtr
(
hdc
)))
return
0
;
if
(
GDIMAGIC
(
dc
->
header
.
wMagic
)
!=
MEMORY_DC_MAGIC
)
...
...
@@ -208,7 +201,6 @@ HBITMAP WINAPI CreateCompatibleBitmap( HDC hdc, INT width, INT height)
GDI_ReleaseObj
(
dc
->
hBitmap
);
}
DC_ReleaseDCPtr
(
dc
);
}
TRACE
(
"
\t\t
%p
\n
"
,
hbmpRet
);
return
hbmpRet
;
...
...
@@ -242,6 +234,12 @@ HBITMAP WINAPI CreateBitmapIndirect( const BITMAP *bmp )
return
NULL
;
}
if
(
bmp
->
bmWidth
>
0x7ffffff
||
bmp
->
bmHeight
>
0x7ffffff
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
0
;
}
bm
=
*
bmp
;
if
(
!
bm
.
bmWidth
||
!
bm
.
bmHeight
)
...
...
@@ -278,6 +276,12 @@ HBITMAP WINAPI CreateBitmapIndirect( const BITMAP *bmp )
/* Windows ignores the provided bm.bmWidthBytes */
bm
.
bmWidthBytes
=
BITMAP_GetWidthBytes
(
bm
.
bmWidth
,
bm
.
bmBitsPixel
);
/* XP doesn't allow to create bitmaps larger than 128 Mb */
if
(
bm
.
bmHeight
*
bm
.
bmWidthBytes
>
128
*
1024
*
1024
)
{
SetLastError
(
ERROR_NOT_ENOUGH_MEMORY
);
return
0
;
}
/* Create the BITMAPOBJ */
bmpobj
=
GDI_AllocObject
(
sizeof
(
BITMAPOBJ
),
BITMAP_MAGIC
,
...
...
dlls/gdi32/tests/bitmap.c
View file @
d5456de0
...
...
@@ -25,6 +25,7 @@
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "wingdi.h"
#include "winuser.h"
#include "mmsystem.h"
...
...
@@ -966,6 +967,23 @@ static void test_bitmap(void)
hdc
=
CreateCompatibleDC
(
0
);
assert
(
hdc
!=
0
);
SetLastError
(
0xdeadbeef
);
hbmp
=
CreateBitmap
(
0x7ffffff
,
1
,
1
,
1
,
NULL
);
ok
(
hbmp
!=
0
,
"CreateBitmap should not fail
\n
"
);
DeleteObject
(
hbmp
);
SetLastError
(
0xdeadbeef
);
hbmp
=
CreateBitmap
(
0x7ffffff
,
9
,
1
,
1
,
NULL
);
ok
(
!
hbmp
,
"CreateBitmap should fail
\n
"
);
ok
(
GetLastError
()
==
ERROR_NOT_ENOUGH_MEMORY
,
"expected ERROR_NOT_ENOUGH_MEMORY, got %u
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
hbmp
=
CreateBitmap
(
0x7ffffff
+
1
,
1
,
1
,
1
,
NULL
);
ok
(
!
hbmp
,
"CreateBitmap should fail
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %u
\n
"
,
GetLastError
());
hbmp
=
CreateBitmap
(
15
,
15
,
1
,
1
,
NULL
);
assert
(
hbmp
!=
NULL
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment