[WIN32SS]
[reactos.git] / win32ss / gdi / eng / pdevobj.h
1 #ifndef __WIN32K_PDEVOBJ_H
2 #define __WIN32K_PDEVOBJ_H
3
4 /* PDEVOBJ flags */
5 enum _PDEVFLAGS
6 {
7 PDEV_DISPLAY = 0x00000001, /* Display device */
8 PDEV_HARDWARE_POINTER = 0x00000002, /* Supports hardware cursor */
9 PDEV_SOFTWARE_POINTER = 0x00000004,
10 PDEV_GOTFONTS = 0x00000040, /* Has font driver */
11 PDEV_PRINTER = 0x00000080,
12 PDEV_ALLOCATEDBRUSHES = 0x00000100,
13 PDEV_HTPAL_IS_DEVPAL = 0x00000200,
14 PDEV_DISABLED = 0x00000400,
15 PDEV_SYNCHRONIZE_ENABLED = 0x00000800,
16 PDEV_FONTDRIVER = 0x00002000, /* Font device */
17 PDEV_GAMMARAMP_TABLE = 0x00004000,
18 PDEV_UMPD = 0x00008000,
19 PDEV_SHARED_DEVLOCK = 0x00010000,
20 PDEV_META_DEVICE = 0x00020000,
21 PDEV_DRIVER_PUNTED_CALL = 0x00040000, /* Driver calls back to GDI engine */
22 PDEV_CLONE_DEVICE = 0x00080000
23 };
24
25 /* Type definitions ***********************************************************/
26
27 typedef struct _GDIPOINTER /* should stay private to ENG? No, part of PDEVOBJ aka HDEV aka PDEV. */
28 {
29 /* Private GDI pointer handling information, required for software emulation */
30 BOOL Enabled;
31 SIZEL Size;
32 POINTL HotSpot;
33 SURFACE *psurfColor;
34 SURFACE *psurfMask;
35 SURFACE *psurfSave;
36 FLONG flags;
37
38 /* Public pointer information */
39 RECTL Exclude; /* Required publicly for SPS_ACCEPT_EXCLUDE */
40 } GDIPOINTER, *PGDIPOINTER;
41
42 typedef struct _DEVMODEINFO
43 {
44 struct _DEVMODEINFO *pdmiNext;
45 struct _LDEVOBJ *pldev;
46 ULONG cbdevmode;
47 DEVMODEW adevmode[1];
48 } DEVMODEINFO, *PDEVMODEINFO;
49
50 typedef struct _DEVMODEENTRY
51 {
52 DWORD dwFlags;
53 PDEVMODEW pdm;
54
55 } DEVMODEENTRY, *PDEVMODEENTRY;
56
57 typedef struct _GRAPHICS_DEVICE
58 {
59 WCHAR szNtDeviceName[CCHDEVICENAME/2];
60 WCHAR szWinDeviceName[CCHDEVICENAME/2];
61 struct _GRAPHICS_DEVICE * pNextGraphicsDevice;
62 struct _GRAPHICS_DEVICE * pVgaDevice;
63 PDEVICE_OBJECT DeviceObject;
64 PVOID pDeviceHandle;
65 DWORD hkClassDriverConfig;
66 DWORD StateFlags; /* See DISPLAY_DEVICE_* */
67 ULONG cbdevmodeInfo;
68 PDEVMODEINFO pdevmodeInfo;
69 ULONG cDevModes;
70 PDEVMODEENTRY pDevModeList;
71 LPWSTR pDiplayDrivers;
72 LPWSTR pwszDescription;
73 DWORD dwUnknown;
74 PVOID pUnknown;
75 PFILE_OBJECT FileObject;
76 DWORD ProtocolType;
77 ULONG iDefaultMode;
78 ULONG iCurrentMode;
79 } GRAPHICS_DEVICE, *PGRAPHICS_DEVICE;
80
81 typedef struct _PDEVOBJ
82 {
83 BASEOBJECT BaseObject;
84
85 struct _PDEVOBJ * ppdevNext;
86 LONG cPdevRefs;
87 LONG cPdevOpenRefs;
88 struct _PDEVOBJ * ppdevParent;
89 FLONG flFlags; // flags
90 // FLONG flAccelerated;
91 HSEMAPHORE hsemDevLock; /* Device lock. */
92 // HSEMAPHORE hsemPointer;
93 POINTL ptlPointer;
94 // SIZEL szlPointer;
95 // SPRITESTATE SpriteState;
96 // HFONT hlfntDefault;
97 // HFONT hlfntAnsiVariable;
98 // HFONT hlfntAnsiFixed;
99 HSURF ahsurf[HS_DDI_MAX];
100 // PUNICODE_STRING pusPrtDataFileName;
101 // PVOID pDevHTInfo;
102 // RFONT * prfntActive;
103 // RFONT * prfntInactive;
104 // ULONG cInactive;
105 // BYTE ajbo[0x5C];
106 // ULONG cDirectDrawDisableLocks;
107 // PVOID TypeOneInfo;
108 PVOID pvGammaRamp; /* Gamma ramp pointer. */
109 // PVOID RemoteTypeOne;
110 ULONG ulHorzRes;
111 ULONG ulVertRes;
112 // PFN_DrvSetPointerShape pfnDrvSetPointerShape;
113 // PFN_DrvMovePointer pfnDrvMovePointer;
114 PFN_DrvMovePointer pfnMovePointer;
115 // PFN_DrvSynchronize pfnDrvSynchronize;
116 // PFN_DrvSynchronizeSurface pfnDrvSynchronizeSurface;
117 // PFN_DrvSetPalette pfnDrvSetPalette;
118 // PFN_DrvNotify pfnDrvNotify;
119 // ULONG TagSig;
120 struct _LDEVOBJ * pldev;
121 DHPDEV dhpdev; /* DHPDEV for device. */
122 struct _PALETTE* ppalSurf; /* PEPALOBJ/PPALETTE for this device. */
123 DEVINFO devinfo;
124 GDIINFO gdiinfo;
125 PSURFACE pSurface; /* SURFACE for this device. */
126 HANDLE hSpooler; /* Handle to spooler, if spooler dev driver, DeviceObject if graphics device */
127 // PVOID pDesktopId;
128 PGRAPHICS_DEVICE pGraphicsDevice;
129 POINTL ptlOrigion;
130 PDEVMODEW pdmwDev; /* Ptr->DEVMODEW.dmSize + dmDriverExtra == alloc size. */
131 // DWORD Unknown3;
132 FLONG DxDd_Flags; /* DxDD active status flags. */
133 // LONG devAttr;
134 // PVOID WatchDogContext;
135 // ULONG WatchDogs;
136 union
137 {
138 DRIVER_FUNCTIONS DriverFunctions;
139 DRIVER_FUNCTIONS pfn;
140 PVOID apfn[INDEX_LAST]; // B8C 0x0598
141 };
142
143 /* ros specific */
144 ULONG DxDd_nCount;
145 GDIPOINTER Pointer;
146 /* Stuff to keep track of software cursors; win32k gdi part */
147 UINT SafetyRemoveLevel; /* at what level was the cursor removed?
148 0 for not removed */
149 UINT SafetyRemoveCount;
150 struct _EDD_DIRECTDRAW_GLOBAL * pEDDgpl;
151 } PDEVOBJ, *PPDEVOBJ;
152
153 /* Globals ********************************************************************/
154
155 extern PPDEVOBJ gppdevPrimary;
156
157
158 /* Function prototypes ********************************************************/
159
160 PPDEVOBJ
161 NTAPI
162 EngpGetPDEV(
163 _In_opt_ PUNICODE_STRING pustrDevice);
164
165 VOID
166 NTAPI
167 PDEVOBJ_vRelease(
168 _Inout_ PPDEVOBJ ppdev);
169
170 PSURFACE
171 NTAPI
172 PDEVOBJ_pSurface(
173 _In_ PPDEVOBJ ppdev);
174
175 VOID
176 NTAPI
177 PDEVOBJ_vGetDeviceCaps(
178 _In_ PPDEVOBJ ppdev,
179 _Out_ PDEVCAPS pDevCaps);
180
181 INIT_FUNCTION
182 NTSTATUS
183 NTAPI
184 InitPDEVImpl(VOID);
185
186 PSIZEL
187 FASTCALL
188 PDEVOBJ_sizl(
189 _In_ PPDEVOBJ ppdev,
190 _Out_ PSIZEL psizl);
191
192 BOOL
193 NTAPI
194 PDEVOBJ_bSwitchMode(
195 PPDEVOBJ ppdev,
196 PDEVMODEW pdm);
197
198 PDEVMODEW
199 NTAPI
200 PDEVOBJ_pdmMatchDevMode(
201 PPDEVOBJ ppdev,
202 PDEVMODEW pdm);
203
204 FORCEINLINE
205 VOID
206 PDEVOBJ_vReference(PPDEVOBJ ppdev)
207 {
208 InterlockedIncrement(&ppdev->cPdevRefs);
209 }
210
211 #endif /* !__WIN32K_PDEVOBJ_H */