When GetObject is called with a NULL pointer, return the object's
size.
This commit is contained in:
parent
039e13118e
commit
369116d911
|
@ -555,6 +555,8 @@ static INT BITMAP_GetObject( HGDIOBJ handle, void *obj, INT count, LPVOID buffer
|
||||||
|
|
||||||
if (bmp->dib)
|
if (bmp->dib)
|
||||||
{
|
{
|
||||||
|
if( !buffer )
|
||||||
|
return sizeof(DIBSECTION);
|
||||||
if (count < sizeof(DIBSECTION))
|
if (count < sizeof(DIBSECTION))
|
||||||
{
|
{
|
||||||
if (count > sizeof(BITMAP)) count = sizeof(BITMAP);
|
if (count > sizeof(BITMAP)) count = sizeof(BITMAP);
|
||||||
|
@ -569,6 +571,8 @@ static INT BITMAP_GetObject( HGDIOBJ handle, void *obj, INT count, LPVOID buffer
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if( !buffer )
|
||||||
|
return sizeof(BITMAP);
|
||||||
if (count > sizeof(BITMAP)) count = sizeof(BITMAP);
|
if (count > sizeof(BITMAP)) count = sizeof(BITMAP);
|
||||||
memcpy( buffer, &bmp->bitmap, count );
|
memcpy( buffer, &bmp->bitmap, count );
|
||||||
return count;
|
return count;
|
||||||
|
|
|
@ -352,6 +352,9 @@ static INT BRUSH_GetObject( HGDIOBJ handle, void *obj, INT count, LPVOID buffer
|
||||||
{
|
{
|
||||||
BRUSHOBJ *brush = obj;
|
BRUSHOBJ *brush = obj;
|
||||||
|
|
||||||
|
if( !buffer )
|
||||||
|
return sizeof(brush->logbrush);
|
||||||
|
|
||||||
if (count > sizeof(brush->logbrush)) count = sizeof(brush->logbrush);
|
if (count > sizeof(brush->logbrush)) count = sizeof(brush->logbrush);
|
||||||
memcpy( buffer, &brush->logbrush, count );
|
memcpy( buffer, &brush->logbrush, count );
|
||||||
return count;
|
return count;
|
||||||
|
|
|
@ -472,11 +472,12 @@ static INT FONT_GetObjectA( HGDIOBJ handle, void *obj, INT count, LPVOID buffer
|
||||||
FONTOBJ *font = obj;
|
FONTOBJ *font = obj;
|
||||||
LOGFONTA lfA;
|
LOGFONTA lfA;
|
||||||
|
|
||||||
|
if(!buffer)
|
||||||
|
return sizeof(lfA);
|
||||||
FONT_LogFontWToA( &font->logfont, &lfA );
|
FONT_LogFontWToA( &font->logfont, &lfA );
|
||||||
|
|
||||||
if (count > sizeof(lfA)) count = sizeof(lfA);
|
if (count > sizeof(lfA)) count = sizeof(lfA);
|
||||||
if(buffer)
|
memcpy( buffer, &lfA, count );
|
||||||
memcpy( buffer, &lfA, count );
|
|
||||||
return 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 )
|
static INT FONT_GetObjectW( HGDIOBJ handle, void *obj, INT count, LPVOID buffer )
|
||||||
{
|
{
|
||||||
FONTOBJ *font = obj;
|
FONTOBJ *font = obj;
|
||||||
|
if(!buffer)
|
||||||
|
return sizeof(LOGFONTW);
|
||||||
if (count > sizeof(LOGFONTW)) count = sizeof(LOGFONTW);
|
if (count > sizeof(LOGFONTW)) count = sizeof(LOGFONTW);
|
||||||
if(buffer)
|
memcpy( buffer, &font->logfont, count );
|
||||||
memcpy( buffer, &font->logfont, count );
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -941,7 +941,6 @@ INT WINAPI GetObjectA( HANDLE handle, INT count, LPVOID buffer )
|
||||||
GDIOBJHDR * ptr;
|
GDIOBJHDR * ptr;
|
||||||
INT result = 0;
|
INT result = 0;
|
||||||
TRACE("%p %d %p\n", handle, count, buffer );
|
TRACE("%p %d %p\n", handle, count, buffer );
|
||||||
if (!count) return 0;
|
|
||||||
|
|
||||||
if (!(ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE ))) 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;
|
GDIOBJHDR * ptr;
|
||||||
INT result = 0;
|
INT result = 0;
|
||||||
TRACE("%p %d %p\n", handle, count, buffer );
|
TRACE("%p %d %p\n", handle, count, buffer );
|
||||||
if (!count) return 0;
|
|
||||||
|
|
||||||
if (!(ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE ))) 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;
|
PALETTEOBJ *palette = obj;
|
||||||
|
|
||||||
|
if( !buffer )
|
||||||
|
return sizeof(WORD);
|
||||||
|
|
||||||
if (count > sizeof(WORD)) count = sizeof(WORD);
|
if (count > sizeof(WORD)) count = sizeof(WORD);
|
||||||
memcpy( buffer, &palette->logpalette.palNumEntries, count );
|
memcpy( buffer, &palette->logpalette.palNumEntries, count );
|
||||||
return count;
|
return count;
|
||||||
|
|
|
@ -167,6 +167,9 @@ static INT PEN_GetObject( HGDIOBJ handle, void *obj, INT count, LPVOID buffer )
|
||||||
{
|
{
|
||||||
PENOBJ *pen = obj;
|
PENOBJ *pen = obj;
|
||||||
|
|
||||||
|
if( !buffer )
|
||||||
|
return sizeof(pen->logpen);
|
||||||
|
|
||||||
if (count > sizeof(pen->logpen)) count = sizeof(pen->logpen);
|
if (count > sizeof(pen->logpen)) count = sizeof(pen->logpen);
|
||||||
memcpy( buffer, &pen->logpen, count );
|
memcpy( buffer, &pen->logpen, count );
|
||||||
return count;
|
return count;
|
||||||
|
|
Loading…
Reference in New Issue