- 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.

svn path=/trunk/; revision=26383
This commit is contained in:
Ged Murphy 2007-04-17 22:58:34 +00:00
parent d5d519547c
commit 96b61f6b0b
2 changed files with 8 additions and 14 deletions

View file

@ -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;

View file

@ -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
{