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 PDEVICE_OBJECT PhysDeviceHandle;
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 dwMonCnt;
74 PVIDEO_MONITOR_DEVICE pvMonDev;
75 PFILE_OBJECT FileObject;
76 DWORD ProtocolType;
77 } GRAPHICS_DEVICE, *PGRAPHICS_DEVICE;
78
79 typedef struct _PDEVOBJ
80 {
81 BASEOBJECT BaseObject;
82
83 struct _PDEVOBJ * ppdevNext;
84 LONG cPdevRefs;
85 LONG cPdevOpenRefs;
86 struct _PDEVOBJ * ppdevParent;
87 FLONG flFlags; // flags
88 // FLONG flAccelerated;
89 HSEMAPHORE hsemDevLock; /* Device lock. */
90 // HSEMAPHORE hsemPointer;
91 POINTL ptlPointer;
92 // SIZEL szlPointer;
93 // SPRITESTATE SpriteState;
94 // HFONT hlfntDefault;
95 // HFONT hlfntAnsiVariable;
96 // HFONT hlfntAnsiFixed;
97 HSURF ahsurf[HS_DDI_MAX];
98 PWSTR pusPrtDataFileName; // DRIVER_INFO_2->pDataFile
99 // PVOID pDevHTInfo;
100 // RFONT * prfntActive;
101 // RFONT * prfntInactive;
102 // ULONG cInactive;
103 // BYTE ajbo[0x5C];
104 ULONG cDirectDrawDisableLocks;
105 // PVOID TypeOneInfo;
106 PVOID pvGammaRamp; /* Gamma ramp pointer. */
107 PVOID RemoteTypeOne;
108 SIZEL szlMetaRes; /* if PDEV_META_DEVICE */
109 // ULONG ulHorzRes;
110 // ULONG ulVertRes;
111 // PFN_DrvSetPointerShape pfnDrvSetPointerShape;
112 // PFN_DrvMovePointer pfnDrvMovePointer;
113 PFN_DrvMovePointer pfnMovePointer;
114 // PFN_DrvSynchronize pfnDrvSynchronize;
115 // PFN_DrvSynchronizeSurface pfnDrvSynchronizeSurface;
116 // PFN_DrvSetPalette pfnDrvSetPalette;
117 // PFN_DrvNotify pfnDrvNotify;
118 // ULONG TagSig;
119 struct _LDEVOBJ * pldev;
120 DHPDEV dhpdev; /* DHPDEV for device. */
121 struct _PALETTE* ppalSurf; /* PEPALOBJ/PPALETTE for this device. */
122 DEVINFO devinfo;
123 GDIINFO gdiinfo;
124 PSURFACE pSurface; /* SURFACE for this device. */
125 HANDLE hSpooler; /* Handle to spooler, if spooler dev driver, DeviceObject if graphics device */
126 // PVOID pDesktopId;
127 PGRAPHICS_DEVICE pGraphicsDevice;
128 POINTL ptlOrigion;
129 PDEVMODEW pdmwDev; /* Ptr->DEVMODEW.dmSize + dmDriverExtra == alloc size. */
130 // DWORD Unknown3;
131 FLONG DxDd_Flags; /* DxDD active status flags set by CapabilityOverride Registry Key while Create Info DC type */
132 DWORD dwAccelerationLevel; /* Set by Accelerations.Level (0 - 5) Registry Key while Create Info DC type */
133 // PVOID WatchDogContext;
134 // ULONG WatchDogs;
135 union
136 {
137 DRIVER_FUNCTIONS DriverFunctions;
138 DRIVER_FUNCTIONS pfn;
139 PVOID apfn[INDEX_LAST]; // B8C 0x0598
140 };
141
142 /* ros specific */
143 GDIPOINTER Pointer;
144 /* Stuff to keep track of software cursors; win32k gdi part */
145 UINT SafetyRemoveLevel; /* at what level was the cursor removed?
146 0 for not removed */
147 UINT SafetyRemoveCount;
148 struct _EDD_DIRECTDRAW_GLOBAL * pEDDgpl;
149 } PDEVOBJ, *PPDEVOBJ;
150
151 /* Function prototypes ********************************************************/
152
153 PPDEVOBJ
154 NTAPI
155 EngpGetPDEV(
156 _In_opt_ PUNICODE_STRING pustrDevice);
157
158 FORCEINLINE
159 VOID
PDEVOBJ_vReference(_In_ PPDEVOBJ ppdev)160 PDEVOBJ_vReference(
161 _In_ PPDEVOBJ ppdev)
162 {
163 ASSERT(ppdev);
164
165 /* Fail if the PDEV is being destroyed */
166 if (ppdev->cPdevRefs == 0)
167 {
168 ASSERT(FALSE);
169 return;
170 }
171 ASSERT(ppdev->cPdevRefs > 0);
172
173 InterlockedIncrement(&ppdev->cPdevRefs);
174 }
175
176 VOID
177 NTAPI
178 PDEVOBJ_vRelease(
179 _Inout_ PPDEVOBJ ppdev);
180
181 PSURFACE
182 NTAPI
183 PDEVOBJ_pSurface(
184 _In_ PPDEVOBJ ppdev);
185
186 VOID
187 NTAPI
188 PDEVOBJ_vGetDeviceCaps(
189 _In_ PPDEVOBJ ppdev,
190 _Out_ PDEVCAPS pDevCaps);
191
192 CODE_SEG("INIT")
193 NTSTATUS
194 NTAPI
195 InitPDEVImpl(VOID);
196
197 PSIZEL
198 FASTCALL
199 PDEVOBJ_sizl(
200 _In_ PPDEVOBJ ppdev,
201 _Out_ PSIZEL psizl);
202
203 BOOL
204 NTAPI
205 PDEVOBJ_bSwitchMode(
206 PPDEVOBJ ppdev,
207 PDEVMODEW pdm);
208
209 BOOL
210 NTAPI
211 PDEVOBJ_bDynamicModeChange(
212 _Inout_ PPDEVOBJ ppdev,
213 _Inout_ PPDEVOBJ ppdev2);
214
215 VOID
216 PDEVOBJ_vEnableDisplay(
217 _Inout_ PPDEVOBJ ppdev);
218
219 BOOL
220 PDEVOBJ_bDisableDisplay(
221 _Inout_ PPDEVOBJ ppdev);
222
223 PPDEVOBJ
224 PDEVOBJ_Create(
225 _In_opt_ PGRAPHICS_DEVICE pGraphicsDevice,
226 _In_opt_ PDEVMODEW pdm,
227 _In_ ULONG dwAccelerationLevel,
228 _In_ ULONG ldevtype);
229
230 /* Change display settings:
231 * - pustrDeviceName: name of the device to change settings. Can be NULL to specify whole display surface
232 * - RequestedMode: new parameters for device. Ignored if pstrDeviceName is NULL
233 * - pmdevOld: old MDEVOBJ. Can be NULL if we are creating the first one
234 * - ppdevNew: MDEVOBJ created by this function, with the new settings
235 * - bSearchClosestMode: do we need to search exact requested mode, or a mostly similar one
236 * Return value: a DISP_CHANGE_* value
237 */
238 LONG
239 PDEVOBJ_lChangeDisplaySettings(
240 _In_opt_ PUNICODE_STRING pustrDeviceName,
241 _In_opt_ PDEVMODEW RequestedMode,
242 _In_opt_ PMDEVOBJ pmdevOld,
243 _Out_ PMDEVOBJ *ppmdevNew,
244 _In_ BOOL bSearchClosestMode);
245
246 #endif /* !__WIN32K_PDEVOBJ_H */
247