Author: jimtabor Date: Wed Mar 25 04:07:02 2009 New Revision: 40212
URL: http://svn.reactos.org/svn/reactos?rev=40212&view=rev Log: - Write new simplified NtGdiDeleteObjectApp based on test case. - Include internal function GetObjectOwner to support retrieval of owner process ID. - Update GDI_TABLE_ENTRY.
Modified: trunk/reactos/include/reactos/win32k/ntgdihdl.h trunk/reactos/subsystems/win32/win32k/include/gdiobj.h trunk/reactos/subsystems/win32/win32k/objects/dclife.c trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c
Modified: trunk/reactos/include/reactos/win32k/ntgdihdl.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/win32k/ntgd... ============================================================================== --- trunk/reactos/include/reactos/win32k/ntgdihdl.h [iso-8859-1] (original) +++ trunk/reactos/include/reactos/win32k/ntgdihdl.h [iso-8859-1] Wed Mar 25 04:07:02 2009 @@ -219,9 +219,9 @@ union{ /* temp union structure. */ LONG Type; /* the first 16 bit is the object type including the stock obj flag, the last 16 bits is just the object type */ struct{ - SHORT FullUnique; /* unique */ - CHAR ObjectType; /* objt */ - CHAR Flags; /* Flags */ + USHORT FullUnique; /* unique */ + UCHAR ObjectType; /* objt */ + UCHAR Flags; /* Flags */ };}; PVOID UserData; /* pUser Points to the user mode structure, usually NULL though */ } GDI_TABLE_ENTRY, *PGDI_TABLE_ENTRY;
Modified: trunk/reactos/subsystems/win32/win32k/include/gdiobj.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/gdiobj.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/gdiobj.h [iso-8859-1] Wed Mar 25 04:07:02 2009 @@ -121,4 +121,6 @@ } #endif
+INT FASTCALL GreGetObjectOwner(HGDIOBJ, GDIOBJTYPE); + #endif
Modified: trunk/reactos/subsystems/win32/win32k/objects/dclife.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/obj... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/dclife.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/dclife.c [iso-8859-1] Wed Mar 25 04:07:02 2009 @@ -665,3 +665,34 @@ return IntGdiDeleteDC(DCHandle, FALSE); }
+BOOL +APIENTRY +NewNtGdiDeleteObjectApp(HANDLE DCHandle) +{ + GDIOBJTYPE ObjType; + + if (GDI_HANDLE_IS_STOCKOBJ(DCHandle)) return TRUE; + + ObjType = GDI_HANDLE_GET_TYPE(DCHandle) >> GDI_ENTRY_UPPER_SHIFT; + + if (GreGetObjectOwner( DCHandle, ObjType)) + { + switch(ObjType) + { + case GDIObjType_DC_TYPE: + return IntGdiDeleteDC(DCHandle, FALSE); + + case GDIObjType_RGN_TYPE: + case GDIObjType_SURF_TYPE: + case GDIObjType_PAL_TYPE: + case GDIObjType_LFONT_TYPE: + case GDIObjType_BRUSH_TYPE: + return NtGdiDeleteObject((HGDIOBJ) DCHandle); + + default: + return FALSE; + } + } + return (DCHandle != NULL); +} +
Modified: trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/obj... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c [iso-8859-1] Wed Mar 25 04:07:02 2009 @@ -1608,6 +1608,26 @@ return TRUE; }
+INT +FASTCALL +GreGetObjectOwner(HGDIOBJ Handle, GDIOBJTYPE ObjType) +{ + INT Ret = GDI_OBJ_HMGR_RESTRICTED; + + if ( GDI_HANDLE_GET_INDEX(Handle) < GDI_HANDLE_COUNT ) + { + PGDI_TABLE_ENTRY pEntry = &GdiHandleTable->Entries[GDI_HANDLE_GET_INDEX(Handle)]; + + if (pEntry->ObjectType == ObjType) + { + if (pEntry->FullUnique == (GDI_HANDLE_GET_UPPER(Handle) >> GDI_ENTRY_UPPER_SHIFT)) + Ret = pEntry->ProcessId & ~1; + } + } + return Ret; +} + + W32KAPI HANDLE APIENTRY