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