Author: tkreuzer
Date: Tue Apr 24 23:01:52 2007
New Revision: 26485
URL:
http://svn.reactos.org/svn/reactos?rev=26485&view=rev
Log:
- Fix BITMAP_GetObject()
- NtGdiExtGetObjectW: return 0 if IntGdiGetObject returns 0
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/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/bitmaps.c (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/bitmaps.c Tue Apr 24 23:01:52 2007
@@ -1566,14 +1566,6 @@
BITMAP_GetObject(BITMAPOBJ * bmp, INT Count, LPVOID buffer)
{
if ((UINT)Count < sizeof(BITMAP)) return 0;
- if( buffer == NULL )
- {
- if ((UINT)Count < sizeof(DIBSECTION))
- {
- return sizeof(BITMAP);
- }
- return sizeof(DIBSECTION);
- }
if(bmp->dib)
{
@@ -1585,23 +1577,30 @@
{
Count = sizeof(DIBSECTION);
}
- memcpy(buffer, bmp->dib, Count);
+ if (buffer)
+ {
+ memcpy(buffer, bmp->dib, Count);
+ }
return Count;
}
else
{
- BITMAP Bitmap;
-
Count = sizeof(BITMAP);
- Bitmap.bmType = 0;
- Bitmap.bmWidth = bmp->SurfObj.sizlBitmap.cx;
- Bitmap.bmHeight = bmp->SurfObj.sizlBitmap.cy;
- Bitmap.bmWidthBytes = abs(bmp->SurfObj.lDelta);
- Bitmap.bmPlanes = 1;
- Bitmap.bmBitsPixel = BitsPerFormat(bmp->SurfObj.iBitmapFormat);
- //Bitmap.bmBits = bmp->SurfObj.pvBits;
- Bitmap.bmBits = NULL; /* not set accoring wine test confirm in win2k */
- memcpy(buffer, &Bitmap, Count);
+ if (buffer)
+ {
+ BITMAP Bitmap;
+
+ Count = sizeof(BITMAP);
+ Bitmap.bmType = 0;
+ Bitmap.bmWidth = bmp->SurfObj.sizlBitmap.cx;
+ Bitmap.bmHeight = bmp->SurfObj.sizlBitmap.cy;
+ Bitmap.bmWidthBytes = abs(bmp->SurfObj.lDelta);
+ Bitmap.bmPlanes = 1;
+ Bitmap.bmBitsPixel = BitsPerFormat(bmp->SurfObj.iBitmapFormat);
+ //Bitmap.bmBits = bmp->SurfObj.pvBits;
+ Bitmap.bmBits = NULL; /* not set accoring wine test confirm in win2k */
+ memcpy(buffer, &Bitmap, Count);
+ }
return Count;
}
}
Modified: trunk/reactos/subsystems/win32/win32k/objects/dc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/dc.c (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/dc.c Tue Apr 24 23:01:52 2007
@@ -1832,6 +1832,10 @@
}
RetCount = IntGdiGetObject(hGdiObj, cbCount, NULL);
+ if (!RetCount)
+ {
+ return 0;
+ }
if ((UINT)cbCount > RetCount)
{
cbCount = RetCount;