mirror of
https://github.com/reactos/reactos.git
synced 2024-10-08 02:13:56 +00:00
1. remove hack in NtGdiCreateBitmap
2. BugFix IntGdiCreateBitmap 1. Height can not be negative value 2. width can not be negative value 3. Planes or BitsPerPixel can not be biger that 32Bpp 4. BitsPerPixel can not be 0 5. width size is max 0x7FFFFFFF hex svn path=/trunk/; revision=33403
This commit is contained in:
parent
7eab8b0750
commit
608264fa22
|
@ -43,11 +43,14 @@ IntGdiCreateBitmap(
|
|||
SIZEL Size;
|
||||
LONG WidthBytes;
|
||||
|
||||
|
||||
/* NOTE: Windows also doesn't store nr. of planes separately! */
|
||||
BitsPixel = BITMAPOBJ_GetRealBitsPixel(BitsPixel * Planes);
|
||||
|
||||
/* Check parameters */
|
||||
if (BitsPixel == 0 || Width < 0)
|
||||
|
||||
if ( (Height <= 0) || (Width <= 0) || (Width > 0x7FFFFFFF) ||
|
||||
(Planes > 32) || (BitsPixel > 32) || (BitsPixel == 0) )
|
||||
{
|
||||
DPRINT1("Width = %d, Height = %d BitsPixel = %d\n", Width, Height, BitsPixel);
|
||||
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
||||
|
@ -56,9 +59,8 @@ IntGdiCreateBitmap(
|
|||
|
||||
WidthBytes = BITMAPOBJ_GetWidthBytes(Width, Planes * BitsPixel);
|
||||
|
||||
Size.cx = abs(Width);
|
||||
Size.cy = abs(Height);
|
||||
|
||||
Size.cx = Width;
|
||||
Size.cy = Height;
|
||||
/* Create the bitmap object. */
|
||||
hBitmap = IntCreateBitmap(Size, WidthBytes,
|
||||
BitmapFormat(BitsPixel, BI_RGB),
|
||||
|
@ -112,15 +114,8 @@ NtGdiCreateBitmap(
|
|||
ProbeForRead(pUnsafeBits, cjBits, 1);
|
||||
}
|
||||
|
||||
if (0 == Width || 0 == Height)
|
||||
{
|
||||
hBitmap = IntGdiCreateBitmap (1, 1, 1, 1, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
hBitmap = IntGdiCreateBitmap(Width, Height, Planes, BitsPixel, pUnsafeBits);
|
||||
}
|
||||
}
|
||||
_SEH_HANDLE
|
||||
{
|
||||
hBitmap = 0;
|
||||
|
|
Loading…
Reference in a new issue