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