ReactOS  0.4.15-dev-4570-g4f8bbd1
device.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS kernel
4  * PURPOSE: GDI Driver Device Functions
5  * FILE: win32ss/gdi/eng/device.c
6  * PROGRAMER: Jason Filby
7  * Timo Kreuzer
8  */
9 
10 #include <win32k.h>
11 #include <ntddvdeo.h>
12 
13 DBG_DEFAULT_CHANNEL(EngDev);
14 
17 
21 static ULONG giDevNum = 1;
22 
23 CODE_SEG("INIT")
25 NTAPI
27 {
31 
32  return STATUS_SUCCESS;
33 }
34 
37 {
38  ULONG iDevNum, iVGACompatible = -1, ulMaxObjectNumber = 0;
39  WCHAR awcDeviceName[20], awcWinDeviceName[20];
40  UNICODE_STRING ustrDeviceName;
41  WCHAR awcBuffer[256];
43  PGRAPHICS_DEVICE pGraphicsDevice;
44  ULONG cbValue;
45  HKEY hkey;
46 
47  /* Open the key for the adapters */
48  Status = RegOpenKey(L"\\Registry\\Machine\\HARDWARE\\DEVICEMAP\\VIDEO", &hkey);
49  if (!NT_SUCCESS(Status))
50  {
51  ERR("Could not open HARDWARE\\DEVICEMAP\\VIDEO registry key:0x%lx\n", Status);
52  return Status;
53  }
54 
55  /* Read the name of the VGA adapter */
56  cbValue = sizeof(awcDeviceName);
57  Status = RegQueryValue(hkey, L"VgaCompatible", REG_SZ, awcDeviceName, &cbValue);
58  if (NT_SUCCESS(Status))
59  {
60  iVGACompatible = _wtoi(&awcDeviceName[sizeof("\\Device\\Video")-1]);
61  ERR("VGA adapter = %lu\n", iVGACompatible);
62  }
63 
64  /* Get the maximum mumber of adapters */
65  if (!RegReadDWORD(hkey, L"MaxObjectNumber", &ulMaxObjectNumber))
66  {
67  ERR("Could not read MaxObjectNumber, defaulting to 0.\n");
68  }
69 
70  TRACE("Found %lu devices\n", ulMaxObjectNumber + 1);
71 
72  /* Loop through all adapters */
73  for (iDevNum = 0; iDevNum <= ulMaxObjectNumber; iDevNum++)
74  {
75  /* Create the adapter's key name */
76  swprintf(awcDeviceName, L"\\Device\\Video%lu", iDevNum);
77 
78  /* Create the display device name */
79  swprintf(awcWinDeviceName, L"\\\\.\\DISPLAY%lu", iDevNum + 1);
80  RtlInitUnicodeString(&ustrDeviceName, awcWinDeviceName);
81 
82  /* Check if the device exists already */
83  pGraphicsDevice = EngpFindGraphicsDevice(&ustrDeviceName, iDevNum);
84  if (pGraphicsDevice != NULL)
85  {
86  continue;
87  }
88 
89  /* Read the reg key name */
90  cbValue = sizeof(awcBuffer);
91  Status = RegQueryValue(hkey, awcDeviceName, REG_SZ, awcBuffer, &cbValue);
92  if (!NT_SUCCESS(Status))
93  {
94  ERR("failed to query the registry path:0x%lx\n", Status);
95  continue;
96  }
97 
98  /* Initialize the driver for this device */
99  pGraphicsDevice = InitDisplayDriver(awcDeviceName, awcBuffer);
100  if (!pGraphicsDevice) continue;
101 
102  /* Check if this is a VGA compatible adapter */
103  if (pGraphicsDevice->StateFlags & DISPLAY_DEVICE_VGA_COMPATIBLE)
104  {
105  /* Save this as the VGA adapter */
106  if (!gpVgaGraphicsDevice)
107  {
108  gpVgaGraphicsDevice = pGraphicsDevice;
109  TRACE("gpVgaGraphicsDevice = %p\n", gpVgaGraphicsDevice);
110  }
111  }
112 
113  /* Set the first one as primary device */
115  {
116  gpPrimaryGraphicsDevice = pGraphicsDevice;
117  TRACE("gpPrimaryGraphicsDevice = %p\n", gpPrimaryGraphicsDevice);
118  }
119  }
120 
121  /* Close the device map registry key */
122  ZwClose(hkey);
123 
124  return STATUS_SUCCESS;
125 }
126 
127 extern VOID
129 
130 // PVIDEO_WIN32K_CALLOUT
131 VOID
132 NTAPI
134  _In_ PVOID Params)
135 {
136 /*
137  * IMPORTANT NOTICE!! On Windows XP/2003 this function triggers the creation of
138  * a specific VideoPortCalloutThread() system thread using the same mechanism
139  * as the RIT/desktop/Ghost system threads.
140  */
141 
143 
144  TRACE("VideoPortCallout(0x%p, 0x%x)\n",
145  CallbackParams, CallbackParams ? CallbackParams->CalloutType : -1);
146 
147  if (!CallbackParams)
148  return;
149 
150  switch (CallbackParams->CalloutType)
151  {
153  {
154  TRACE("VideoPortCallout: VideoFindAdapterCallout called - Param = %s\n",
155  CallbackParams->Param ? "TRUE" : "FALSE");
156  if (CallbackParams->Param == TRUE)
157  {
158  /* Re-enable the display */
160  }
161  else
162  {
163  /* Disable the display */
164  NOTHING; // Nothing to do for the moment...
165  }
166 
167  CallbackParams->Status = STATUS_SUCCESS;
168  break;
169  }
170 
174  case VideoWakeupCallout:
180  ERR("VideoPortCallout: CalloutType 0x%x is UNIMPLEMENTED!\n", CallbackParams->CalloutType);
181  CallbackParams->Status = STATUS_NOT_IMPLEMENTED;
182  break;
183 
184  default:
185  ERR("VideoPortCallout: Unknown CalloutType 0x%x\n", CallbackParams->CalloutType);
186  CallbackParams->Status = STATUS_UNSUCCESSFUL;
187  break;
188  }
189 }
190 
192 NTAPI
194  _In_ PUNICODE_STRING pustrDeviceName,
195  _In_ PUNICODE_STRING pustrDiplayDrivers,
196  _In_ PUNICODE_STRING pustrDescription)
197 {
198  PGRAPHICS_DEVICE pGraphicsDevice;
200  PFILE_OBJECT pFileObject;
202  VIDEO_WIN32K_CALLBACKS Win32kCallbacks;
203  ULONG ulReturn;
204  PWSTR pwsz;
205  ULONG cj;
206 
207  TRACE("EngpRegisterGraphicsDevice(%wZ)\n", pustrDeviceName);
208 
209  /* Allocate a GRAPHICS_DEVICE structure */
210  pGraphicsDevice = ExAllocatePoolWithTag(PagedPool,
211  sizeof(GRAPHICS_DEVICE),
213  if (!pGraphicsDevice)
214  {
215  ERR("ExAllocatePoolWithTag failed\n");
216  return NULL;
217  }
218 
219  /* Try to open and enable the device */
220  Status = IoGetDeviceObjectPointer(pustrDeviceName,
222  &pFileObject,
223  &pDeviceObject);
224  if (!NT_SUCCESS(Status))
225  {
226  ERR("Could not open device %wZ, 0x%lx\n", pustrDeviceName, Status);
227  ExFreePoolWithTag(pGraphicsDevice, GDITAG_GDEVICE);
228  return NULL;
229  }
230 
231  /* Copy the device and file object pointers */
232  pGraphicsDevice->DeviceObject = pDeviceObject;
233  pGraphicsDevice->FileObject = pFileObject;
234 
235  /* Initialize and register the device with videoprt for Win32k callbacks */
236  Win32kCallbacks.PhysDisp = pGraphicsDevice;
237  Win32kCallbacks.Callout = VideoPortCallout;
238  // Reset the data being returned prior to the call.
239  Win32kCallbacks.bACPI = FALSE;
240  Win32kCallbacks.pPhysDeviceObject = NULL;
241  Win32kCallbacks.DualviewFlags = 0;
242  Status = (NTSTATUS)EngDeviceIoControl((HANDLE)pDeviceObject,
244  &Win32kCallbacks,
245  sizeof(Win32kCallbacks),
246  &Win32kCallbacks,
247  sizeof(Win32kCallbacks),
248  &ulReturn);
249  if (Status != ERROR_SUCCESS)
250  {
251  ERR("EngDeviceIoControl(0x%p, IOCTL_VIDEO_INIT_WIN32K_CALLBACKS) failed, Status 0x%lx\n",
253  }
254  // TODO: Set flags according to the results.
255  // if (Win32kCallbacks.bACPI)
256  // if (Win32kCallbacks.DualviewFlags & ???)
257  // Win32kCallbacks.pPhysDeviceObject;
258 
259  /* Copy the device name */
260  RtlStringCbCopyNW(pGraphicsDevice->szNtDeviceName,
261  sizeof(pGraphicsDevice->szNtDeviceName),
262  pustrDeviceName->Buffer,
263  pustrDeviceName->Length);
264 
265  /* Create a Win32 device name (FIXME: virtual devices!) */
266  RtlStringCbPrintfW(pGraphicsDevice->szWinDeviceName,
267  sizeof(pGraphicsDevice->szWinDeviceName),
268  L"\\\\.\\DISPLAY%d",
269  (int)giDevNum);
270 
271  /* Allocate a buffer for the strings */
272  cj = pustrDiplayDrivers->Length + pustrDescription->Length + sizeof(WCHAR);
274  if (!pwsz)
275  {
276  ERR("Could not allocate string buffer\n");
277  ASSERT(FALSE); // FIXME
278  ExFreePoolWithTag(pGraphicsDevice, GDITAG_GDEVICE);
279  return NULL;
280  }
281 
282  /* Copy the display driver names */
283  pGraphicsDevice->pDiplayDrivers = pwsz;
284  RtlCopyMemory(pGraphicsDevice->pDiplayDrivers,
285  pustrDiplayDrivers->Buffer,
286  pustrDiplayDrivers->Length);
287 
288  /* Copy the description */
289  pGraphicsDevice->pwszDescription = pwsz + pustrDiplayDrivers->Length / sizeof(WCHAR);
290  RtlCopyMemory(pGraphicsDevice->pwszDescription,
291  pustrDescription->Buffer,
292  pustrDescription->Length);
293  pGraphicsDevice->pwszDescription[pustrDescription->Length/sizeof(WCHAR)] = 0;
294 
295  /* Initialize the pdevmodeInfo list */
296  pGraphicsDevice->pdevmodeInfo = NULL;
297 
298  // FIXME: initialize state flags
299  pGraphicsDevice->StateFlags = 0;
300 
301  /* Create the mode list */
302  pGraphicsDevice->pDevModeList = NULL;
303 
304  /* Lock loader */
306 
307  /* Insert the device into the global list */
308  pGraphicsDevice->pNextGraphicsDevice = NULL;
310  gpGraphicsDeviceLast->pNextGraphicsDevice = pGraphicsDevice;
311  gpGraphicsDeviceLast = pGraphicsDevice;
313  gpGraphicsDeviceFirst = pGraphicsDevice;
314 
315  /* Increment the device number */
316  giDevNum++;
317 
318  /* Unlock loader */
320  TRACE("Prepared %lu modes for %ls\n", pGraphicsDevice->cDevModes, pGraphicsDevice->pwszDescription);
321 
322  /* HACK: already in graphic mode; display wallpaper on this new display */
324  {
325  UNICODE_STRING DriverName = RTL_CONSTANT_STRING(L"DISPLAY");
326  UNICODE_STRING DisplayName;
327  HDC hdc;
328  RtlInitUnicodeString(&DisplayName, pGraphicsDevice->szWinDeviceName);
329  hdc = IntGdiCreateDC(&DriverName, &DisplayName, NULL, NULL, FALSE);
331  }
332 
333  return pGraphicsDevice;
334 }
335 
337 NTAPI
339  _In_opt_ PUNICODE_STRING pustrDevice,
340  _In_ ULONG iDevNum)
341 {
342  UNICODE_STRING ustrCurrent;
343  PGRAPHICS_DEVICE pGraphicsDevice;
344  ULONG i;
345  TRACE("EngpFindGraphicsDevice('%wZ', %lu)\n",
346  pustrDevice, iDevNum);
347 
348  /* Lock list */
350 
351  if (pustrDevice && pustrDevice->Buffer)
352  {
353  /* Loop through the list of devices */
354  for (pGraphicsDevice = gpGraphicsDeviceFirst;
355  pGraphicsDevice;
356  pGraphicsDevice = pGraphicsDevice->pNextGraphicsDevice)
357  {
358  /* Compare the device name */
359  RtlInitUnicodeString(&ustrCurrent, pGraphicsDevice->szWinDeviceName);
360  if (RtlEqualUnicodeString(&ustrCurrent, pustrDevice, FALSE))
361  {
362  break;
363  }
364  }
365  }
366  else
367  {
368  /* Loop through the list of devices */
369  for (pGraphicsDevice = gpGraphicsDeviceFirst, i = 0;
370  pGraphicsDevice && i < iDevNum;
371  pGraphicsDevice = pGraphicsDevice->pNextGraphicsDevice, i++);
372  }
373 
374  /* Unlock list */
376 
377  return pGraphicsDevice;
378 }
379 
380 static
381 NTSTATUS
383  _In_ PFILE_OBJECT pFileObject,
384  _In_ ULONG ulMajorFunction,
385  _In_reads_(nBufferSize) PVOID lpBuffer,
386  _In_ SIZE_T nBufferSize,
387  _In_ ULONGLONG ullStartOffset,
388  _Out_ PULONG_PTR lpInformation)
389 {
391  KEVENT Event;
392  PIRP pIrp;
395  LARGE_INTEGER liStartOffset;
396 
397  /* Get corresponding device object */
399  if (!pDeviceObject)
400  {
402  }
403 
404  /* Initialize an event */
406 
407  /* Build IRP */
408  liStartOffset.QuadPart = ullStartOffset;
409  pIrp = IoBuildSynchronousFsdRequest(ulMajorFunction,
411  lpBuffer,
412  (ULONG)nBufferSize,
413  &liStartOffset,
414  &Event,
415  &Iosb);
416  if (!pIrp)
417  {
419  }
420 
421  /* Call the driver */
423 
424  /* Wait if neccessary */
425  if (STATUS_PENDING == Status)
426  {
428  Status = Iosb.Status;
429  }
430 
431  /* Return information to the caller about the operation. */
432  *lpInformation = Iosb.Information;
433 
434  /* Return NTSTATUS */
435  return Status;
436 }
437 
438 VOID
439 APIENTRY
441  _In_ PFILE_OBJECT pFileObject,
444  _Out_ PSIZE_T lpBytesWritten)
445 {
447 
448  status = EngpFileIoRequest(pFileObject,
449  IRP_MJ_WRITE,
450  lpBuffer,
451  nLength,
452  0,
453  lpBytesWritten);
454  if (!NT_SUCCESS(status))
455  {
456  *lpBytesWritten = 0;
457  }
458 }
459 
460 _Success_(return>=0)
461 NTSTATUS
462 APIENTRY
463 EngFileIoControl(
464  _In_ PFILE_OBJECT pFileObject,
466  _In_reads_(nInBufferSize) PVOID lpInBuffer,
467  _In_ SIZE_T nInBufferSize,
468  _Out_writes_(nOutBufferSize) PVOID lpOutBuffer,
469  _In_ SIZE_T nOutBufferSize,
470  _Out_ PULONG_PTR lpInformation)
471 {
473  KEVENT Event;
474  PIRP pIrp;
477 
478  /* Get corresponding device object */
480  if (!pDeviceObject)
481  {
483  }
484 
485  /* Initialize an event */
487 
488  /* Build IO control IRP */
491  lpInBuffer,
492  (ULONG)nInBufferSize,
493  lpOutBuffer,
494  (ULONG)nOutBufferSize,
495  FALSE,
496  &Event,
497  &Iosb);
498  if (!pIrp)
499  {
501  }
502 
503  /* Call the driver */
505 
506  /* Wait if neccessary */
507  if (Status == STATUS_PENDING)
508  {
510  Status = Iosb.Status;
511  }
512 
513  /* Return information to the caller about the operation. */
514  *lpInformation = Iosb.Information;
515 
516  /* This function returns NTSTATUS */
517  return Status;
518 }
519 
520 /*
521  * @implemented
522  */
523 _Success_(return==0)
524 DWORD
525 APIENTRY
526 EngDeviceIoControl(
527  _In_ HANDLE hDevice,
534 {
535  PIRP Irp;
537  KEVENT Event;
540 
541  TRACE("EngDeviceIoControl() called\n");
542 
543  if (!hDevice)
544  {
545  return ERROR_INVALID_HANDLE;
546  }
547 
549 
550  DeviceObject = (PDEVICE_OBJECT) hDevice;
551 
553  DeviceObject,
554  lpInBuffer,
556  lpOutBuffer,
558  FALSE,
559  &Event,
560  &Iosb);
561  if (!Irp) return ERROR_NOT_ENOUGH_MEMORY;
562 
564 
565  if (Status == STATUS_PENDING)
566  {
568  Status = Iosb.Status;
569  }
570 
571  TRACE("EngDeviceIoControl(): Returning %X/%X\n", Iosb.Status,
572  Iosb.Information);
573 
574  /* Return information to the caller about the operation. */
575  *lpBytesReturned = (DWORD)Iosb.Information;
576 
577  /* Convert NT status values to win32 error codes. */
578  switch (Status)
579  {
582 
584  return ERROR_MORE_DATA;
585 
587  return ERROR_INVALID_FUNCTION;
588 
591 
594 
596  return ERROR_DEV_NOT_EXIST;
597 
598  case STATUS_PENDING:
599  return ERROR_IO_PENDING;
600  }
601 
602  return Status;
603 }
604 
605 /* EOF */
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
VOID WINAPI EngReleaseSemaphore(IN HSEMAPHORE hsem)
Definition: eng.c:235
#define STATUS_DEVICE_DOES_NOT_EXIST
Definition: ntstatus.h:428
#define IN
Definition: typedefs.h:39
_In_ PNDIS_STRING _In_ PNDIS_STRING _Out_ PDEVICE_OBJECT * pDeviceObject
Definition: ndis.h:4679
_In_ ULONG cj
Definition: winddi.h:3540
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ DWORD _In_reads_(nInBufferSize)
Definition: device.c:466
#define _In_opt_
Definition: ms_sal.h:309
static PGRAPHICS_DEVICE gpGraphicsDeviceLast
Definition: device.c:19
#define ERROR_SUCCESS
Definition: deptool.c:10
PDEVICE_OBJECT DeviceObject
Definition: pdevobj.h:63
_In_ WDFIOTARGET _In_ PWDF_REQUEST_COMPLETION_PARAMS Params
Definition: wdfrequest.h:306
VIDEO_WIN32K_CALLBACKS_PARAMS_TYPE CalloutType
Definition: ntddvdeo.h:250
_In_ DWORD _In_ DWORD _In_ DWORD cjOutBufferSize
Definition: winddi.h:1704
#define _Out_
Definition: ms_sal.h:345
PIRP NTAPI IoBuildSynchronousFsdRequest(IN ULONG MajorFunction, IN PDEVICE_OBJECT DeviceObject, IN PVOID Buffer, IN ULONG Length, IN PLARGE_INTEGER StartingOffset, IN PKEVENT Event, IN PIO_STATUS_BLOCK IoStatusBlock)
Definition: irp.c:1069
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
WCHAR szWinDeviceName[CCHDEVICENAME/2]
Definition: pdevobj.h:60
WCHAR szNtDeviceName[CCHDEVICENAME/2]
Definition: pdevobj.h:59
#define TRUE
Definition: types.h:120
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
struct _DEVICE_OBJECT * PDEVICE_OBJECT
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
_Success_(return >=0) NTSTATUS APIENTRY EngFileIoControl(_In_ PFILE_OBJECT pFileObject
uint16_t * PWSTR
Definition: typedefs.h:56
DWORD StateFlags
Definition: pdevobj.h:66
_Check_return_ _CRTIMP int __cdecl _wtoi(_In_z_ const wchar_t *_Str)
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
LONG NTSTATUS
Definition: precomp.h:26
static HDC
Definition: imagelist.c:92
_In_ DWORD nLength
Definition: wincon.h:473
PDEVMODEENTRY pDevModeList
Definition: pdevobj.h:70
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
NTSTATUS NTAPI IoGetDeviceObjectPointer(IN PUNICODE_STRING ObjectName, IN ACCESS_MASK DesiredAccess, OUT PFILE_OBJECT *FileObject, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1435
PDEVICE_OBJECT NTAPI IoGetRelatedDeviceObject(IN PFILE_OBJECT FileObject)
Definition: device.c:1539
PGRAPHICS_DEVICE gpVgaGraphicsDevice
Definition: device.c:16
IN PVIDEO_WIN32K_CALLOUT Callout
Definition: ntddvdeo.h:263
FxIrp * pIrp
PGRAPHICS_DEVICE NTAPI InitDisplayDriver(IN PWSTR pwszDeviceName, IN PWSTR pwszRegKey)
Definition: display.c:66
PGRAPHICS_DEVICE gpPrimaryGraphicsDevice
Definition: device.c:15
#define ERROR_IO_PENDING
Definition: dderror.h:15
NTSTATUS NTAPI KeWaitForSingleObject(IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL)
Definition: wait.c:416
#define DWORD
Definition: nt_native.h:44
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
VOID UserRefreshDisplay(IN PPDEVOBJ ppdev)
Definition: display.c:193
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
return STATUS_NOT_IMPLEMENTED
#define L(x)
Definition: ntvdm.h:50
ULONG_PTR * PSIZE_T
Definition: typedefs.h:80
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define FALSE
Definition: types.h:117
_In_ PIRP Irp
Definition: csq.h:116
#define IOCTL_VIDEO_INIT_WIN32K_CALLBACKS
Definition: ntddvdeo.h:62
#define FILE_READ_DATA
Definition: nt_native.h:628
NTSTRSAFEAPI RtlStringCbCopyNW(_Out_writes_bytes_(cbDest) NTSTRSAFE_PWSTR pszDest, _In_ size_t cbDest, _In_reads_bytes_(cbToCopy) STRSAFE_LPCWSTR pszSrc, _In_ size_t cbToCopy)
Definition: ntstrsafe.h:416
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:175
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:467
LPWSTR pwszDescription
Definition: pdevobj.h:72
_In_ DWORD _In_ DWORD cjInBufferSize
Definition: winddi.h:1702
VOID NTAPI VideoPortCallout(_In_ PVOID Params)
Definition: device.c:133
static PGRAPHICS_DEVICE gpGraphicsDeviceFirst
Definition: device.c:18
ENGAPI VOID APIENTRY EngAcquireSemaphore(_Inout_ HSEMAPHORE hsem)
#define _In_
Definition: ms_sal.h:308
BOOL FASTCALL IntPaintDesktop(HDC hDC)
Definition: desktop.c:1830
switch(r->id)
Definition: btrfs.c:3015
_In_ DWORD dwIoControlCode
Definition: device.c:465
#define FILE_WRITE_DATA
Definition: nt_native.h:631
#define _Out_writes_bytes_opt_(size)
Definition: ms_sal.h:351
Status
Definition: gdiplustypes.h:24
#define TRACE(s)
Definition: solgame.cpp:4
struct _GRAPHICS_DEVICE * pNextGraphicsDevice
Definition: pdevobj.h:61
#define ASSERT(a)
Definition: mode.c:44
DWORD_PTR HSEMAPHORE
Definition: axcore.idl:60
__wchar_t WCHAR
Definition: xmlstorage.h:180
return Iosb
Definition: create.c:4402
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
NTSTRSAFEVAPI RtlStringCbPrintfW(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cbDest, _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,...)
Definition: ntstrsafe.h:1173
LPWSTR pDiplayDrivers
Definition: pdevobj.h:71
ULONG cDevModes
Definition: pdevobj.h:69
uint64_t ULONGLONG
Definition: typedefs.h:67
OUT HANDLE pPhysDeviceObject
Definition: ntddvdeo.h:265
BOOL NTAPI RegReadDWORD(HKEY hkey, PWSTR pwszValue, PDWORD pdwData)
Definition: registry.c:150
unsigned long DWORD
Definition: ntddk_ex.h:95
static HSEMAPHORE ghsemGraphicsDeviceList
Definition: device.c:20
* PFILE_OBJECT
Definition: iotypes.h:1998
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
HDC hdc
Definition: main.c:9
#define NTSTATUS
Definition: precomp.h:20
#define GDITAG_DRVSUP
Definition: tags.h:77
#define VOID
Definition: acefi.h:82
struct _VIDEO_WIN32K_CALLBACKS_PARAMS * PVIDEO_WIN32K_CALLBACKS_PARAMS
PGRAPHICS_DEVICE NTAPI EngpFindGraphicsDevice(_In_opt_ PUNICODE_STRING pustrDevice, _In_ ULONG iDevNum)
Definition: device.c:338
#define NOTHING
Definition: env_spec_w32.h:461
int _cdecl swprintf(const WCHAR *,...)
#define ERROR_MORE_DATA
Definition: dderror.h:13
#define GDITAG_GDEVICE
Definition: tags.h:99
OUT ULONG DualviewFlags
Definition: ntddvdeo.h:266
#define ERR(fmt,...)
Definition: debug.h:110
ULONG_PTR SIZE_T
Definition: typedefs.h:80
NTSTATUS EngpUpdateGraphicsDeviceList(VOID)
Definition: device.c:36
DBG_DEFAULT_CHANNEL(EngDev)
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static ULONG giDevNum
Definition: device.c:21
PPDEVOBJ ppdevGlobal
Definition: mdevobj.h:16
HDC FASTCALL IntGdiCreateDC(PUNICODE_STRING Driver, PUNICODE_STRING pustrDevice, PVOID pUMdhpdev, CONST PDEVMODEW pdmInit, BOOL CreateAsIC)
Definition: dclife.c:1040
PMDEVOBJ gpmdev
Definition: mdevobj.c:14
#define NULL
Definition: types.h:112
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218
_In_ DWORD _In_ DWORD _In_ DWORD _Out_ LPDWORD lpBytesReturned
Definition: winddi.h:1704
#define DISPLAY_DEVICE_VGA_COMPATIBLE
Definition: wingdi.h:1400
PIRP NTAPI IoBuildDeviceIoControlRequest(IN ULONG IoControlCode, IN PDEVICE_OBJECT DeviceObject, IN PVOID InputBuffer, IN ULONG InputBufferLength, IN PVOID OutputBuffer, IN ULONG OutputBufferLength, IN BOOLEAN InternalDeviceIoControl, IN PKEVENT Event, IN PIO_STATUS_BLOCK IoStatusBlock)
Definition: irp.c:881
#define _In_reads_bytes_opt_(size)
Definition: ms_sal.h:322
NTSTATUS NTAPI InitDeviceImpl(VOID)
Definition: device.c:26
#define RegQueryValue
Definition: winreg.h:523
uint32_t * LPDWORD
Definition: typedefs.h:59
HSEMAPHORE WINAPI EngCreateSemaphore(VOID)
Definition: eng.c:75
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
uint32_t * PULONG_PTR
Definition: typedefs.h:65
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define IRP_MJ_WRITE
Definition: rdpdr.c:47
#define STATUS_SUCCESS
Definition: shellext.h:65
PGRAPHICS_DEVICE NTAPI EngpRegisterGraphicsDevice(_In_ PUNICODE_STRING pustrDeviceName, _In_ PUNICODE_STRING pustrDiplayDrivers, _In_ PUNICODE_STRING pustrDescription)
Definition: device.c:193
HDC ScreenDeviceContext
Definition: desktop.c:36
VOID APIENTRY EngFileWrite(_In_ PFILE_OBJECT pFileObject, _In_reads_(nLength) PVOID lpBuffer, _In_ SIZE_T nLength, _Out_ PSIZE_T lpBytesWritten)
Definition: device.c:440
#define RegOpenKey
Definition: winreg.h:519
PDEVMODEINFO pdevmodeInfo
Definition: pdevobj.h:68
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
static SERVICE_STATUS status
Definition: service.c:31
static CODE_SEG("PAGE")
Definition: isapnp.c:1482
#define ERROR_DEV_NOT_EXIST
Definition: dderror.h:8
NTSYSAPI BOOLEAN NTAPI RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive)
static NTSTATUS EngpFileIoRequest(_In_ PFILE_OBJECT pFileObject, _In_ ULONG ulMajorFunction, _In_reads_(nBufferSize) PVOID lpBuffer, _In_ SIZE_T nBufferSize, _In_ ULONGLONG ullStartOffset, _Out_ PULONG_PTR lpInformation)
Definition: device.c:382
PFILE_OBJECT FileObject
Definition: pdevobj.h:75
#define APIENTRY
Definition: api.h:79
LONGLONG QuadPart
Definition: typedefs.h:114
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define _Out_writes_(size)
Definition: ms_sal.h:348
#define REG_SZ
Definition: layer.c:22
Definition: ps.c:97