- Removed NtGdiDeleteObject from w32ksvc.db and ntgdibad.h.

- Moved the define export to gdiobj.h and made it a FASTCALL internal to win32k.
- I did not rename it to IntXXXX.
- Implemented a functional DeleteObject for gdi.

svn path=/trunk/; revision=30133
This commit is contained in:
James Tabor 2007-11-04 22:10:59 +00:00
parent 9fb45686cb
commit 49f59088cf
6 changed files with 48 additions and 16 deletions

View file

@ -276,30 +276,59 @@ DeleteDC(HDC hDC)
return Ret; return Ret;
} }
/* /*
* @implemented * @implemented
*/ */
BOOL BOOL
STDCALL STDCALL
DeleteObject(HGDIOBJ hObject) DeleteObject(HGDIOBJ hObject)
{ {
UINT Type = 0;
/* From Wine: DeleteObject does not SetLastError() on a null object */ /* From Wine: DeleteObject does not SetLastError() on a null object */
if(!hObject) return FALSE; if(!hObject) return FALSE;
if (0 != ((DWORD) hObject & GDI_HANDLE_STOCK_MASK)) if (0 != ((DWORD) hObject & GDI_HANDLE_STOCK_MASK))
{ { // Relax! This is a normal return!
DPRINT1("Trying to delete system object 0x%x\n", hObject); DPRINT("Trying to delete system object 0x%x\n", hObject);
return TRUE; return TRUE;
} }
// If you dont own it?! Get OUT!
if(!GdiIsHandleValid(hObject)) return FALSE;
/* deleting a handle that doesn't belong to the caller should be rather rarely Type = GDI_HANDLE_GET_TYPE(hObject);
so for the sake of speed just try to delete it without checking validity */
return NtGdiDeleteObject(hObject); if ((Type == GDI_OBJECT_TYPE_METAFILE) ||
(Type == GDI_OBJECT_TYPE_ENHMETAFILE))
return FALSE;
switch (Type)
{
case GDI_OBJECT_TYPE_DC:
return DeleteDC((HDC) hObject);
case GDI_OBJECT_TYPE_COLORSPACE:
return NtGdiDeleteColorSpace((HCOLORSPACE) hObject);
#if 0
case GDI_OBJECT_TYPE_METADC:
return MFDRV_DeleteObject( hObject );
case GDI_OBJECT_TYPE_EMF:
{
PLDC pLDC = GdiGetLDC(hObject);
if ( !pLDC ) return FALSE;
return EMFDRV_DeleteObject( hObject );
}
#endif
case GDI_OBJECT_TYPE_REGION:
case GDI_OBJECT_TYPE_BRUSH:
case GDI_OBJECT_TYPE_EXTPEN:
case GDI_OBJECT_TYPE_PEN:
case GDI_OBJECT_TYPE_FONT:
case GDI_OBJECT_TYPE_BITMAP:
break;
}
return NtGdiDeleteObjectApp(hObject);
} }
INT INT
STDCALL STDCALL
GetArcDirection( HDC hdc ) GetArcDirection( HDC hdc )

View file

@ -152,9 +152,6 @@ NtGdiDeleteEnhMetaFile (
HENHMETAFILE emf HENHMETAFILE emf
); );
/* Should be done in user-mode. */
BOOL STDCALL NtGdiDeleteObject(HGDIOBJ hObject);
/* Meta are user-mode. */ /* Meta are user-mode. */
BOOL BOOL
STDCALL STDCALL

View file

@ -93,4 +93,6 @@ PVOID INTERNAL_CALL GDI_MapHandleTable(PSECTION_OBJECT SectionObject, PEPROCES
#define GDIOBJFLAG_IGNOREPID (0x1) #define GDIOBJFLAG_IGNOREPID (0x1)
#define GDIOBJFLAG_IGNORELOCK (0x2) #define GDIOBJFLAG_IGNORELOCK (0x2)
BOOL FASTCALL NtGdiDeleteObject(HGDIOBJ hObject);
#endif #endif

View file

@ -1023,11 +1023,15 @@ NtGdiOpenDCW( PUNICODE_STRING Device,
} }
BOOL STDCALL BOOL
STDCALL
NtGdiDeleteObjectApp(HANDLE DCHandle) NtGdiDeleteObjectApp(HANDLE DCHandle)
{ {
PDC DCToDelete; PDC DCToDelete;
if (GDI_HANDLE_GET_TYPE(DCHandle) != GDI_OBJECT_TYPE_DC)
return NtGdiDeleteObject((HGDIOBJ) DCHandle);
if (!GDIOBJ_OwnedByCurrentProcess(GdiHandleTable, DCHandle)) if (!GDIOBJ_OwnedByCurrentProcess(GdiHandleTable, DCHandle))
{ {
SetLastWin32Error(ERROR_INVALID_HANDLE); SetLastWin32Error(ERROR_INVALID_HANDLE);

View file

@ -663,7 +663,8 @@ LockHandle:
* \param hObject object handle * \param hObject object handle
* \return if the function fails the returned value is FALSE. * \return if the function fails the returned value is FALSE.
*/ */
BOOL STDCALL BOOL
FASTCALL
NtGdiDeleteObject(HGDIOBJ hObject) NtGdiDeleteObject(HGDIOBJ hObject)
{ {
DPRINT("NtGdiDeleteObject handle 0x%08x\n", hObject); DPRINT("NtGdiDeleteObject handle 0x%08x\n", hObject);

View file

@ -738,7 +738,6 @@ NtGdiCreateDIBitmap 6
NtGdiCreateEnhMetaFile 4 NtGdiCreateEnhMetaFile 4
NtGdiCreateScalableFontResource 4 NtGdiCreateScalableFontResource 4
NtGdiDeleteEnhMetaFile 1 NtGdiDeleteEnhMetaFile 1
NtGdiDeleteObject 1
NtGdiEnumEnhMetaFile 5 NtGdiEnumEnhMetaFile 5
NtGdiEnumFonts 4 NtGdiEnumFonts 4
NtGdiEnumICMProfiles 3 NtGdiEnumICMProfiles 3