89475a253add75df6069ddf03b88b42f449a0ac5
[reactos.git] / reactos / include / win32k / gdiobj.h
1 /*
2 * GDI object common header definition
3 *
4 * (RJJ) taken from WINE
5 */
6
7 #ifndef __WIN32K_GDIOBJ_H
8 #define __WIN32K_GDIOBJ_H
9
10 #include <ddk/ntddk.h>
11
12 /*! \defgroup GDI Magic
13 *
14 * GDI object magic numbers
15 *
16 */
17 //@{
18 #define GO_PEN_MAGIC 0x4f47
19 #define GO_BRUSH_MAGIC 0x4f48
20 #define GO_FONT_MAGIC 0x4f49
21 #define GO_PALETTE_MAGIC 0x4f4a
22 #define GO_BITMAP_MAGIC 0x4f4b
23 #define GO_REGION_MAGIC 0x4f4c
24 #define GO_DC_MAGIC 0x4f4d
25 #define GO_DISABLED_DC_MAGIC 0x4f4e
26 #define GO_META_DC_MAGIC 0x4f4f
27 #define GO_METAFILE_MAGIC 0x4f50
28 #define GO_METAFILE_DC_MAGIC 0x4f51
29 #define GO_ENHMETAFILE_MAGIC 0x4f52
30 #define GO_ENHMETAFILE_DC_MAGIC 0x4f53
31 #define GO_DCE_MAGIC 0x4f54
32 #define GO_MAGIC_DONTCARE 0xffff
33 //@}
34 /* (RJJ) swiped stock handles from wine */
35 /* First handle possible for stock objects (must be >= GDI_HEAP_SIZE) */
36 #define FIRST_STOCK_HANDLE 0xffffff00
37
38 /*! Stock object handles */
39 //@{
40 #define NB_STOCK_OBJECTS (DEFAULT_GUI_FONT + 1)
41 #define STOCK_WHITE_BRUSH ((HBRUSH)(FIRST_STOCK_HANDLE+WHITE_BRUSH))
42 #define STOCK_LTGRAY_BRUSH ((HBRUSH)(FIRST_STOCK_HANDLE+LTGRAY_BRUSH))
43 #define STOCK_GRAY_BRUSH ((HBRUSH)(FIRST_STOCK_HANDLE+GRAY_BRUSH))
44 #define STOCK_DKGRAY_BRUSH ((HBRUSH)(FIRST_STOCK_HANDLE+DKGRAY_BRUSH))
45 #define STOCK_BLACK_BRUSH ((HBRUSH)(FIRST_STOCK_HANDLE+BLACK_BRUSH))
46 #define STOCK_NULL_BRUSH ((HBRUSH)(FIRST_STOCK_HANDLE+NULL_BRUSH))
47 #define STOCK_HOLLOW_BRUSH ((HBRUSH)(FIRST_STOCK_HANDLE+HOLLOW_BRUSH))
48 #define STOCK_WHITE_PEN ((HPEN)(FIRST_STOCK_HANDLE+WHITE_PEN))
49 #define STOCK_BLACK_PEN ((HPEN)(FIRST_STOCK_HANDLE+BLACK_PEN))
50 #define STOCK_NULL_PEN ((HPEN)(FIRST_STOCK_HANDLE+NULL_PEN))
51 #define STOCK_OEM_FIXED_FONT ((HFONT)(FIRST_STOCK_HANDLE+OEM_FIXED_FONT))
52 #define STOCK_ANSI_FIXED_FONT ((HFONT)(FIRST_STOCK_HANDLE+ANSI_FIXED_FONT))
53 #define STOCK_ANSI_VAR_FONT ((HFONT)(FIRST_STOCK_HANDLE+ANSI_VAR_FONT))
54 #define STOCK_SYSTEM_FONT ((HFONT)(FIRST_STOCK_HANDLE+SYSTEM_FONT))
55 #define STOCK_DEVICE_DEFAULT_FONT ((HFONT)(FIRST_STOCK_HANDLE+DEVICE_DEFAULT_FONT))
56 #define STOCK_DEFAULT_PALETTE ((HPALETTE)(FIRST_STOCK_HANDLE+DEFAULT_PALETTE))
57 #define STOCK_SYSTEM_FIXED_FONT ((HFONT)(FIRST_STOCK_HANDLE+SYSTEM_FIXED_FONT))
58 #define STOCK_DEFAULT_GUI_FONT ((HFONT)(FIRST_STOCK_HANDLE+DEFAULT_GUI_FONT))
59 #define FIRST_STOCK_FONT STOCK_OEM_FIXED_FONT
60 #define LAST_STOCK_FONT STOCK_DEFAULT_GUI_FONT
61 #define LAST_STOCK_HANDLE ((DWORD)STOCK_DEFAULT_GUI_FONT)
62 //@}
63
64 /*!
65 * GDI object header. This is a part of any GDI object
66 */
67 typedef struct _GDIOBJHDR
68 {
69 WORD wTableIndex;
70 DWORD dwCount; /// reference count for the object
71 } GDIOBJHDR, *PGDIOBJHDR;
72
73 typedef PVOID PGDIOBJ;
74
75 typedef struct _GDI_HANDLE_ENTRY
76 {
77 WORD wMagic;
78 HANDLE hProcessId;
79 PGDIOBJ pObject;
80 } GDI_HANDLE_ENTRY, *PGDI_HANDLE_ENTRY;
81
82 typedef struct _GDI_HANDLE_TABLE
83 {
84 WORD wTableSize;
85 GDI_HANDLE_ENTRY Handles [1];
86 } GDI_HANDLE_TABLE, *PGDI_HANDLE_TABLE;
87
88 typedef struct _GDIMULTILOCK
89 {
90 HGDIOBJ hObj;
91 PGDIOBJ pObj;
92 WORD Magic;
93 } GDIMULTILOCK, *PGDIMULTILOCK;
94
95 HGDIOBJ GDIOBJ_AllocObj(WORD Size, WORD Magic);
96 BOOL GDIOBJ_FreeObj (HGDIOBJ Obj, WORD Magic, DWORD Flag);
97 PGDIOBJ GDIOBJ_LockObj (HGDIOBJ Obj, WORD Magic);
98 BOOL GDIOBJ_LockMultipleObj( PGDIMULTILOCK pList, INT nObj );
99 BOOL GDIOBJ_UnlockObj (HGDIOBJ Obj, WORD Magic);
100 BOOL GDIOBJ_UnlockMultipleObj( PGDIMULTILOCK pList, INT nObj );
101 WORD GDIOBJ_GetHandleMagic (HGDIOBJ ObjectHandle);
102 VOID STDCALL W32kDumpGdiObjects( INT Process );
103 BOOL STDCALL W32kCleanupForProcess( INT Process );
104
105 #define GDIOBJFLAG_DEFAULT (0x0)
106 #define GDIOBJFLAG_IGNOREPID (0x1)
107 #define GDIOBJFLAG_IGNORELOCK (0x2)
108
109 #endif
110