1c2c66affSColin Finck /* 2c2c66affSColin Finck * GDI object common header definition 3c2c66affSColin Finck * 4c2c66affSColin Finck */ 5c2c66affSColin Finck 6c2c66affSColin Finck #pragma once 7c2c66affSColin Finck 8c2c66affSColin Finck #define GDI_OBJECT_STACK_LEVELS 20 9c2c66affSColin Finck 10c2c66affSColin Finck /* The first 10 entries are never used in windows, they are empty */ 11c2c66affSColin Finck static const unsigned RESERVE_ENTRIES_COUNT = 10; 12c2c66affSColin Finck 13c2c66affSColin Finck typedef struct _GDI_HANDLE_TABLE 14c2c66affSColin Finck { 15c2c66affSColin Finck /* The table must be located at the beginning of this structure so it can be 16c2c66affSColin Finck * properly mapped! 17c2c66affSColin Finck */ 18c2c66affSColin Finck ////////////////////////////////////////////////////////////////////////////// 19c2c66affSColin Finck GDI_TABLE_ENTRY Entries[GDI_HANDLE_COUNT]; 20c2c66affSColin Finck DEVCAPS DevCaps; // Device Capabilities. 21c2c66affSColin Finck FLONG flDeviceUniq; // Device settings uniqueness. 22c2c66affSColin Finck PVOID pvLangPack; // Language Pack. 23c2c66affSColin Finck CFONT cfPublic[GDI_CFONT_MAX]; // Public Fonts. 24c2c66affSColin Finck DWORD dwCFCount; 25c2c66affSColin Finck 26c2c66affSColin Finck 27c2c66affSColin Finck } GDI_HANDLE_TABLE, *PGDI_HANDLE_TABLE; 28c2c66affSColin Finck 29c2c66affSColin Finck extern PGDI_HANDLE_TABLE GdiHandleTable; 30c2c66affSColin Finck 31c2c66affSColin Finck typedef PVOID PGDIOBJ; 32c2c66affSColin Finck 33c2c66affSColin Finck typedef VOID (NTAPI *GDICLEANUPPROC)(PVOID ObjectBody); 34c2c66affSColin Finck typedef VOID (NTAPI *GDIOBJDELETEPROC)(PVOID ObjectBody); 35c2c66affSColin Finck 36c2c66affSColin Finck /* Every GDI Object must have this standard type of header. 37c2c66affSColin Finck * It's for thread locking. */ 38c2c66affSColin Finck typedef struct _BASEOBJECT 39c2c66affSColin Finck { 40c2c66affSColin Finck HGDIOBJ hHmgr; 41c2c66affSColin Finck union { 42c2c66affSColin Finck ULONG ulShareCount; /* For objects without a handle */ 43c2c66affSColin Finck DWORD dwThreadId; /* Exclusive lock owner */ 44c2c66affSColin Finck }; 45c2c66affSColin Finck USHORT cExclusiveLock; 46c2c66affSColin Finck USHORT BaseFlags; 47c2c66affSColin Finck EX_PUSH_LOCK pushlock; 48c2c66affSColin Finck #if DBG_ENABLE_GDIOBJ_BACKTRACES 49c2c66affSColin Finck PVOID apvBackTrace[GDI_OBJECT_STACK_LEVELS]; 50c2c66affSColin Finck #endif 51c2c66affSColin Finck #if DBG_ENABLE_EVENT_LOGGING 52c2c66affSColin Finck SLIST_HEADER slhLog; 53c2c66affSColin Finck #endif 54c2c66affSColin Finck } BASEOBJECT, *POBJ; 55c2c66affSColin Finck 56c2c66affSColin Finck enum BASEFLAGS 57c2c66affSColin Finck { 58c2c66affSColin Finck BASEFLAG_LOOKASIDE = 0x80, 59c2c66affSColin Finck 60c2c66affSColin Finck /* ReactOS specific: */ 61c2c66affSColin Finck BASEFLAG_READY_TO_DIE = 0x1000 62c2c66affSColin Finck }; 63c2c66affSColin Finck 64c2c66affSColin Finck typedef struct _CLIENTOBJ 65c2c66affSColin Finck { 66c2c66affSColin Finck BASEOBJECT BaseObject; 67c2c66affSColin Finck } CLIENTOBJ, *PCLIENTOBJ; 68c2c66affSColin Finck 69c2c66affSColin Finck enum _GDIOBJLAGS 70c2c66affSColin Finck { 71c2c66affSColin Finck GDIOBJFLAG_DEFAULT = 0x00, 72c2c66affSColin Finck GDIOBJFLAG_IGNOREPID = 0x01, 73c2c66affSColin Finck GDIOBJFLAG_IGNORELOCK = 0x02 74c2c66affSColin Finck }; 75c2c66affSColin Finck 763adf4508SJérôme Gardou CODE_SEG("INIT") 77c2c66affSColin Finck NTSTATUS 78c2c66affSColin Finck NTAPI 79c2c66affSColin Finck InitGdiHandleTable(VOID); 80c2c66affSColin Finck 81c2c66affSColin Finck BOOL 82c2c66affSColin Finck NTAPI 83c2c66affSColin Finck GreIsHandleValid( 84c2c66affSColin Finck HGDIOBJ hobj); 85c2c66affSColin Finck 86c2c66affSColin Finck BOOL 87c2c66affSColin Finck NTAPI 88c2c66affSColin Finck GreDeleteObject( 89c2c66affSColin Finck HGDIOBJ hObject); 90c2c66affSColin Finck 91c2c66affSColin Finck ULONG 92c2c66affSColin Finck NTAPI 93c2c66affSColin Finck GreGetObjectOwner( 94c2c66affSColin Finck HGDIOBJ hobj); 95c2c66affSColin Finck 96c2c66affSColin Finck BOOL 97c2c66affSColin Finck NTAPI 98c2c66affSColin Finck GreSetObjectOwner( 99c2c66affSColin Finck HGDIOBJ hobj, 100c2c66affSColin Finck ULONG ulOwner); 101c2c66affSColin Finck 102c2c66affSColin Finck BOOL 103c2c66affSColin Finck NTAPI 104c2c66affSColin Finck GreSetObjectOwnerEx( 105c2c66affSColin Finck HGDIOBJ hobj, 106c2c66affSColin Finck ULONG ulOwner, 107c2c66affSColin Finck ULONG Flags); 108c2c66affSColin Finck 109c2c66affSColin Finck INT 110c2c66affSColin Finck NTAPI 111c2c66affSColin Finck GreGetObject( 112c2c66affSColin Finck IN HGDIOBJ hobj, 113c2c66affSColin Finck IN INT cbCount, 11423ad2173SKatayama Hirofumi MZ OUT PVOID pvBuffer); 115c2c66affSColin Finck 116c2c66affSColin Finck POBJ 117c2c66affSColin Finck NTAPI 118c2c66affSColin Finck GDIOBJ_AllocateObject( 119c2c66affSColin Finck UCHAR objt, 120c2c66affSColin Finck ULONG cjSize, 121c2c66affSColin Finck FLONG fl); 122c2c66affSColin Finck 123c2c66affSColin Finck VOID 124c2c66affSColin Finck NTAPI 125c2c66affSColin Finck GDIOBJ_vDeleteObject( 126c2c66affSColin Finck POBJ pobj); 127c2c66affSColin Finck 128c2c66affSColin Finck POBJ 129c2c66affSColin Finck NTAPI 130c2c66affSColin Finck GDIOBJ_ReferenceObjectByHandle( 131c2c66affSColin Finck HGDIOBJ hobj, 132c2c66affSColin Finck UCHAR objt); 133c2c66affSColin Finck 134c2c66affSColin Finck VOID 135c2c66affSColin Finck NTAPI 136c2c66affSColin Finck GDIOBJ_vReferenceObjectByPointer( 137c2c66affSColin Finck POBJ pobj); 138c2c66affSColin Finck 139c2c66affSColin Finck VOID 140c2c66affSColin Finck NTAPI 141c2c66affSColin Finck GDIOBJ_vDereferenceObject( 142c2c66affSColin Finck POBJ pobj); 143c2c66affSColin Finck 144c2c66affSColin Finck PGDIOBJ 145c2c66affSColin Finck NTAPI 146c2c66affSColin Finck GDIOBJ_LockObject( 147c2c66affSColin Finck HGDIOBJ hobj, 148c2c66affSColin Finck UCHAR objt); 149c2c66affSColin Finck 150c2c66affSColin Finck PGDIOBJ 151c2c66affSColin Finck NTAPI 152c2c66affSColin Finck GDIOBJ_TryLockObject( 153c2c66affSColin Finck HGDIOBJ hobj, 154c2c66affSColin Finck UCHAR objt); 155c2c66affSColin Finck 156c2c66affSColin Finck VOID 157c2c66affSColin Finck NTAPI 158c2c66affSColin Finck GDIOBJ_vUnlockObject( 159c2c66affSColin Finck POBJ pobj); 160c2c66affSColin Finck 161c2c66affSColin Finck VOID 162c2c66affSColin Finck NTAPI 163c2c66affSColin Finck GDIOBJ_vSetObjectOwner( 164c2c66affSColin Finck POBJ pobj, 165c2c66affSColin Finck ULONG ulOwner); 166c2c66affSColin Finck 167c2c66affSColin Finck BOOL 168c2c66affSColin Finck NTAPI 169c2c66affSColin Finck GDIOBJ_bLockMultipleObjects( 170c2c66affSColin Finck ULONG ulCount, 171c2c66affSColin Finck HGDIOBJ* ahObj, 172c2c66affSColin Finck PGDIOBJ* apObj, 173c2c66affSColin Finck UCHAR objt); 174c2c66affSColin Finck 175c2c66affSColin Finck HGDIOBJ 176c2c66affSColin Finck NTAPI 177c2c66affSColin Finck GDIOBJ_hInsertObject( 178c2c66affSColin Finck POBJ pobj, 179c2c66affSColin Finck ULONG ulOwner); 180c2c66affSColin Finck 181c2c66affSColin Finck VOID 182c2c66affSColin Finck NTAPI 183c2c66affSColin Finck GDIOBJ_vFreeObject( 184c2c66affSColin Finck POBJ pobj); 185c2c66affSColin Finck 186c2c66affSColin Finck VOID 187c2c66affSColin Finck NTAPI 188c2c66affSColin Finck GDIOBJ_vSetObjectAttr( 189c2c66affSColin Finck POBJ pobj, 190c2c66affSColin Finck PVOID pvObjAttr); 191c2c66affSColin Finck 192c2c66affSColin Finck PVOID 193c2c66affSColin Finck NTAPI 194c2c66affSColin Finck GDIOBJ_pvGetObjectAttr( 195c2c66affSColin Finck POBJ pobj); 196c2c66affSColin Finck 197c2c66affSColin Finck BOOL NTAPI GDIOBJ_ConvertToStockObj(HGDIOBJ *hObj); 198*970344bdSJames Tabor BOOL NTAPI GDIOBJ_ConvertFromStockObj(HGDIOBJ *phObj); 199c2c66affSColin Finck POBJ NTAPI GDIOBJ_AllocObjWithHandle(ULONG ObjectType, ULONG cjSize); 200c2c66affSColin Finck PGDIOBJ NTAPI GDIOBJ_ShareLockObj(HGDIOBJ hObj, DWORD ObjectType); 201c2c66affSColin Finck PVOID NTAPI GDI_MapHandleTable(PEPROCESS Process); 202