1 typedef struct _GDI_TABLE_ENTRY
2 {
3 	PVOID KernelData; /* Points to the kernel mode structure */
4 	HANDLE ProcessId; /* process id that created the object, 0 for stock objects */
5 	LONG Type;        /* the first 16 bit is the object type including the stock obj flag, the last 16 bits is just the object type */
6 	PVOID UserData;   /* Points to the user mode structure, usually NULL though */
7 } GDI_TABLE_ENTRY, *PGDI_TABLE_ENTRY;
8 
9 typedef PGDI_TABLE_ENTRY (CALLBACK * GDIQUERYPROC) (void);
10 
11 /* GDI handle table can hold 0x4000 handles */
12 #define GDI_HANDLE_COUNT 0x10000
13 #define GDI_GLOBAL_PROCESS (0x0)
14 
15 /* Handle Masks and shifts */
16 #define GDI_HANDLE_INDEX_MASK (GDI_HANDLE_COUNT - 1)
17 #define GDI_HANDLE_TYPE_MASK  0x007f0000
18 #define GDI_HANDLE_BASETYPE_MASK 0x001f0000
19 #define GDI_HANDLE_STOCK_MASK 0x00800000
20 #define GDI_HANDLE_REUSE_MASK 0xff000000
21 #define GDI_HANDLE_REUSECNT_SHIFT 24
22 #define GDI_HANDLE_UPPER_MASK 0x0000ffff
23 
24 /* Handle macros */
25 #define GDI_HANDLE_CREATE(i, t)    \
26     ((HANDLE)(((i) & GDI_HANDLE_INDEX_MASK) | ((t) << 16)))
27 
28 #define GDI_HANDLE_GET_INDEX(h)    \
29     (((ULONG_PTR)(h)) & GDI_HANDLE_INDEX_MASK)
30 
31 #define GDI_HANDLE_GET_TYPE(h)     \
32     (((ULONG_PTR)(h)) & GDI_HANDLE_TYPE_MASK)
33 
34 #define GDI_HANDLE_IS_TYPE(h, t)   \
35     ((t) == (((ULONG_PTR)(h)) & GDI_HANDLE_TYPE_MASK))
36 
37 #define GDI_HANDLE_IS_STOCKOBJ(h)  \
38     (0 != (((ULONG_PTR)(h)) & GDI_HANDLE_STOCK_MASK))
39 
40 #define GDI_HANDLE_SET_STOCKOBJ(h) \
41     ((h) = (HANDLE)(((ULONG_PTR)(h)) | GDI_HANDLE_STOCK_MASK))
42 
43 #define GDI_HANDLE_GET_UPPER(h)     \
44     (((ULONG_PTR)(h)) & GDI_HANDLE_UPPER_MASK)
45 
46 #define GDI_OBJECT_TYPE_DC          0x00010000
47 #define GDI_OBJECT_TYPE_REGION      0x00040000
48 #define GDI_OBJECT_TYPE_BITMAP      0x00050000
49 #define GDI_OBJECT_TYPE_PALETTE     0x00080000
50 #define GDI_OBJECT_TYPE_FONT        0x000a0000
51 #define GDI_OBJECT_TYPE_PFE         0x000c0000
52 #define GDI_OBJECT_TYPE_BRUSH       0x00100000
53 #define GDI_OBJECT_TYPE_EMF         0x00210000
54 #define GDI_OBJECT_TYPE_PEN         0x00300000
55 #define GDI_OBJECT_TYPE_EXTPEN      0x00500000
56 #define GDI_OBJECT_TYPE_COLORSPACE  0x00090000
57 #define GDI_OBJECT_TYPE_METADC      0x00660000
58 #define GDI_OBJECT_TYPE_METAFILE    0x00260000
59 #define GDI_OBJECT_TYPE_ENHMETAFILE 0x00460000
60 /* Following object types made up for ROS */
61 #define GDI_OBJECT_TYPE_ENHMETADC   0x00740000
62 #define GDI_OBJECT_TYPE_MEMDC       0x00750000
63 #define GDI_OBJECT_TYPE_DCE         0x00770000
64 #define GDI_OBJECT_TYPE_DONTCARE    0x007f0000
65 /** Not really an object type. Forces GDI_FreeObj to be silent. */
66 #define GDI_OBJECT_TYPE_SILENT      0x80000000
67