diff --git a/reactos/dll/win32/gdi32/objects/bitmap.c b/reactos/dll/win32/gdi32/objects/bitmap.c index 961051c13b0..b87094d9d88 100644 --- a/reactos/dll/win32/gdi32/objects/bitmap.c +++ b/reactos/dll/win32/gdi32/objects/bitmap.c @@ -187,15 +187,22 @@ StretchBlt( HBITMAP WINAPI CreateBitmapIndirect(const BITMAP *pbm) { - if (pbm) + HBITMAP bitmap = NULL; + + /* Note windows xp/2003 does not check if pbm is NULL or not */ + if ( (pbm->bmWidthBytes != 0) && + (!(pbm->bmWidthBytes & 1)) ) + { - return NtGdiCreateBitmap(pbm->bmWidth, - pbm->bmHeight, - pbm->bmPlanes, - pbm->bmBitsPixel, - pbm->bmBits); + + bitmap = CreateBitmap(pbm->bmWidth, + pbm->bmHeight, + pbm->bmPlanes, + pbm->bmBitsPixel, + pbm->bmBits); } - return NULL; + + return bitmap; } HBITMAP WINAPI diff --git a/reactos/subsystems/win32/win32k/objects/bitmaps.c b/reactos/subsystems/win32/win32k/objects/bitmaps.c index 851e6895755..5168002b79c 100644 --- a/reactos/subsystems/win32/win32k/objects/bitmaps.c +++ b/reactos/subsystems/win32/win32k/objects/bitmaps.c @@ -112,14 +112,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); - } + hBitmap = IntGdiCreateBitmap(Width, Height, Planes, BitsPixel, pUnsafeBits); + } _SEH_HANDLE {