Commit 369116d9 authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

When GetObject is called with a NULL pointer, return the object's

size.
parent 039e1311
......@@ -555,6 +555,8 @@ static INT BITMAP_GetObject( HGDIOBJ handle, void *obj, INT count, LPVOID buffer
if (bmp->dib)
{
if( !buffer )
return sizeof(DIBSECTION);
if (count < sizeof(DIBSECTION))
{
if (count > sizeof(BITMAP)) count = sizeof(BITMAP);
......@@ -569,6 +571,8 @@ static INT BITMAP_GetObject( HGDIOBJ handle, void *obj, INT count, LPVOID buffer
}
else
{
if( !buffer )
return sizeof(BITMAP);
if (count > sizeof(BITMAP)) count = sizeof(BITMAP);
memcpy( buffer, &bmp->bitmap, count );
return count;
......
......@@ -352,6 +352,9 @@ static INT BRUSH_GetObject( HGDIOBJ handle, void *obj, INT count, LPVOID buffer
{
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;
......
......@@ -472,11 +472,12 @@ static INT FONT_GetObjectA( HGDIOBJ handle, void *obj, INT count, LPVOID buffer
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_GetObjectA( HGDIOBJ handle, void *obj, INT count, LPVOID buffer
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;
}
......
......@@ -941,7 +941,6 @@ INT WINAPI GetObjectA( HANDLE handle, INT count, LPVOID buffer )
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 @@ INT WINAPI GetObjectW( HANDLE handle, INT count, LPVOID buffer )
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;
......
......@@ -625,6 +625,9 @@ static INT PALETTE_GetObject( HGDIOBJ handle, void *obj, INT count, LPVOID buffe
{
PALETTEOBJ *palette = obj;
if( !buffer )
return sizeof(WORD);
if (count > sizeof(WORD)) count = sizeof(WORD);
memcpy( buffer, &palette->logpalette.palNumEntries, count );
return count;
......
......@@ -167,6 +167,9 @@ static INT PEN_GetObject( HGDIOBJ handle, void *obj, INT count, LPVOID buffer )
{
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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment