xref: /reactos/win32ss/gdi/eng/pdevobj.h (revision 682f85ad)
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 FORCEINLINE
166 VOID
167 PDEVOBJ_vReference(
168     _In_ PPDEVOBJ ppdev)
169 {
170     ASSERT(ppdev);
171 
172     /* Fail if the PDEV is being destroyed */
173     if (ppdev->cPdevRefs == 0)
174     {
175         ASSERT(FALSE);
176         return;
177     }
178     ASSERT(ppdev->cPdevRefs > 0);
179 
180     InterlockedIncrement(&ppdev->cPdevRefs);
181 }
182 
183 VOID
184 NTAPI
185 PDEVOBJ_vRelease(
186     _Inout_ PPDEVOBJ ppdev);
187 
188 PSURFACE
189 NTAPI
190 PDEVOBJ_pSurface(
191     _In_ PPDEVOBJ ppdev);
192 
193 VOID
194 NTAPI
195 PDEVOBJ_vGetDeviceCaps(
196     _In_ PPDEVOBJ ppdev,
197     _Out_ PDEVCAPS pDevCaps);
198 
199 NTSTATUS
200 NTAPI
201 InitPDEVImpl(VOID);
202 
203 PSIZEL
204 FASTCALL
205 PDEVOBJ_sizl(
206     _In_ PPDEVOBJ ppdev,
207     _Out_ PSIZEL psizl);
208 
209 BOOL
210 NTAPI
211 PDEVOBJ_bSwitchMode(
212     PPDEVOBJ ppdev,
213     PDEVMODEW pdm);
214 
215 PDEVMODEW
216 NTAPI
217 PDEVOBJ_pdmMatchDevMode(
218     PPDEVOBJ ppdev,
219     PDEVMODEW pdm);
220 
221 #endif /* !__WIN32K_PDEVOBJ_H */
222