GetObject(handle,len,NULL) returns object's size
Mike McCormack
mike at codeweavers.com
Sat Jul 26 03:52:09 CDT 2003
ChangeLog:
* when GetObject is called with a NULL pointer, return the object's size
-------------- next part --------------
Index: objects/bitmap.c
===================================================================
RCS file: /home/wine/wine/objects/bitmap.c,v
retrieving revision 1.56
diff -u -r1.56 bitmap.c
--- objects/bitmap.c 13 May 2003 23:56:12 -0000 1.56
+++ objects/bitmap.c 26 Jul 2003 07:32:11 -0000
@@ -555,6 +555,8 @@
if (bmp->dib)
{
+ if( !buffer )
+ return sizeof(DIBSECTION);
if (count < sizeof(DIBSECTION))
{
if (count > sizeof(BITMAP)) count = sizeof(BITMAP);
@@ -569,6 +571,8 @@
}
else
{
+ if( !buffer )
+ return sizeof(BITMAP);
if (count > sizeof(BITMAP)) count = sizeof(BITMAP);
memcpy( buffer, &bmp->bitmap, count );
return count;
Index: objects/brush.c
===================================================================
RCS file: /home/wine/wine/objects/brush.c,v
retrieving revision 1.34
diff -u -r1.34 brush.c
--- objects/brush.c 22 Nov 2002 22:16:53 -0000 1.34
+++ objects/brush.c 26 Jul 2003 07:32:12 -0000
@@ -352,6 +352,9 @@
{
BRUSHOBJ *brush = obj;
+ if( !buffer )
+ return sizeof(brush->logbrush);
+
if (count > sizeof(brush->logbrush)) count = sizeof(brush->logbrush);
memcpy( buffer, &brush->logbrush, count );
return count;
Index: objects/font.c
===================================================================
RCS file: /home/wine/wine/objects/font.c,v
retrieving revision 1.101
diff -u -r1.101 font.c
--- objects/font.c 27 Jun 2003 20:47:16 -0000 1.101
+++ objects/font.c 26 Jul 2003 07:32:13 -0000
@@ -472,11 +472,12 @@
FONTOBJ *font = obj;
LOGFONTA lfA;
+ if(!buffer)
+ return sizeof(lfA);
FONT_LogFontWToA( &font->logfont, &lfA );
if (count > sizeof(lfA)) count = sizeof(lfA);
- if(buffer)
- memcpy( buffer, &lfA, count );
+ memcpy( buffer, &lfA, count );
return count;
}
@@ -486,9 +487,10 @@
static INT FONT_GetObjectW( HGDIOBJ handle, void *obj, INT count, LPVOID buffer )
{
FONTOBJ *font = obj;
+ if(!buffer)
+ return sizeof(LOGFONTW);
if (count > sizeof(LOGFONTW)) count = sizeof(LOGFONTW);
- if(buffer)
- memcpy( buffer, &font->logfont, count );
+ memcpy( buffer, &font->logfont, count );
return count;
}
Index: objects/gdiobj.c
===================================================================
RCS file: /home/wine/wine/objects/gdiobj.c,v
retrieving revision 1.87
diff -u -r1.87 gdiobj.c
--- objects/gdiobj.c 21 May 2003 18:28:49 -0000 1.87
+++ objects/gdiobj.c 26 Jul 2003 07:32:13 -0000
@@ -941,7 +941,6 @@
GDIOBJHDR * ptr;
INT result = 0;
TRACE("%p %d %p\n", handle, count, buffer );
- if (!count) return 0;
if (!(ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE ))) return 0;
@@ -962,7 +961,6 @@
GDIOBJHDR * ptr;
INT result = 0;
TRACE("%p %d %p\n", handle, count, buffer );
- if (!count) return 0;
if (!(ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE ))) return 0;
Index: objects/palette.c
===================================================================
RCS file: /home/wine/wine/objects/palette.c,v
retrieving revision 1.56
diff -u -r1.56 palette.c
--- objects/palette.c 2 Jul 2003 04:37:26 -0000 1.56
+++ objects/palette.c 26 Jul 2003 07:32:14 -0000
@@ -625,6 +625,9 @@
{
PALETTEOBJ *palette = obj;
+ if( !buffer )
+ return sizeof(WORD);
+
if (count > sizeof(WORD)) count = sizeof(WORD);
memcpy( buffer, &palette->logpalette.palNumEntries, count );
return count;
Index: objects/pen.c
===================================================================
RCS file: /home/wine/wine/objects/pen.c,v
retrieving revision 1.22
diff -u -r1.22 pen.c
--- objects/pen.c 21 Nov 2002 21:50:04 -0000 1.22
+++ objects/pen.c 26 Jul 2003 07:32:14 -0000
@@ -167,6 +167,9 @@
{
PENOBJ *pen = obj;
+ if( !buffer )
+ return sizeof(pen->logpen);
+
if (count > sizeof(pen->logpen)) count = sizeof(pen->logpen);
memcpy( buffer, &pen->logpen, count );
return count;
More information about the wine-patches
mailing list