Author: gedmurphy Date: Wed Apr 18 02:58:34 2007 New Revision: 26383
URL: http://svn.reactos.org/svn/reactos?rev=26383&view=rev Log: - fix GetObject call for bitmaps - Windows returns the number of bytes copied, not the size of the struct. - fix NtGdiGetObject, 'count' is now irrelevant - this breaks CopyImage, but it's broken anyway so it can wait until tomorrow.
Modified: trunk/reactos/subsystems/win32/win32k/objects/bitmaps.c trunk/reactos/subsystems/win32/win32k/objects/dc.c
Modified: trunk/reactos/subsystems/win32/win32k/objects/bitmaps.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/obj... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/bitmaps.c (original) +++ trunk/reactos/subsystems/win32/win32k/objects/bitmaps.c Wed Apr 18 02:58:34 2007 @@ -1564,24 +1564,18 @@ 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;
Modified: trunk/reactos/subsystems/win32/win32k/objects/dc.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/obj... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/dc.c (original) +++ trunk/reactos/subsystems/win32/win32k/objects/dc.c Wed Apr 18 02:58:34 2007 @@ -1841,20 +1841,20 @@ return Ret; }
- if ((RetCount) && (count)) - { - SafeBuf = ExAllocatePoolWithTag(PagedPool, count, TAG_GDIOBJ); + if (RetCount) + { + 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 {