mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 20:25:39 +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( buffer == NULL ) return sizeof(BITMAP);
|
||||||
if (Count < sizeof(BITMAP)) return 0;
|
if (Count < sizeof(BITMAP)) return 0;
|
||||||
|
|
||||||
|
Count = sizeof(BITMAP);
|
||||||
|
|
||||||
if(bmp->dib)
|
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);
|
memcpy(buffer, bmp->dib, Count);
|
||||||
|
/* Windows returns bytes copied, not DIBSECTION size */
|
||||||
return Count;
|
return Count;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BITMAP Bitmap;
|
BITMAP Bitmap;
|
||||||
if (Count > (INT) sizeof(BITMAP)) Count = sizeof(BITMAP);
|
|
||||||
Bitmap.bmType = 0;
|
Bitmap.bmType = 0;
|
||||||
Bitmap.bmWidth = bmp->SurfObj.sizlBitmap.cx;
|
Bitmap.bmWidth = bmp->SurfObj.sizlBitmap.cx;
|
||||||
Bitmap.bmHeight = bmp->SurfObj.sizlBitmap.cy;
|
Bitmap.bmHeight = bmp->SurfObj.sizlBitmap.cy;
|
||||||
|
|
|
@ -1841,20 +1841,20 @@ NtGdiGetObject(HANDLE handle, INT count, LPVOID buffer)
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((RetCount) && (count))
|
if (RetCount)
|
||||||
{
|
{
|
||||||
SafeBuf = ExAllocatePoolWithTag(PagedPool, count, TAG_GDIOBJ);
|
SafeBuf = ExAllocatePoolWithTag(PagedPool, RetCount, TAG_GDIOBJ);
|
||||||
if(!SafeBuf)
|
if(!SafeBuf)
|
||||||
{
|
{
|
||||||
SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
|
SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
Ret = IntGdiGetObject(handle, count, SafeBuf);
|
Ret = IntGdiGetObject(handle, RetCount, SafeBuf);
|
||||||
|
|
||||||
_SEH_TRY
|
_SEH_TRY
|
||||||
{
|
{
|
||||||
/* pointer already probed! */
|
/* pointer already probed! */
|
||||||
RtlCopyMemory(buffer, SafeBuf, count);
|
RtlCopyMemory(buffer, SafeBuf, RetCount);
|
||||||
}
|
}
|
||||||
_SEH_HANDLE
|
_SEH_HANDLE
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue