Commit r20366:20368 again.
[reactos.git] / reactos / include / win32k / ntgdihdl.h
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Win32 Graphical Subsystem (WIN32K)
4 * FILE: include/win32k/ntgdihal.h
5 * PURPOSE: Win32 Shared GDI Handle/Object Types
6 * PROGRAMMER: Alex Ionescu (alex@relsoft.net)
7 */
8
9 /* INCLUDES ******************************************************************/
10
11 #ifndef _NTGDIHDL_
12 #define _NTGDIHDL_
13
14 /* DEFINES *******************************************************************/
15
16 /* Base address where the handle table is mapped to */
17 #define GDI_HANDLE_TABLE_BASE_ADDRESS (0x400000)
18
19 /* GDI handle table can hold 0x4000 handles */
20 #define GDI_HANDLE_COUNT 0x4000
21 #define GDI_GLOBAL_PROCESS (0x0)
22
23 /* Handle Masks and shifts */
24 #define GDI_HANDLE_INDEX_MASK (GDI_HANDLE_COUNT - 1)
25 #define GDI_HANDLE_TYPE_MASK 0x007f0000
26 #define GDI_HANDLE_STOCK_MASK 0x00800000
27 #define GDI_HANDLE_REUSE_MASK 0xff000000
28 #define GDI_HANDLE_REUSECNT_SHIFT 24
29
30 /*! \defgroup GDI object types
31 *
32 * GDI object types
33 *
34 */
35 /*@{*/
36 #define GDI_OBJECT_TYPE_DC 0x00010000
37 #define GDI_OBJECT_TYPE_REGION 0x00040000
38 #define GDI_OBJECT_TYPE_BITMAP 0x00050000
39 #define GDI_OBJECT_TYPE_PALETTE 0x00080000
40 #define GDI_OBJECT_TYPE_FONT 0x000a0000
41 #define GDI_OBJECT_TYPE_BRUSH 0x00100000
42 #define GDI_OBJECT_TYPE_EMF 0x00210000
43 #define GDI_OBJECT_TYPE_PEN 0x00300000
44 #define GDI_OBJECT_TYPE_EXTPEN 0x00500000
45 /* Following object types made up for ROS */
46 #define GDI_OBJECT_TYPE_METADC 0x00710000
47 #define GDI_OBJECT_TYPE_METAFILE 0x00720000
48 #define GDI_OBJECT_TYPE_ENHMETAFILE 0x00730000
49 #define GDI_OBJECT_TYPE_ENHMETADC 0x00740000
50 #define GDI_OBJECT_TYPE_MEMDC 0x00750000
51 #define GDI_OBJECT_TYPE_DCE 0x00770000
52 #define GDI_OBJECT_TYPE_DONTCARE 0x007f0000
53 /** Not really an object type. Forces GDI_FreeObj to be silent. */
54 #define GDI_OBJECT_TYPE_SILENT 0x80000000
55 /*@}*/
56
57 /* Handle macros */
58 #define GDI_HANDLE_CREATE(i, t) \
59 ((HANDLE)(((i) & GDI_HANDLE_INDEX_MASK) | ((t) & GDI_HANDLE_TYPE_MASK)))
60
61 #define GDI_HANDLE_GET_INDEX(h) \
62 (((ULONG_PTR)(h)) & GDI_HANDLE_INDEX_MASK)
63
64 #define GDI_HANDLE_GET_TYPE(h) \
65 (((ULONG_PTR)(h)) & GDI_HANDLE_TYPE_MASK)
66
67 #define GDI_HANDLE_IS_TYPE(h, t) \
68 ((t) == (((ULONG_PTR)(h)) & GDI_HANDLE_TYPE_MASK))
69
70 #define GDI_HANDLE_IS_STOCKOBJ(h) \
71 (0 != (((ULONG_PTR)(h)) & GDI_HANDLE_STOCK_MASK))
72
73 #define GDI_HANDLE_SET_STOCKOBJ(h) \
74 ((h) = (HANDLE)(((ULONG_PTR)(h)) | GDI_HANDLE_STOCK_MASK))
75
76 /* TYPES *********************************************************************/
77
78 typedef struct _GDI_TABLE_ENTRY
79 {
80 PVOID KernelData; /* Points to the kernel mode structure */
81 HANDLE ProcessId; /* process id that created the object, 0 for stock objects */
82 LONG Type; /* the first 16 bit is the object type including the stock obj flag, the last 16 bits is just the object type */
83 PVOID UserData; /* Points to the user mode structure, usually NULL though */
84 } GDI_TABLE_ENTRY, *PGDI_TABLE_ENTRY;
85
86 #endif