Commit 06afb958 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

gdi32: Store ntgdi object types in handle table.

parent c56cf013
......@@ -168,7 +168,7 @@ HBITMAP WINAPI NtGdiCreateBitmap( INT width, INT height, UINT planes,
return 0;
}
if (!(hbitmap = alloc_gdi_handle( &bmpobj->obj, OBJ_BITMAP, &bitmap_funcs )))
if (!(hbitmap = alloc_gdi_handle( &bmpobj->obj, NTGDI_OBJ_BITMAP, &bitmap_funcs )))
{
HeapFree( GetProcessHeap(), 0, bmpobj->dib.dsBm.bmBits );
HeapFree( GetProcessHeap(), 0, bmpobj );
......@@ -202,7 +202,7 @@ LONG WINAPI NtGdiGetBitmapBits(
struct gdi_image_bits src_bits;
struct bitblt_coords src;
int dst_stride, max, ret;
BITMAPOBJ *bmp = GDI_GetObjPtr( hbitmap, OBJ_BITMAP );
BITMAPOBJ *bmp = GDI_GetObjPtr( hbitmap, NTGDI_OBJ_BITMAP );
if (!bmp) return 0;
......@@ -277,7 +277,7 @@ LONG WINAPI NtGdiSetBitmapBits(
if (!bits) return 0;
bmp = GDI_GetObjPtr( hbitmap, OBJ_BITMAP );
bmp = GDI_GetObjPtr( hbitmap, NTGDI_OBJ_BITMAP );
if (!bmp) return 0;
if (count < 0) {
......@@ -386,7 +386,7 @@ HGDIOBJ WINAPI NtGdiSelectBitmap( HDC hdc, HGDIOBJ handle )
ret = dc->hBitmap;
if (handle == dc->hBitmap) goto done; /* nothing to do */
if (!(bitmap = GDI_GetObjPtr( handle, OBJ_BITMAP )))
if (!(bitmap = GDI_GetObjPtr( handle, NTGDI_OBJ_BITMAP )))
{
ret = 0;
goto done;
......@@ -457,7 +457,7 @@ static BOOL BITMAP_DeleteObject( HGDIOBJ handle )
static INT BITMAP_GetObject( HGDIOBJ handle, INT count, LPVOID buffer )
{
INT ret = 0;
BITMAPOBJ *bmp = GDI_GetObjPtr( handle, OBJ_BITMAP );
BITMAPOBJ *bmp = GDI_GetObjPtr( handle, NTGDI_OBJ_BITMAP );
if (!bmp) return 0;
......@@ -487,7 +487,7 @@ BOOL WINAPI NtGdiGetBitmapDimension(
HBITMAP hbitmap, /* [in] Handle to bitmap */
LPSIZE size) /* [out] Address of struct receiving dimensions */
{
BITMAPOBJ * bmp = GDI_GetObjPtr( hbitmap, OBJ_BITMAP );
BITMAPOBJ * bmp = GDI_GetObjPtr( hbitmap, NTGDI_OBJ_BITMAP );
if (!bmp) return FALSE;
*size = bmp->size;
GDI_ReleaseObj( hbitmap );
......@@ -512,7 +512,7 @@ BOOL WINAPI NtGdiSetBitmapDimension(
INT y, /* [in] Bitmap height */
LPSIZE prevSize) /* [out] Address of structure for orig dims */
{
BITMAPOBJ * bmp = GDI_GetObjPtr( hbitmap, OBJ_BITMAP );
BITMAPOBJ * bmp = GDI_GetObjPtr( hbitmap, NTGDI_OBJ_BITMAP );
if (!bmp) return FALSE;
if (prevSize) *prevSize = bmp->size;
bmp->size.cx = x;
......
......@@ -56,7 +56,7 @@ static BOOL copy_bitmap( struct brush_pattern *brush, HBITMAP bitmap )
BITMAPINFO *info = (BITMAPINFO *)buffer;
struct gdi_image_bits bits;
struct bitblt_coords src;
BITMAPOBJ *bmp = GDI_GetObjPtr( bitmap, OBJ_BITMAP );
BITMAPOBJ *bmp = GDI_GetObjPtr( bitmap, NTGDI_OBJ_BITMAP );
if (!bmp) return FALSE;
......@@ -151,7 +151,7 @@ BOOL get_brush_bitmap_info( HBRUSH handle, BITMAPINFO *info, void **bits, UINT *
BRUSHOBJ *brush;
BOOL ret = FALSE;
if (!(brush = GDI_GetObjPtr( handle, OBJ_BRUSH ))) return FALSE;
if (!(brush = GDI_GetObjPtr( handle, NTGDI_OBJ_BRUSH ))) return FALSE;
if (brush->pattern.info)
{
......@@ -196,7 +196,7 @@ HBRUSH WINAPI CreateBrushIndirect( const LOGBRUSH * brush )
ptr->logbrush = *brush;
if (store_brush_pattern( &ptr->logbrush, &ptr->pattern ) &&
(hbrush = alloc_gdi_handle( &ptr->obj, OBJ_BRUSH, &brush_funcs )))
(hbrush = alloc_gdi_handle( &ptr->obj, NTGDI_OBJ_BRUSH, &brush_funcs )))
{
TRACE("%p\n", hbrush);
return hbrush;
......@@ -424,7 +424,7 @@ HGDIOBJ WINAPI NtGdiSelectBrush( HDC hdc, HGDIOBJ handle )
if (!(dc = get_dc_ptr( hdc ))) return 0;
if ((brush = GDI_GetObjPtr( handle, OBJ_BRUSH )))
if ((brush = GDI_GetObjPtr( handle, NTGDI_OBJ_BRUSH )))
{
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSelectBrush );
struct brush_pattern *pattern = &brush->pattern;
......@@ -469,7 +469,7 @@ static BOOL BRUSH_DeleteObject( HGDIOBJ handle )
*/
static INT BRUSH_GetObject( HGDIOBJ handle, INT count, LPVOID buffer )
{
BRUSHOBJ *brush = GDI_GetObjPtr( handle, OBJ_BRUSH );
BRUSHOBJ *brush = GDI_GetObjPtr( handle, NTGDI_OBJ_BRUSH );
if (!brush) return 0;
if (buffer)
......
......@@ -52,10 +52,10 @@ static inline DC *get_dc_obj( HDC hdc )
switch (type)
{
case OBJ_DC:
case OBJ_MEMDC:
case OBJ_METADC:
case OBJ_ENHMETADC:
case NTGDI_OBJ_DC:
case NTGDI_OBJ_MEMDC:
case NTGDI_OBJ_METADC:
case NTGDI_OBJ_ENHMETADC:
return dc;
default:
GDI_ReleaseObj( hdc );
......@@ -644,7 +644,7 @@ HDC WINAPI CreateDCW( LPCWSTR driver, LPCWSTR device, LPCWSTR output,
ERR( "no driver found for %s\n", debugstr_w(buf) );
return 0;
}
if (!(dc = alloc_dc_ptr( OBJ_DC ))) return 0;
if (!(dc = alloc_dc_ptr( NTGDI_OBJ_DC ))) return 0;
hdc = dc->hSelf;
dc->hBitmap = GDI_inc_ref_count( GetStockObject( DEFAULT_BITMAP ));
......@@ -770,7 +770,7 @@ HDC WINAPI CreateCompatibleDC( HDC hdc )
}
else funcs = DRIVER_load_driver( L"display" );
if (!(dc = alloc_dc_ptr( OBJ_MEMDC ))) return 0;
if (!(dc = alloc_dc_ptr( NTGDI_OBJ_MEMDC ))) return 0;
TRACE("(%p): returning %p\n", hdc, dc->hSelf );
......
......@@ -692,7 +692,7 @@ INT WINAPI SetDIBits( HDC hdc, HBITMAP hbitmap, UINT startscan,
if (coloruse == DIB_PAL_COLORS && !fill_color_table_from_pal_colors( src_info, hdc )) return 0;
if (!(bitmap = GDI_GetObjPtr( hbitmap, OBJ_BITMAP ))) return 0;
if (!(bitmap = GDI_GetObjPtr( hbitmap, NTGDI_OBJ_BITMAP ))) return 0;
if (src_info->bmiHeader.biCompression == BI_RLE4 || src_info->bmiHeader.biCompression == BI_RLE8)
{
......@@ -920,7 +920,7 @@ UINT WINAPI SetDIBColorTable( HDC hdc, UINT startpos, UINT entries, const RGBQUA
if (!(dc = get_dc_ptr( hdc ))) return 0;
if ((bitmap = GDI_GetObjPtr( dc->hBitmap, OBJ_BITMAP )))
if ((bitmap = GDI_GetObjPtr( dc->hBitmap, NTGDI_OBJ_BITMAP )))
{
if (startpos < bitmap->dib.dsBmih.biClrUsed)
{
......@@ -959,7 +959,7 @@ UINT WINAPI GetDIBColorTable( HDC hdc, UINT startpos, UINT entries, RGBQUAD *col
if (!(dc = get_dc_ptr( hdc ))) return 0;
if ((bitmap = GDI_GetObjPtr( dc->hBitmap, OBJ_BITMAP )))
if ((bitmap = GDI_GetObjPtr( dc->hBitmap, NTGDI_OBJ_BITMAP )))
{
if (startpos < bitmap->dib.dsBmih.biClrUsed)
{
......@@ -1240,7 +1240,7 @@ INT WINAPI DECLSPEC_HOTPATCH GetDIBits(
return 0;
}
update_dc( dc );
if (!(bmp = GDI_GetObjPtr( hbitmap, OBJ_BITMAP )))
if (!(bmp = GDI_GetObjPtr( hbitmap, NTGDI_OBJ_BITMAP )))
{
release_dc_ptr( dc );
return 0;
......@@ -1569,7 +1569,7 @@ HBITMAP WINAPI DECLSPEC_HOTPATCH CreateDIBSection(HDC hdc, const BITMAPINFO *bmi
if (!bmp->dib.dsBm.bmBits) goto error;
if (!(ret = alloc_gdi_handle( &bmp->obj, OBJ_BITMAP, &dib_funcs ))) goto error;
if (!(ret = alloc_gdi_handle( &bmp->obj, NTGDI_OBJ_BITMAP, &dib_funcs ))) goto error;
if (bits) *bits = bmp->dib.dsBm.bmBits;
return ret;
......@@ -1681,7 +1681,7 @@ NTSTATUS WINAPI D3DKMTCreateDCFromMemory( D3DKMT_CREATEDCFROMMEMORY *desc )
}
}
if (!(bitmap = alloc_gdi_handle( &bmp->obj, OBJ_BITMAP, &dib_funcs ))) goto error;
if (!(bitmap = alloc_gdi_handle( &bmp->obj, NTGDI_OBJ_BITMAP, &dib_funcs ))) goto error;
desc->hDc = dc;
desc->hBitmap = bitmap;
......@@ -1720,7 +1720,7 @@ NTSTATUS WINAPI D3DKMTDestroyDCFromMemory( const D3DKMT_DESTROYDCFROMMEMORY *des
static INT DIB_GetObject( HGDIOBJ handle, INT count, LPVOID buffer )
{
INT ret = 0;
BITMAPOBJ *bmp = GDI_GetObjPtr( handle, OBJ_BITMAP );
BITMAPOBJ *bmp = GDI_GetObjPtr( handle, NTGDI_OBJ_BITMAP );
if (!bmp) return 0;
......
......@@ -356,7 +356,7 @@ static BOOL CDECL dibdrv_DeleteDC( PHYSDEV dev )
static HBITMAP CDECL dibdrv_SelectBitmap( PHYSDEV dev, HBITMAP bitmap )
{
dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
BITMAPOBJ *bmp = GDI_GetObjPtr( bitmap, OBJ_BITMAP );
BITMAPOBJ *bmp = GDI_GetObjPtr( bitmap, NTGDI_OBJ_BITMAP );
dib_info dib;
TRACE("(%p, %p)\n", dev, bitmap);
......@@ -535,7 +535,7 @@ static BOOL WINAPI dibdrv_wglMakeCurrent( HDC hdc, struct wgl_context *context )
if (!context) return osmesa_funcs->make_current( NULL, NULL, 0, 0, 0, 0 );
bitmap = GetCurrentObject( hdc, OBJ_BITMAP );
bmp = GDI_GetObjPtr( bitmap, OBJ_BITMAP );
bmp = GDI_GetObjPtr( bitmap, NTGDI_OBJ_BITMAP );
if (!bmp) return FALSE;
if (init_dib_info_from_bitmapobj( &dib, bmp ))
......
......@@ -277,7 +277,7 @@ HENHMETAFILE EMF_Create_HENHMETAFILE(ENHMETAHEADER *emh, DWORD filesize, BOOL on
metaObj->emh = emh;
metaObj->on_disk = on_disk;
if (!(hmf = alloc_gdi_handle( &metaObj->obj, OBJ_ENHMETAFILE, NULL )))
if (!(hmf = alloc_gdi_handle( &metaObj->obj, NTGDI_OBJ_ENHMETAFILE, NULL )))
HeapFree( GetProcessHeap(), 0, metaObj );
return hmf;
}
......@@ -307,7 +307,7 @@ static BOOL EMF_Delete_HENHMETAFILE( HENHMETAFILE hmf )
static ENHMETAHEADER *EMF_GetEnhMetaHeader( HENHMETAFILE hmf )
{
ENHMETAHEADER *ret = NULL;
ENHMETAFILEOBJ *metaObj = GDI_GetObjPtr( hmf, OBJ_ENHMETAFILE );
ENHMETAFILEOBJ *metaObj = GDI_GetObjPtr( hmf, NTGDI_OBJ_ENHMETAFILE );
TRACE("hmf %p -> enhmetaObj %p\n", hmf, metaObj);
if (metaObj)
{
......
......@@ -335,7 +335,7 @@ HDC WINAPI CreateEnhMetaFileW(
TRACE("(%p %s %s %s)\n", hdc, debugstr_w(filename), wine_dbgstr_rect(rect), debugstr_w(description) );
if (!(dc = alloc_dc_ptr( OBJ_ENHMETADC ))) return 0;
if (!(dc = alloc_dc_ptr( NTGDI_OBJ_ENHMETADC ))) return 0;
physDev = HeapAlloc(GetProcessHeap(),0,sizeof(*physDev));
if (!physDev) {
......
......@@ -4318,7 +4318,7 @@ HFONT WINAPI CreateFontIndirectExW( const ENUMLOGFONTEXDVW *penumex )
fontPtr->logfont = *plf;
if (!(hFont = alloc_gdi_handle( &fontPtr->obj, OBJ_FONT, &fontobj_funcs )))
if (!(hFont = alloc_gdi_handle( &fontPtr->obj, NTGDI_OBJ_FONT, &fontobj_funcs )))
{
HeapFree( GetProcessHeap(), 0, fontPtr );
return 0;
......@@ -4570,7 +4570,7 @@ HGDIOBJ WINAPI NtGdiSelectFont( HDC hdc, HGDIOBJ handle )
*/
static INT FONT_GetObjectW( HGDIOBJ handle, INT count, LPVOID buffer )
{
FONTOBJ *font = GDI_GetObjPtr( handle, OBJ_FONT );
FONTOBJ *font = GDI_GetObjPtr( handle, NTGDI_OBJ_FONT );
if (!font) return 0;
if (buffer)
......
......@@ -542,7 +542,7 @@ typedef struct
/* return the region data without making a copy */
static inline const WINEREGION *get_wine_region(HRGN rgn)
{
return GDI_GetObjPtr( rgn, OBJ_REGION );
return GDI_GetObjPtr( rgn, NTGDI_OBJ_REGION );
}
static inline void release_wine_region(HRGN rgn)
{
......
......@@ -691,20 +691,19 @@ static const char *gdi_obj_type( unsigned type )
{
switch ( type )
{
case OBJ_PEN: return "OBJ_PEN";
case OBJ_BRUSH: return "OBJ_BRUSH";
case OBJ_DC: return "OBJ_DC";
case OBJ_METADC: return "OBJ_METADC";
case OBJ_PAL: return "OBJ_PAL";
case OBJ_FONT: return "OBJ_FONT";
case OBJ_BITMAP: return "OBJ_BITMAP";
case OBJ_REGION: return "OBJ_REGION";
case OBJ_METAFILE: return "OBJ_METAFILE";
case OBJ_MEMDC: return "OBJ_MEMDC";
case OBJ_EXTPEN: return "OBJ_EXTPEN";
case OBJ_ENHMETADC: return "OBJ_ENHMETADC";
case OBJ_ENHMETAFILE: return "OBJ_ENHMETAFILE";
case OBJ_COLORSPACE: return "OBJ_COLORSPACE";
case NTGDI_OBJ_PEN: return "NTGDI_OBJ_PEN";
case NTGDI_OBJ_BRUSH: return "NTGDI_OBJ_BRUSH";
case NTGDI_OBJ_DC: return "NTGDI_OBJ_DC";
case NTGDI_OBJ_METADC: return "NTGDI_OBJ_METADC";
case NTGDI_OBJ_PAL: return "NTGDI_OBJ_PAL";
case NTGDI_OBJ_FONT: return "NTGDI_OBJ_FONT";
case NTGDI_OBJ_BITMAP: return "NTGDI_OBJ_BITMAP";
case NTGDI_OBJ_REGION: return "NTGDI_OBJ_REGION";
case NTGDI_OBJ_METAFILE: return "NTGDI_OBJ_METAFILE";
case NTGDI_OBJ_MEMDC: return "NTGDI_OBJ_MEMDC";
case NTGDI_OBJ_EXTPEN: return "NTGDI_OBJ_EXTPEN";
case NTGDI_OBJ_ENHMETADC: return "NTGDI_OBJ_ENHMETADC";
case NTGDI_OBJ_ENHMETAFILE: return "NTGDI_OBJ_ENHMETAFILE";
default: return "UNKNOWN";
}
}
......@@ -723,7 +722,7 @@ static void dump_gdi_objects( void )
else
TRACE( "handle %p obj %s type %s selcount %u deleted %u\n",
entry_to_handle( entry ), wine_dbgstr_longlong( entry->Object ),
gdi_obj_type( entry->Type ), entry_obj( entry )->selcount,
gdi_obj_type( entry->ExtType ), entry_obj( entry )->selcount,
entry_obj( entry )->deleted );
}
LeaveCriticalSection( &gdi_section );
......@@ -760,10 +759,10 @@ HGDIOBJ alloc_gdi_handle( struct gdi_obj_header *obj, WORD type, const struct gd
obj->selcount = 0;
obj->system = 0;
obj->deleted = 0;
entry->Object = (UINT_PTR)obj;
/* FIXME: Native uses ntgdi types, which are different that gdi OBJ_ types */
entry->Type = type;
if (++entry->Unique == 0xffff) entry->Unique = 1;
entry->Object = (UINT_PTR)obj;
entry->Type = type & 0x1f;
entry->ExtType = type;
if (++entry->Generation == 0xff) entry->Generation = 1;
ret = entry_to_handle( entry );
LeaveCriticalSection( &gdi_section );
TRACE( "allocated %s %p %u/%u\n", gdi_obj_type(type), ret,
......@@ -785,7 +784,7 @@ void *free_gdi_handle( HGDIOBJ handle )
EnterCriticalSection( &gdi_section );
if ((entry = handle_entry( handle )))
{
TRACE( "freed %s %p %u/%u\n", gdi_obj_type( entry->Type ), handle,
TRACE( "freed %s %p %u/%u\n", gdi_obj_type( entry->ExtType ), handle,
InterlockedDecrement( &debug_count ) + 1, GDI_MAX_HANDLE_COUNT );
object = entry_obj( entry );
entry->Type = 0;
......@@ -832,7 +831,7 @@ void *get_any_obj_ptr( HGDIOBJ handle, WORD *type )
if ((entry = handle_entry( handle )))
{
ptr = entry_obj( entry );
*type = entry->Type;
*type = entry->ExtType;
}
if (!ptr) LeaveCriticalSection( &gdi_section );
......
......@@ -102,7 +102,7 @@ HMETAFILE MF_Create_HMETAFILE(METAHEADER *mh)
return NULL;
metafile->data = mh;
return alloc_gdi_handle( &metafile->obj, OBJ_METAFILE, NULL );
return alloc_gdi_handle( &metafile->obj, NTGDI_OBJ_METAFILE, NULL );
}
/******************************************************************
......@@ -237,7 +237,7 @@ HMETAFILE WINAPI GetMetaFileW( LPCWSTR lpFilename )
/* return a copy of the metafile bits, to be freed with HeapFree */
static METAHEADER *get_metafile_bits( HMETAFILE hmf )
{
struct metafile *metafile = GDI_GetObjPtr( hmf, OBJ_METAFILE );
struct metafile *metafile = GDI_GetObjPtr( hmf, NTGDI_OBJ_METAFILE );
METAHEADER *ret;
if (!metafile) return NULL;
......@@ -1035,7 +1035,7 @@ HMETAFILE WINAPI SetMetaFileBitsEx( UINT size, const BYTE *lpData )
*/
UINT WINAPI GetMetaFileBitsEx( HMETAFILE hmf, UINT nSize, LPVOID buf )
{
struct metafile *metafile = GDI_GetObjPtr( hmf, OBJ_METAFILE );
struct metafile *metafile = GDI_GetObjPtr( hmf, NTGDI_OBJ_METAFILE );
UINT mfSize;
TRACE("(%p,%d,%p)\n", hmf, nSize, buf);
......
......@@ -243,7 +243,7 @@ static DC *MFDRV_AllocMetaFile(void)
DC *dc;
METAFILEDRV_PDEVICE *physDev;
if (!(dc = alloc_dc_ptr( OBJ_METADC ))) return NULL;
if (!(dc = alloc_dc_ptr( NTGDI_OBJ_METADC ))) return NULL;
physDev = HeapAlloc(GetProcessHeap(),0,sizeof(*physDev));
if (!physDev)
......
......@@ -62,7 +62,7 @@ static inline GDI_HANDLE_ENTRY *handle_entry( HGDIOBJ handle )
static WORD get_object_type( HGDIOBJ obj )
{
GDI_HANDLE_ENTRY *entry = handle_entry( obj );
return entry ? entry->Type : 0;
return entry ? entry->ExtType : 0;
}
/***********************************************************************
......@@ -70,10 +70,29 @@ static WORD get_object_type( HGDIOBJ obj )
*/
DWORD WINAPI GetObjectType( HGDIOBJ handle )
{
DWORD result = get_object_type( handle );
TRACE("%p -> %u\n", handle, result );
if (!result) SetLastError( ERROR_INVALID_HANDLE );
return result;
DWORD type = get_object_type( handle );
TRACE( "%p -> %u\n", handle, type );
switch (type)
{
case NTGDI_OBJ_PEN: return OBJ_PEN;
case NTGDI_OBJ_BRUSH: return OBJ_BRUSH;
case NTGDI_OBJ_DC: return OBJ_DC;
case NTGDI_OBJ_METADC: return OBJ_METADC;
case NTGDI_OBJ_PAL: return OBJ_PAL;
case NTGDI_OBJ_FONT: return OBJ_FONT;
case NTGDI_OBJ_BITMAP: return OBJ_BITMAP;
case NTGDI_OBJ_REGION: return OBJ_REGION;
case NTGDI_OBJ_METAFILE: return OBJ_METAFILE;
case NTGDI_OBJ_MEMDC: return OBJ_MEMDC;
case NTGDI_OBJ_EXTPEN: return OBJ_EXTPEN;
case NTGDI_OBJ_ENHMETADC: return OBJ_ENHMETADC;
case NTGDI_OBJ_ENHMETAFILE: return OBJ_ENHMETAFILE;
default:
SetLastError( ERROR_INVALID_HANDLE );
return 0;
}
}
/***********************************************************************
......@@ -99,20 +118,20 @@ HGDIOBJ WINAPI SelectObject( HDC hdc, HGDIOBJ obj )
switch (get_object_type( obj ))
{
case OBJ_PEN:
case OBJ_EXTPEN:
case NTGDI_OBJ_PEN:
case NTGDI_OBJ_EXTPEN:
ret = NtGdiSelectPen( hdc, obj );
break;
case OBJ_BRUSH:
case NTGDI_OBJ_BRUSH:
ret = NtGdiSelectBrush( hdc, obj );
break;
case OBJ_FONT:
case NTGDI_OBJ_FONT:
ret = NtGdiSelectFont( hdc, obj );
break;
case OBJ_BITMAP:
case NTGDI_OBJ_BITMAP:
ret = NtGdiSelectBitmap( hdc, obj );
break;
case OBJ_REGION:
case NTGDI_OBJ_REGION:
ret = ULongToHandle(SelectClipRgn( hdc, obj ));
break;
default:
......@@ -138,12 +157,12 @@ INT WINAPI GetObjectW( HGDIOBJ handle, INT count, void *buffer )
switch(get_object_type( handle ))
{
case 0:
case OBJ_BITMAP:
case OBJ_BRUSH:
case OBJ_FONT:
case OBJ_PAL:
case OBJ_PEN:
case OBJ_EXTPEN:
case NTGDI_OBJ_BITMAP:
case NTGDI_OBJ_BRUSH:
case NTGDI_OBJ_FONT:
case NTGDI_OBJ_PAL:
case NTGDI_OBJ_PEN:
case NTGDI_OBJ_EXTPEN:
break;
default:
SetLastError( ERROR_INVALID_HANDLE );
......@@ -159,7 +178,7 @@ INT WINAPI GetObjectA( HGDIOBJ handle, INT count, void *buffer )
{
TRACE("%p %d %p\n", handle, count, buffer );
if (get_object_type( handle ) == OBJ_FONT)
if (get_object_type( handle ) == NTGDI_OBJ_FONT)
{
LOGFONTA *lfA = buffer;
LOGFONTW lf;
......
......@@ -128,7 +128,7 @@ HPALETTE WINAPI CreatePalette(
return 0;
}
memcpy( palettePtr->entries, palette->palPalEntry, size );
if (!(hpalette = alloc_gdi_handle( &palettePtr->obj, OBJ_PAL, &palette_funcs )))
if (!(hpalette = alloc_gdi_handle( &palettePtr->obj, NTGDI_OBJ_PAL, &palette_funcs )))
{
HeapFree( GetProcessHeap(), 0, palettePtr->entries );
HeapFree( GetProcessHeap(), 0, palettePtr );
......@@ -193,7 +193,7 @@ UINT WINAPI GetPaletteEntries(
TRACE("hpal = %p, count=%i\n", hpalette, count );
palPtr = GDI_GetObjPtr( hpalette, OBJ_PAL );
palPtr = GDI_GetObjPtr( hpalette, NTGDI_OBJ_PAL );
if (!palPtr) return 0;
/* NOTE: not documented but test show this to be the case */
......@@ -239,7 +239,7 @@ UINT WINAPI SetPaletteEntries(
hpalette = get_full_gdi_handle( hpalette );
if (hpalette == GetStockObject(DEFAULT_PALETTE)) return 0;
palPtr = GDI_GetObjPtr( hpalette, OBJ_PAL );
palPtr = GDI_GetObjPtr( hpalette, NTGDI_OBJ_PAL );
if (!palPtr) return 0;
numEntries = palPtr->count;
......@@ -269,7 +269,7 @@ BOOL WINAPI ResizePalette(
HPALETTE hPal, /* [in] Handle of logical palette */
UINT cEntries) /* [in] Number of entries in logical palette */
{
PALETTEOBJ * palPtr = GDI_GetObjPtr( hPal, OBJ_PAL );
PALETTEOBJ * palPtr = GDI_GetObjPtr( hPal, NTGDI_OBJ_PAL );
PALETTEENTRY *entries;
if( !palPtr ) return FALSE;
......@@ -317,7 +317,7 @@ BOOL WINAPI AnimatePalette(
UINT pal_entries;
const PALETTEENTRY *pptr = PaletteColors;
palPtr = GDI_GetObjPtr( hPal, OBJ_PAL );
palPtr = GDI_GetObjPtr( hPal, NTGDI_OBJ_PAL );
if (!palPtr) return FALSE;
pal_entries = palPtr->count;
......@@ -472,7 +472,7 @@ UINT WINAPI GetNearestPaletteIndex(
HPALETTE hpalette, /* [in] Handle of logical color palette */
COLORREF color) /* [in] Color to be matched */
{
PALETTEOBJ* palObj = GDI_GetObjPtr( hpalette, OBJ_PAL );
PALETTEOBJ* palObj = GDI_GetObjPtr( hpalette, NTGDI_OBJ_PAL );
UINT index = 0;
if( palObj )
......@@ -562,7 +562,7 @@ COLORREF WINAPI GetNearestColor(
*/
static INT PALETTE_GetObject( HGDIOBJ handle, INT count, LPVOID buffer )
{
PALETTEOBJ *palette = GDI_GetObjPtr( handle, OBJ_PAL );
PALETTEOBJ *palette = GDI_GetObjPtr( handle, NTGDI_OBJ_PAL );
if (!palette) return 0;
......@@ -582,7 +582,7 @@ static INT PALETTE_GetObject( HGDIOBJ handle, INT count, LPVOID buffer )
*/
static BOOL PALETTE_UnrealizeObject( HGDIOBJ handle )
{
PALETTEOBJ *palette = GDI_GetObjPtr( handle, OBJ_PAL );
PALETTEOBJ *palette = GDI_GetObjPtr( handle, NTGDI_OBJ_PAL );
if (palette)
{
......@@ -666,7 +666,7 @@ UINT WINAPI GDIRealizePalette( HDC hdc )
else if (InterlockedExchangePointer( (void **)&hLastRealizedPalette, dc->hPalette ) != dc->hPalette)
{
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pRealizePalette );
PALETTEOBJ *palPtr = GDI_GetObjPtr( dc->hPalette, OBJ_PAL );
PALETTEOBJ *palPtr = GDI_GetObjPtr( dc->hPalette, NTGDI_OBJ_PAL );
if (palPtr)
{
realized = physdev->funcs->pRealizePalette( physdev, dc->hPalette,
......
......@@ -87,7 +87,7 @@ HPEN WINAPI NtGdiCreatePen( INT style, INT width, COLORREF color, HBRUSH brush )
penPtr->logpen.elpColor = color;
penPtr->logpen.elpBrushStyle = BS_SOLID;
if (!(hpen = alloc_gdi_handle( &penPtr->obj, OBJ_PEN, &pen_funcs )))
if (!(hpen = alloc_gdi_handle( &penPtr->obj, NTGDI_OBJ_PEN, &pen_funcs )))
HeapFree( GetProcessHeap(), 0, penPtr );
return hpen;
}
......@@ -177,7 +177,7 @@ HPEN WINAPI ExtCreatePen( DWORD style, DWORD width,
penPtr->logpen.elpNumEntries = style_count;
memcpy(penPtr->logpen.elpStyleEntry, style_bits, style_count * sizeof(DWORD));
if (!(hpen = alloc_gdi_handle( &penPtr->obj, OBJ_EXTPEN, &pen_funcs )))
if (!(hpen = alloc_gdi_handle( &penPtr->obj, NTGDI_OBJ_EXTPEN, &pen_funcs )))
{
free_brush_pattern( &penPtr->pattern );
HeapFree( GetProcessHeap(), 0, penPtr );
......@@ -209,10 +209,10 @@ HGDIOBJ WINAPI NtGdiSelectPen( HDC hdc, HGDIOBJ handle )
switch (type)
{
case OBJ_PEN:
case NTGDI_OBJ_PEN:
pattern = NULL;
break;
case OBJ_EXTPEN:
case NTGDI_OBJ_EXTPEN:
pattern = &pen->pattern;
if (!pattern->info) pattern = NULL;
break;
......@@ -268,7 +268,7 @@ static INT PEN_GetObject( HGDIOBJ handle, INT count, LPVOID buffer )
switch (type)
{
case OBJ_PEN:
case NTGDI_OBJ_PEN:
{
LOGPEN *lp;
......@@ -293,7 +293,7 @@ static INT PEN_GetObject( HGDIOBJ handle, INT count, LPVOID buffer )
break;
}
case OBJ_EXTPEN:
case NTGDI_OBJ_EXTPEN:
ret = sizeof(EXTLOGPEN) + pen->logpen.elpNumEntries * sizeof(DWORD) - sizeof(pen->logpen.elpStyleEntry);
if (buffer)
{
......
......@@ -537,7 +537,7 @@ static BOOL REGION_OffsetRegion( WINEREGION *rgn, WINEREGION *srcrgn, INT x, INT
*/
INT WINAPI NtGdiOffsetRgn( HRGN hrgn, INT x, INT y )
{
WINEREGION *obj = GDI_GetObjPtr( hrgn, OBJ_REGION );
WINEREGION *obj = GDI_GetObjPtr( hrgn, NTGDI_OBJ_REGION );
INT ret;
TRACE("%p %d,%d\n", hrgn, x, y);
......@@ -572,7 +572,7 @@ INT WINAPI NtGdiOffsetRgn( HRGN hrgn, INT x, INT y )
*/
INT WINAPI NtGdiGetRgnBox( HRGN hrgn, RECT *rect )
{
WINEREGION *obj = GDI_GetObjPtr( hrgn, OBJ_REGION );
WINEREGION *obj = GDI_GetObjPtr( hrgn, NTGDI_OBJ_REGION );
if (obj)
{
INT ret;
......@@ -611,7 +611,7 @@ HRGN WINAPI NtGdiCreateRectRgn( INT left, INT top, INT right, INT bottom )
if (!(obj = alloc_region( RGN_DEFAULT_RECTS ))) return 0;
if (!(hrgn = alloc_gdi_handle( &obj->obj, OBJ_REGION, &region_funcs )))
if (!(hrgn = alloc_gdi_handle( &obj->obj, NTGDI_OBJ_REGION, &region_funcs )))
{
free_region( obj );
return 0;
......@@ -647,7 +647,7 @@ BOOL WINAPI NtGdiSetRectRgn( HRGN hrgn, INT left, INT top, INT right, INT bottom
TRACE("%p %d,%d-%d,%d\n", hrgn, left, top, right, bottom );
if (!(obj = GDI_GetObjPtr( hrgn, OBJ_REGION ))) return FALSE;
if (!(obj = GDI_GetObjPtr( hrgn, NTGDI_OBJ_REGION ))) return FALSE;
if (left > right) { INT tmp = left; left = right; right = tmp; }
if (top > bottom) { INT tmp = top; top = bottom; bottom = tmp; }
......@@ -768,7 +768,7 @@ HRGN WINAPI NtGdiCreateRoundRectRgn( INT left, INT top, INT right, INT bottom,
}
rects[ellipse_height / 2].top = top + ellipse_height / 2; /* extend to top of rectangle */
hrgn = alloc_gdi_handle( &obj->obj, OBJ_REGION, &region_funcs );
hrgn = alloc_gdi_handle( &obj->obj, NTGDI_OBJ_REGION, &region_funcs );
TRACE("(%d,%d-%d,%d %dx%d): ret=%p\n",
left, top, right, bottom, ellipse_width, ellipse_height, hrgn );
......@@ -829,7 +829,7 @@ HRGN WINAPI NtGdiCreateEllipticRgn( INT left, INT top, INT right, INT bottom )
DWORD WINAPI NtGdiGetRegionData( HRGN hrgn, DWORD count, RGNDATA *rgndata )
{
DWORD size;
WINEREGION *obj = GDI_GetObjPtr( hrgn, OBJ_REGION );
WINEREGION *obj = GDI_GetObjPtr( hrgn, NTGDI_OBJ_REGION );
TRACE(" %p count = %d, rgndata = %p\n", hrgn, count, rgndata);
......@@ -944,7 +944,7 @@ HRGN WINAPI NtGdiExtCreateRegion( const XFORM *xform, DWORD count, const RGNDATA
if (!REGION_UnionRectWithRegion( pCurRect, obj )) goto done;
}
}
hrgn = alloc_gdi_handle( &obj->obj, OBJ_REGION, &region_funcs );
hrgn = alloc_gdi_handle( &obj->obj, NTGDI_OBJ_REGION, &region_funcs );
done:
if (!hrgn) free_region( obj );
......@@ -972,7 +972,7 @@ BOOL WINAPI NtGdiPtInRegion( HRGN hrgn, INT x, INT y )
WINEREGION *obj;
BOOL ret = FALSE;
if ((obj = GDI_GetObjPtr( hrgn, OBJ_REGION )))
if ((obj = GDI_GetObjPtr( hrgn, NTGDI_OBJ_REGION )))
{
if (obj->numRects > 0 && is_in_rect( &obj->extents, x, y ))
region_find_pt( obj, x, y, &ret );
......@@ -1007,7 +1007,7 @@ BOOL WINAPI NtGdiRectInRegion( HRGN hrgn, const RECT *rect )
rc = *rect;
order_rect( &rc );
if ((obj = GDI_GetObjPtr( hrgn, OBJ_REGION )))
if ((obj = GDI_GetObjPtr( hrgn, NTGDI_OBJ_REGION )))
{
if ((obj->numRects > 0) && overlapping(&obj->extents, &rc))
{
......@@ -1050,9 +1050,9 @@ BOOL WINAPI NtGdiEqualRgn( HRGN hrgn1, HRGN hrgn2 )
WINEREGION *obj1, *obj2;
BOOL ret = FALSE;
if ((obj1 = GDI_GetObjPtr( hrgn1, OBJ_REGION )))
if ((obj1 = GDI_GetObjPtr( hrgn1, NTGDI_OBJ_REGION )))
{
if ((obj2 = GDI_GetObjPtr( hrgn2, OBJ_REGION )))
if ((obj2 = GDI_GetObjPtr( hrgn2, NTGDI_OBJ_REGION )))
{
int i;
......@@ -1100,7 +1100,7 @@ static BOOL REGION_UnionRectWithRegion(const RECT *rect, WINEREGION *rgn)
BOOL add_rect_to_region( HRGN rgn, const RECT *rect )
{
WINEREGION *obj = GDI_GetObjPtr( rgn, OBJ_REGION );
WINEREGION *obj = GDI_GetObjPtr( rgn, NTGDI_OBJ_REGION );
BOOL ret;
if (!obj) return FALSE;
......@@ -1122,13 +1122,13 @@ BOOL REGION_FrameRgn( HRGN hDest, HRGN hSrc, INT x, INT y )
WINEREGION tmprgn;
BOOL bRet = FALSE;
WINEREGION* destObj = NULL;
WINEREGION *srcObj = GDI_GetObjPtr( hSrc, OBJ_REGION );
WINEREGION *srcObj = GDI_GetObjPtr( hSrc, NTGDI_OBJ_REGION );
tmprgn.rects = NULL;
if (!srcObj) return FALSE;
if (srcObj->numRects != 0)
{
if (!(destObj = GDI_GetObjPtr( hDest, OBJ_REGION ))) goto done;
if (!(destObj = GDI_GetObjPtr( hDest, NTGDI_OBJ_REGION ))) goto done;
if (!init_region( &tmprgn, srcObj->numRects )) goto done;
if (!REGION_OffsetRegion( destObj, srcObj, -x, 0)) goto done;
......@@ -1179,13 +1179,13 @@ done:
*/
INT WINAPI NtGdiCombineRgn( HRGN hDest, HRGN hSrc1, HRGN hSrc2, INT mode )
{
WINEREGION *destObj = GDI_GetObjPtr( hDest, OBJ_REGION );
WINEREGION *destObj = GDI_GetObjPtr( hDest, NTGDI_OBJ_REGION );
INT result = ERROR;
TRACE(" %p,%p -> %p mode=%x\n", hSrc1, hSrc2, hDest, mode );
if (destObj)
{
WINEREGION *src1Obj = GDI_GetObjPtr( hSrc1, OBJ_REGION );
WINEREGION *src1Obj = GDI_GetObjPtr( hSrc1, NTGDI_OBJ_REGION );
if (src1Obj)
{
......@@ -1199,7 +1199,7 @@ INT WINAPI NtGdiCombineRgn( HRGN hDest, HRGN hSrc1, HRGN hSrc2, INT mode )
}
else
{
WINEREGION *src2Obj = GDI_GetObjPtr( hSrc2, OBJ_REGION );
WINEREGION *src2Obj = GDI_GetObjPtr( hSrc2, NTGDI_OBJ_REGION );
if (src2Obj)
{
......@@ -1360,8 +1360,8 @@ INT mirror_region( HRGN dst, HRGN src, INT width )
WINEREGION *src_rgn, *dst_rgn;
INT ret = ERROR;
if (!(src_rgn = GDI_GetObjPtr( src, OBJ_REGION ))) return ERROR;
if ((dst_rgn = GDI_GetObjPtr( dst, OBJ_REGION )))
if (!(src_rgn = GDI_GetObjPtr( src, NTGDI_OBJ_REGION ))) return ERROR;
if ((dst_rgn = GDI_GetObjPtr( dst, NTGDI_OBJ_REGION )))
{
if (REGION_MirrorRegion( dst_rgn, src_rgn, width )) ret = get_region_type( dst_rgn );
GDI_ReleaseObj( dst_rgn );
......@@ -2684,7 +2684,7 @@ HRGN create_polypolygon_region( const POINT *Pts, const INT *Count, INT nbpolygo
{
if (nb_points) scan_convert( obj, &ET, mode, clip_rect );
if (!(hrgn = alloc_gdi_handle( &obj->obj, OBJ_REGION, &region_funcs )))
if (!(hrgn = alloc_gdi_handle( &obj->obj, NTGDI_OBJ_REGION, &region_funcs )))
free_region( obj );
}
......
......@@ -389,7 +389,6 @@ static void test_shared_handle_entry( HGDIOBJ obj, unsigned int type, BOOL is_st
entry->Unique, handle >> 16);
if (type != NTGDI_OBJ_MEMDC)
{
todo_wine
ok(entry->ExtType == type, "ExtType = %x, expected %x\n", entry->ExtType, type);
}
else
......@@ -399,7 +398,6 @@ static void test_shared_handle_entry( HGDIOBJ obj, unsigned int type, BOOL is_st
}
todo_wine_if(is_stock)
ok(entry->StockFlag == is_stock, "StockFlag = %x\n", entry->StockFlag);
todo_wine
ok(entry->Type == (type & 0x1f), "Type = %x, expected %x\n", entry->Type, type & 0x1f);
ok(entry->Object, "Object = NULL\n");
ok(entry->Owner.Count == 0, "Count = %u\n", entry->Owner.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