diff --git a/reactos/subsystems/win32/win32k/objects/bitmaps.c b/reactos/subsystems/win32/win32k/objects/bitmaps.c index ae716a44f4d..22516bb7cfa 100644 --- a/reactos/subsystems/win32/win32k/objects/bitmaps.c +++ b/reactos/subsystems/win32/win32k/objects/bitmaps.c @@ -1564,24 +1564,18 @@ BITMAP_GetObject(BITMAPOBJ * bmp, INT Count, LPVOID buffer) if( buffer == NULL ) return sizeof(BITMAP); if (Count < sizeof(BITMAP)) return 0; + Count = sizeof(BITMAP); + if(bmp->dib) { - - if(Count < (INT) sizeof(DIBSECTION)) - { - if (Count > (INT) sizeof(BITMAP)) Count = sizeof(BITMAP); - } - else - { - if (Count > (INT) sizeof(DIBSECTION)) Count = sizeof(DIBSECTION); - } memcpy(buffer, bmp->dib, Count); + /* Windows returns bytes copied, not DIBSECTION size */ return Count; } else { BITMAP Bitmap; - if (Count > (INT) sizeof(BITMAP)) Count = sizeof(BITMAP); + Bitmap.bmType = 0; Bitmap.bmWidth = bmp->SurfObj.sizlBitmap.cx; Bitmap.bmHeight = bmp->SurfObj.sizlBitmap.cy; diff --git a/reactos/subsystems/win32/win32k/objects/dc.c b/reactos/subsystems/win32/win32k/objects/dc.c index b7fca5c74f0..30eb9eafbbd 100644 --- a/reactos/subsystems/win32/win32k/objects/dc.c +++ b/reactos/subsystems/win32/win32k/objects/dc.c @@ -1841,20 +1841,20 @@ NtGdiGetObject(HANDLE handle, INT count, LPVOID buffer) return Ret; } - if ((RetCount) && (count)) + if (RetCount) { - SafeBuf = ExAllocatePoolWithTag(PagedPool, count, TAG_GDIOBJ); + SafeBuf = ExAllocatePoolWithTag(PagedPool, RetCount, TAG_GDIOBJ); if(!SafeBuf) { SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY); return Ret; } - Ret = IntGdiGetObject(handle, count, SafeBuf); + Ret = IntGdiGetObject(handle, RetCount, SafeBuf); _SEH_TRY { /* pointer already probed! */ - RtlCopyMemory(buffer, SafeBuf, count); + RtlCopyMemory(buffer, SafeBuf, RetCount); } _SEH_HANDLE {