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 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 ULONG DxDd_nCount; 144 GDIPOINTER Pointer; 145 /* Stuff to keep track of software cursors; win32k gdi part */ 146 UINT SafetyRemoveLevel; /* at what level was the cursor removed? 147 0 for not removed */ 148 UINT SafetyRemoveCount; 149 struct _EDD_DIRECTDRAW_GLOBAL * pEDDgpl; 150 } PDEVOBJ, *PPDEVOBJ; 151 152 /* Function prototypes ********************************************************/ 153 154 PPDEVOBJ 155 NTAPI 156 EngpGetPDEV( 157 _In_opt_ PUNICODE_STRING pustrDevice); 158 159 FORCEINLINE 160 VOID 161 PDEVOBJ_vReference( 162 _In_ PPDEVOBJ ppdev) 163 { 164 ASSERT(ppdev); 165 166 /* Fail if the PDEV is being destroyed */ 167 if (ppdev->cPdevRefs == 0) 168 { 169 ASSERT(FALSE); 170 return; 171 } 172 ASSERT(ppdev->cPdevRefs > 0); 173 174 InterlockedIncrement(&ppdev->cPdevRefs); 175 } 176 177 VOID 178 NTAPI 179 PDEVOBJ_vRelease( 180 _Inout_ PPDEVOBJ ppdev); 181 182 PSURFACE 183 NTAPI 184 PDEVOBJ_pSurface( 185 _In_ PPDEVOBJ ppdev); 186 187 VOID 188 NTAPI 189 PDEVOBJ_vGetDeviceCaps( 190 _In_ PPDEVOBJ ppdev, 191 _Out_ PDEVCAPS pDevCaps); 192 193 CODE_SEG("INIT") 194 NTSTATUS 195 NTAPI 196 InitPDEVImpl(VOID); 197 198 PSIZEL 199 FASTCALL 200 PDEVOBJ_sizl( 201 _In_ PPDEVOBJ ppdev, 202 _Out_ PSIZEL psizl); 203 204 BOOL 205 NTAPI 206 PDEVOBJ_bSwitchMode( 207 PPDEVOBJ ppdev, 208 PDEVMODEW pdm); 209 210 BOOL 211 NTAPI 212 PDEVOBJ_bDynamicModeChange( 213 _Inout_ PPDEVOBJ ppdev, 214 _Inout_ PPDEVOBJ ppdev2); 215 216 VOID 217 PDEVOBJ_vEnableDisplay( 218 _Inout_ PPDEVOBJ ppdev); 219 220 BOOL 221 PDEVOBJ_bDisableDisplay( 222 _Inout_ PPDEVOBJ ppdev); 223 224 PPDEVOBJ 225 PDEVOBJ_Create( 226 _In_opt_ PGRAPHICS_DEVICE pGraphicsDevice, 227 _In_opt_ PDEVMODEW pdm, 228 _In_ ULONG dwAccelerationLevel, 229 _In_ ULONG ldevtype); 230 231 /* Change display settings: 232 * - pustrDeviceName: name of the device to change settings. Can be NULL to specify whole display surface 233 * - RequestedMode: new parameters for device. Ignored if pstrDeviceName is NULL 234 * - pmdevOld: old MDEVOBJ. Can be NULL if we are creating the first one 235 * - ppdevNew: MDEVOBJ created by this function, with the new settings 236 * - bSearchClosestMode: do we need to search exact requested mode, or a mostly similar one 237 * Return value: a DISP_CHANGE_* value 238 */ 239 LONG 240 PDEVOBJ_lChangeDisplaySettings( 241 _In_opt_ PUNICODE_STRING pustrDeviceName, 242 _In_opt_ PDEVMODEW RequestedMode, 243 _In_opt_ PMDEVOBJ pmdevOld, 244 _Out_ PMDEVOBJ *ppmdevNew, 245 _In_ BOOL bSearchClosestMode); 246 247 #endif /* !__WIN32K_PDEVOBJ_H */ 248