diff --git a/reactos/subsystems/win32/win32k/objects/bitmaps.c b/reactos/subsystems/win32/win32k/objects/bitmaps.c index 871d3c33342..bc42b6cdcd7 100644 --- a/reactos/subsystems/win32/win32k/objects/bitmaps.c +++ b/reactos/subsystems/win32/win32k/objects/bitmaps.c @@ -1566,14 +1566,6 @@ INT STDCALL BITMAP_GetObject(BITMAPOBJ * bmp, INT Count, LPVOID buffer) { if ((UINT)Count < sizeof(BITMAP)) return 0; - if( buffer == NULL ) - { - if ((UINT)Count < sizeof(DIBSECTION)) - { - return sizeof(BITMAP); - } - return sizeof(DIBSECTION); - } if(bmp->dib) { @@ -1585,23 +1577,30 @@ BITMAP_GetObject(BITMAPOBJ * bmp, INT Count, LPVOID buffer) { Count = sizeof(DIBSECTION); } - memcpy(buffer, bmp->dib, Count); + if (buffer) + { + memcpy(buffer, bmp->dib, Count); + } return Count; } else { - BITMAP Bitmap; - Count = sizeof(BITMAP); - Bitmap.bmType = 0; - Bitmap.bmWidth = bmp->SurfObj.sizlBitmap.cx; - Bitmap.bmHeight = bmp->SurfObj.sizlBitmap.cy; - Bitmap.bmWidthBytes = abs(bmp->SurfObj.lDelta); - Bitmap.bmPlanes = 1; - Bitmap.bmBitsPixel = BitsPerFormat(bmp->SurfObj.iBitmapFormat); - //Bitmap.bmBits = bmp->SurfObj.pvBits; - Bitmap.bmBits = NULL; /* not set accoring wine test confirm in win2k */ - memcpy(buffer, &Bitmap, Count); + if (buffer) + { + BITMAP Bitmap; + + Count = sizeof(BITMAP); + Bitmap.bmType = 0; + Bitmap.bmWidth = bmp->SurfObj.sizlBitmap.cx; + Bitmap.bmHeight = bmp->SurfObj.sizlBitmap.cy; + Bitmap.bmWidthBytes = abs(bmp->SurfObj.lDelta); + Bitmap.bmPlanes = 1; + Bitmap.bmBitsPixel = BitsPerFormat(bmp->SurfObj.iBitmapFormat); + //Bitmap.bmBits = bmp->SurfObj.pvBits; + Bitmap.bmBits = NULL; /* not set accoring wine test confirm in win2k */ + memcpy(buffer, &Bitmap, Count); + } return Count; } } diff --git a/reactos/subsystems/win32/win32k/objects/dc.c b/reactos/subsystems/win32/win32k/objects/dc.c index 88e0a528226..a5412db4c00 100644 --- a/reactos/subsystems/win32/win32k/objects/dc.c +++ b/reactos/subsystems/win32/win32k/objects/dc.c @@ -1832,6 +1832,10 @@ NtGdiExtGetObjectW(HANDLE hGdiObj, INT cbCount, LPVOID lpUnsafeBuf) } RetCount = IntGdiGetObject(hGdiObj, cbCount, NULL); + if (!RetCount) + { + return 0; + } if ((UINT)cbCount > RetCount) { cbCount = RetCount;