mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 13:16:07 +00:00
- 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:
parent
d5d519547c
commit
96b61f6b0b
2 changed files with 8 additions and 14 deletions
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue