ReactOS  0.4.14-dev-552-g2fad488
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 INIT_FUNCTION
25 NTAPI
27 {
31 
32  return STATUS_SUCCESS;
33 }
34 
35 BOOLEAN
37  _Inout_ PGRAPHICS_DEVICE pGraphicsDevice,
38  _In_ PDEVMODEW pdmDefault)
39 {
40  PWSTR pwsz;
41  PLDEVOBJ pldev;
42  PDEVMODEINFO pdminfo;
43  PDEVMODEW pdm, pdmEnd;
44  ULONG i, cModes = 0;
45  BOOLEAN bModeMatch = FALSE;
46 
47  ASSERT(pGraphicsDevice->pdevmodeInfo == NULL);
48  ASSERT(pGraphicsDevice->pDevModeList == NULL);
49 
50  pwsz = pGraphicsDevice->pDiplayDrivers;
51 
52  /* Loop through the driver names
53  * This is a REG_MULTI_SZ string */
54  for (; *pwsz; pwsz += wcslen(pwsz) + 1)
55  {
56  /* Try to load the display driver */
57  TRACE("Trying driver: %ls\n", pwsz);
58  pldev = EngLoadImageEx(pwsz, LDEV_DEVICE_DISPLAY);
59  if (!pldev)
60  {
61  ERR("Could not load driver: '%ls'\n", pwsz);
62  continue;
63  }
64 
65  /* Get the mode list from the driver */
66  pdminfo = LDEVOBJ_pdmiGetModes(pldev, pGraphicsDevice->DeviceObject);
67  if (!pdminfo)
68  {
69  ERR("Could not get mode list for '%ls'\n", pwsz);
70  continue;
71  }
72 
73  /* Attach the mode info to the device */
74  pdminfo->pdmiNext = pGraphicsDevice->pdevmodeInfo;
75  pGraphicsDevice->pdevmodeInfo = pdminfo;
76 
77  /* Loop all DEVMODEs */
78  pdmEnd = (DEVMODEW*)((PCHAR)pdminfo->adevmode + pdminfo->cbdevmode);
79  for (pdm = pdminfo->adevmode;
80  (pdm + 1 <= pdmEnd) && (pdm->dmSize != 0);
81  pdm = (DEVMODEW*)((PCHAR)pdm + pdm->dmSize + pdm->dmDriverExtra))
82  {
83  /* Count this DEVMODE */
84  cModes++;
85 
86  /* Some drivers like the VBox driver don't fill the dmDeviceName
87  with the name of the display driver. So fix that here. */
88  RtlStringCbCopyW(pdm->dmDeviceName, sizeof(pdm->dmDeviceName), pwsz);
89  }
90 
91  // FIXME: release the driver again until it's used?
92  }
93 
94  if (!pGraphicsDevice->pdevmodeInfo || cModes == 0)
95  {
96  ERR("No devmodes\n");
97  return FALSE;
98  }
99 
100  /* Allocate an index buffer */
101  pGraphicsDevice->cDevModes = cModes;
102  pGraphicsDevice->pDevModeList = ExAllocatePoolWithTag(PagedPool,
103  cModes * sizeof(DEVMODEENTRY),
105  if (!pGraphicsDevice->pDevModeList)
106  {
107  ERR("No devmode list\n");
108  return FALSE;
109  }
110 
111  TRACE("Looking for mode %lux%lux%lu(%lu Hz)\n",
112  pdmDefault->dmPelsWidth,
113  pdmDefault->dmPelsHeight,
114  pdmDefault->dmBitsPerPel,
115  pdmDefault->dmDisplayFrequency);
116 
117  /* Loop through all DEVMODEINFOs */
118  for (pdminfo = pGraphicsDevice->pdevmodeInfo, i = 0;
119  pdminfo;
120  pdminfo = pdminfo->pdmiNext)
121  {
122  /* Calculate End of the DEVMODEs */
123  pdmEnd = (DEVMODEW*)((PCHAR)pdminfo->adevmode + pdminfo->cbdevmode);
124 
125  /* Loop through the DEVMODEs */
126  for (pdm = pdminfo->adevmode;
127  (pdm + 1 <= pdmEnd) && (pdm->dmSize != 0);
128  pdm = (PDEVMODEW)((PCHAR)pdm + pdm->dmSize + pdm->dmDriverExtra))
129  {
130  TRACE(" %S has mode %lux%lux%lu(%lu Hz)\n",
131  pdm->dmDeviceName,
132  pdm->dmPelsWidth,
133  pdm->dmPelsHeight,
134  pdm->dmBitsPerPel,
135  pdm->dmDisplayFrequency);
136  /* Compare with the default entry */
137  if (!bModeMatch &&
138  pdm->dmBitsPerPel == pdmDefault->dmBitsPerPel &&
139  pdm->dmPelsWidth == pdmDefault->dmPelsWidth &&
140  pdm->dmPelsHeight == pdmDefault->dmPelsHeight)
141  {
142  pGraphicsDevice->iDefaultMode = i;
143  pGraphicsDevice->iCurrentMode = i;
144  TRACE("Found default entry: %lu '%ls'\n", i, pdm->dmDeviceName);
145  if (pdm->dmDisplayFrequency == pdmDefault->dmDisplayFrequency)
146  {
147  /* Uh oh, even the display frequency matches. */
148  bModeMatch = TRUE;
149  }
150  }
151 
152  /* Initialize the entry */
153  pGraphicsDevice->pDevModeList[i].dwFlags = 0;
154  pGraphicsDevice->pDevModeList[i].pdm = pdm;
155  i++;
156  }
157  }
158  return TRUE;
159 }
160 
161 extern VOID
163 
164 // PVIDEO_WIN32K_CALLOUT
165 VOID
166 NTAPI
168  _In_ PVOID Params)
169 {
170 /*
171  * IMPORTANT NOTICE!! On Windows XP/2003 this function triggers the creation of
172  * a specific VideoPortCalloutThread() system thread using the same mechanism
173  * as the RIT/desktop/Ghost system threads.
174  */
175 
177 
178  TRACE("VideoPortCallout(0x%p, 0x%x)\n",
179  CallbackParams, CallbackParams ? CallbackParams->CalloutType : -1);
180 
181  if (!CallbackParams)
182  return;
183 
184  switch (CallbackParams->CalloutType)
185  {
187  {
188  TRACE("VideoPortCallout: VideoFindAdapterCallout called - Param = %s\n",
189  CallbackParams->Param ? "TRUE" : "FALSE");
190  if (CallbackParams->Param == TRUE)
191  {
192  /* Re-enable the display */
194  }
195  else
196  {
197  /* Disable the display */
198  NOTHING; // Nothing to do for the moment...
199  }
200 
201  CallbackParams->Status = STATUS_SUCCESS;
202  break;
203  }
204 
208  case VideoWakeupCallout:
214  ERR("VideoPortCallout: CalloutType 0x%x is UNIMPLEMENTED!\n", CallbackParams->CalloutType);
215  CallbackParams->Status = STATUS_NOT_IMPLEMENTED;
216  break;
217 
218  default:
219  ERR("VideoPortCallout: Unknown CalloutType 0x%x\n", CallbackParams->CalloutType);
220  CallbackParams->Status = STATUS_UNSUCCESSFUL;
221  break;
222  }
223 }
224 
226 NTAPI
228  _In_ PUNICODE_STRING pustrDeviceName,
229  _In_ PUNICODE_STRING pustrDiplayDrivers,
230  _In_ PUNICODE_STRING pustrDescription,
231  _In_ PDEVMODEW pdmDefault)
232 {
233  PGRAPHICS_DEVICE pGraphicsDevice;
235  PFILE_OBJECT pFileObject;
237  VIDEO_WIN32K_CALLBACKS Win32kCallbacks;
238  ULONG ulReturn;
239  PWSTR pwsz;
240  ULONG cj;
241 
242  TRACE("EngpRegisterGraphicsDevice(%wZ)\n", pustrDeviceName);
243 
244  /* Allocate a GRAPHICS_DEVICE structure */
245  pGraphicsDevice = ExAllocatePoolWithTag(PagedPool,
246  sizeof(GRAPHICS_DEVICE),
248  if (!pGraphicsDevice)
249  {
250  ERR("ExAllocatePoolWithTag failed\n");
251  return NULL;
252  }
253 
254  /* Try to open and enable the device */
255  Status = IoGetDeviceObjectPointer(pustrDeviceName,
257  &pFileObject,
258  &pDeviceObject);
259  if (!NT_SUCCESS(Status))
260  {
261  ERR("Could not open device %wZ, 0x%lx\n", pustrDeviceName, Status);
262  ExFreePoolWithTag(pGraphicsDevice, GDITAG_GDEVICE);
263  return NULL;
264  }
265 
266  /* Copy the device and file object pointers */
267  pGraphicsDevice->DeviceObject = pDeviceObject;
268  pGraphicsDevice->FileObject = pFileObject;
269 
270  /* Initialize and register the device with videoprt for Win32k callbacks */
271  Win32kCallbacks.PhysDisp = pGraphicsDevice;
272  Win32kCallbacks.Callout = VideoPortCallout;
273  // Reset the data being returned prior to the call.
274  Win32kCallbacks.bACPI = FALSE;
275  Win32kCallbacks.pPhysDeviceObject = NULL;
276  Win32kCallbacks.DualviewFlags = 0;
277  Status = (NTSTATUS)EngDeviceIoControl((HANDLE)pDeviceObject,
279  &Win32kCallbacks,
280  sizeof(Win32kCallbacks),
281  &Win32kCallbacks,
282  sizeof(Win32kCallbacks),
283  &ulReturn);
284  if (Status != ERROR_SUCCESS)
285  {
286  ERR("EngDeviceIoControl(0x%p, IOCTL_VIDEO_INIT_WIN32K_CALLBACKS) failed, Status 0x%lx\n",
288  }
289  // TODO: Set flags according to the results.
290  // if (Win32kCallbacks.bACPI)
291  // if (Win32kCallbacks.DualviewFlags & ???)
292  // Win32kCallbacks.pPhysDeviceObject;
293 
294  /* Copy the device name */
295  RtlStringCbCopyNW(pGraphicsDevice->szNtDeviceName,
296  sizeof(pGraphicsDevice->szNtDeviceName),
297  pustrDeviceName->Buffer,
298  pustrDeviceName->Length);
299 
300  /* Create a Win32 device name (FIXME: virtual devices!) */
301  RtlStringCbPrintfW(pGraphicsDevice->szWinDeviceName,
302  sizeof(pGraphicsDevice->szWinDeviceName),
303  L"\\\\.\\DISPLAY%d",
304  (int)giDevNum);
305 
306  /* Allocate a buffer for the strings */
307  cj = pustrDiplayDrivers->Length + pustrDescription->Length + sizeof(WCHAR);
309  if (!pwsz)
310  {
311  ERR("Could not allocate string buffer\n");
312  ASSERT(FALSE); // FIXME
313  ExFreePoolWithTag(pGraphicsDevice, GDITAG_GDEVICE);
314  return NULL;
315  }
316 
317  /* Copy the display driver names */
318  pGraphicsDevice->pDiplayDrivers = pwsz;
319  RtlCopyMemory(pGraphicsDevice->pDiplayDrivers,
320  pustrDiplayDrivers->Buffer,
321  pustrDiplayDrivers->Length);
322 
323  /* Copy the description */
324  pGraphicsDevice->pwszDescription = pwsz + pustrDiplayDrivers->Length / sizeof(WCHAR);
325  RtlCopyMemory(pGraphicsDevice->pwszDescription,
326  pustrDescription->Buffer,
327  pustrDescription->Length);
328  pGraphicsDevice->pwszDescription[pustrDescription->Length/sizeof(WCHAR)] = 0;
329 
330  /* Initialize the pdevmodeInfo list and default index */
331  pGraphicsDevice->pdevmodeInfo = NULL;
332  pGraphicsDevice->iDefaultMode = 0;
333  pGraphicsDevice->iCurrentMode = 0;
334 
335  // FIXME: initialize state flags
336  pGraphicsDevice->StateFlags = 0;
337 
338  /* Create the mode list */
339  pGraphicsDevice->pDevModeList = NULL;
340  if (!EngpPopulateDeviceModeList(pGraphicsDevice, pdmDefault))
341  {
342  ExFreePoolWithTag(pGraphicsDevice, GDITAG_GDEVICE);
343  return NULL;
344  }
345 
346  /* Lock loader */
348 
349  /* Insert the device into the global list */
350  pGraphicsDevice->pNextGraphicsDevice = NULL;
352  gpGraphicsDeviceLast->pNextGraphicsDevice = pGraphicsDevice;
353  gpGraphicsDeviceLast = pGraphicsDevice;
355  gpGraphicsDeviceFirst = pGraphicsDevice;
356 
357  /* Increment the device number */
358  giDevNum++;
359 
360  /* Unlock loader */
362  TRACE("Prepared %lu modes for %ls\n", pGraphicsDevice->cDevModes, pGraphicsDevice->pwszDescription);
363 
364  return pGraphicsDevice;
365 }
366 
368 NTAPI
370  _In_opt_ PUNICODE_STRING pustrDevice,
371  _In_ ULONG iDevNum,
373 {
374  UNICODE_STRING ustrCurrent;
375  PGRAPHICS_DEVICE pGraphicsDevice;
376  ULONG i;
377  TRACE("EngpFindGraphicsDevice('%wZ', %lu, 0x%lx)\n",
378  pustrDevice, iDevNum, dwFlags);
379 
380  /* Lock list */
382 
383  if (pustrDevice && pustrDevice->Buffer)
384  {
385  /* Loop through the list of devices */
386  for (pGraphicsDevice = gpGraphicsDeviceFirst;
387  pGraphicsDevice;
388  pGraphicsDevice = pGraphicsDevice->pNextGraphicsDevice)
389  {
390  /* Compare the device name */
391  RtlInitUnicodeString(&ustrCurrent, pGraphicsDevice->szWinDeviceName);
392  if (RtlEqualUnicodeString(&ustrCurrent, pustrDevice, FALSE))
393  {
394  break;
395  }
396  }
397  }
398  else
399  {
400  /* Loop through the list of devices */
401  for (pGraphicsDevice = gpGraphicsDeviceFirst, i = 0;
402  pGraphicsDevice && i < iDevNum;
403  pGraphicsDevice = pGraphicsDevice->pNextGraphicsDevice, i++);
404  }
405 
406  /* Unlock list */
408 
409  return pGraphicsDevice;
410 }
411 
412 static
413 NTSTATUS
415  _In_ PFILE_OBJECT pFileObject,
416  _In_ ULONG ulMajorFunction,
417  _In_reads_(nBufferSize) PVOID lpBuffer,
418  _In_ SIZE_T nBufferSize,
419  _In_ ULONGLONG ullStartOffset,
420  _Out_ PULONG_PTR lpInformation)
421 {
423  KEVENT Event;
424  PIRP pIrp;
427  LARGE_INTEGER liStartOffset;
428 
429  /* Get corresponding device object */
431  if (!pDeviceObject)
432  {
434  }
435 
436  /* Initialize an event */
438 
439  /* Build IRP */
440  liStartOffset.QuadPart = ullStartOffset;
441  pIrp = IoBuildSynchronousFsdRequest(ulMajorFunction,
443  lpBuffer,
444  (ULONG)nBufferSize,
445  &liStartOffset,
446  &Event,
447  &Iosb);
448  if (!pIrp)
449  {
451  }
452 
453  /* Call the driver */
455 
456  /* Wait if neccessary */
457  if (STATUS_PENDING == Status)
458  {
460  Status = Iosb.Status;
461  }
462 
463  /* Return information to the caller about the operation. */
464  *lpInformation = Iosb.Information;
465 
466  /* Return NTSTATUS */
467  return Status;
468 }
469 
470 VOID
471 APIENTRY
473  _In_ PFILE_OBJECT pFileObject,
476  _Out_ PSIZE_T lpBytesWritten)
477 {
479 
480  status = EngpFileIoRequest(pFileObject,
481  IRP_MJ_WRITE,
482  lpBuffer,
483  nLength,
484  0,
485  lpBytesWritten);
486  if (!NT_SUCCESS(status))
487  {
488  *lpBytesWritten = 0;
489  }
490 }
491 
492 _Success_(return>=0)
493 NTSTATUS
494 APIENTRY
495 EngFileIoControl(
496  _In_ PFILE_OBJECT pFileObject,
498  _In_reads_(nInBufferSize) PVOID lpInBuffer,
499  _In_ SIZE_T nInBufferSize,
500  _Out_writes_(nOutBufferSize) PVOID lpOutBuffer,
501  _In_ SIZE_T nOutBufferSize,
502  _Out_ PULONG_PTR lpInformation)
503 {
505  KEVENT Event;
506  PIRP pIrp;
509 
510  /* Get corresponding device object */
512  if (!pDeviceObject)
513  {
515  }
516 
517  /* Initialize an event */
519 
520  /* Build IO control IRP */
523  lpInBuffer,
524  (ULONG)nInBufferSize,
525  lpOutBuffer,
526  (ULONG)nOutBufferSize,
527  FALSE,
528  &Event,
529  &Iosb);
530  if (!pIrp)
531  {
533  }
534 
535  /* Call the driver */
537 
538  /* Wait if neccessary */
539  if (Status == STATUS_PENDING)
540  {
542  Status = Iosb.Status;
543  }
544 
545  /* Return information to the caller about the operation. */
546  *lpInformation = Iosb.Information;
547 
548  /* This function returns NTSTATUS */
549  return Status;
550 }
551 
552 /*
553  * @implemented
554  */
555 _Success_(return==0)
556 DWORD
557 APIENTRY
558 EngDeviceIoControl(
559  _In_ HANDLE hDevice,
566 {
567  PIRP Irp;
569  KEVENT Event;
572 
573  TRACE("EngDeviceIoControl() called\n");
574 
575  if (!hDevice)
576  {
577  return ERROR_INVALID_HANDLE;
578  }
579 
581 
582  DeviceObject = (PDEVICE_OBJECT) hDevice;
583 
585  DeviceObject,
586  lpInBuffer,
588  lpOutBuffer,
590  FALSE,
591  &Event,
592  &Iosb);
593  if (!Irp) return ERROR_NOT_ENOUGH_MEMORY;
594 
596 
597  if (Status == STATUS_PENDING)
598  {
600  Status = Iosb.Status;
601  }
602 
603  TRACE("EngDeviceIoControl(): Returning %X/%X\n", Iosb.Status,
604  Iosb.Information);
605 
606  /* Return information to the caller about the operation. */
607  *lpBytesReturned = (DWORD)Iosb.Information;
608 
609  /* Convert NT status values to win32 error codes. */
610  switch (Status)
611  {
614 
616  return ERROR_MORE_DATA;
617 
619  return ERROR_INVALID_FUNCTION;
620 
623 
626 
628  return ERROR_DEV_NOT_EXIST;
629 
630  case STATUS_PENDING:
631  return ERROR_IO_PENDING;
632  }
633 
634  return Status;
635 }
636 
637 /* EOF */
BOOLEAN EngpPopulateDeviceModeList(_Inout_ PGRAPHICS_DEVICE pGraphicsDevice, _In_ PDEVMODEW pdmDefault)
Definition: device.c:36
signed char * PCHAR
Definition: retypes.h:7
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
NTSTRSAFEAPI RtlStringCbCopyW(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cbDest, _In_ NTSTRSAFE_PCWSTR pszSrc)
Definition: ntstrsafe.h:174
VOID WINAPI EngReleaseSemaphore(IN HSEMAPHORE hsem)
Definition: eng.c:235
#define STATUS_DEVICE_DOES_NOT_EXIST
Definition: ntstatus.h:414
#define IN
Definition: typedefs.h:38
_In_ PNDIS_STRING _In_ PNDIS_STRING _Out_ PDEVICE_OBJECT * pDeviceObject
Definition: ndis.h:4679
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
_In_ ULONG cj
Definition: winddi.h:3540
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ DWORD _In_reads_(nInBufferSize)
Definition: device.c:498
struct _devicemodeW * PDEVMODEW
static PGRAPHICS_DEVICE gpGraphicsDeviceLast
Definition: device.c:19
#define ERROR_SUCCESS
Definition: deptool.c:10
PDEVICE_OBJECT DeviceObject
Definition: pdevobj.h:63
VIDEO_WIN32K_CALLBACKS_PARAMS_TYPE CalloutType
Definition: ntddvdeo.h:249
PDEVMODEINFO NTAPI LDEVOBJ_pdmiGetModes(_In_ PLDEVOBJ pldev, _In_ HANDLE hDriver)
Definition: ldevobj.c:116
_In_ DWORD _In_ DWORD _In_ DWORD cjOutBufferSize
Definition: winddi.h:1704
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
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
_In_ PIRP Irp
Definition: csq.h:116
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
struct _DEVICE_OBJECT * PDEVICE_OBJECT
_Success_(return >=0) NTSTATUS APIENTRY EngFileIoControl(_In_ PFILE_OBJECT pFileObject
uint16_t * PWSTR
Definition: typedefs.h:54
PPDEVOBJ gppdevPrimary
Definition: pdevobj.c:13
DWORD StateFlags
Definition: pdevobj.h:66
#define _In_reads_bytes_opt_(size)
Definition: no_sal2.h:230
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
LONG NTSTATUS
Definition: precomp.h:26
_In_ DWORD nLength
Definition: wincon.h:461
WORD dmDriverExtra
Definition: wingdi.h:1620
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:262
DWORD dmBitsPerPel
Definition: wingdi.h:1646
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 _In_opt_
Definition: no_sal2.h:213
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
VOID UserRefreshDisplay(IN PPDEVOBJ ppdev)
Definition: display.c:289
#define _Out_writes_(size)
Definition: no_sal2.h:367
PLDEVOBJ NTAPI EngLoadImageEx(_In_z_ LPWSTR pwszDriverName, _In_ ULONG ldevtype)
Definition: ldevobj.c:328
PGRAPHICS_DEVICE NTAPI EngpRegisterGraphicsDevice(_In_ PUNICODE_STRING pustrDeviceName, _In_ PUNICODE_STRING pustrDiplayDrivers, _In_ PUNICODE_STRING pustrDescription, _In_ PDEVMODEW pdmDefault)
Definition: device.c:227
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
PGRAPHICS_DEVICE NTAPI EngpFindGraphicsDevice(_In_opt_ PUNICODE_STRING pustrDevice, _In_ ULONG iDevNum, _In_ DWORD dwFlags)
Definition: device.c:369
ULONG_PTR * PSIZE_T
Definition: typedefs.h:78
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#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:173
ULONG cbdevmode
Definition: pdevobj.h:46
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:435
LPWSTR pwszDescription
Definition: pdevobj.h:72
_In_ DWORD _In_ DWORD cjInBufferSize
Definition: winddi.h:1702
VOID NTAPI VideoPortCallout(_In_ PVOID Params)
Definition: device.c:167
static PGRAPHICS_DEVICE gpGraphicsDeviceFirst
Definition: device.c:18
unsigned char BOOLEAN
#define _Out_writes_bytes_opt_(a)
Definition: btrfs_drv.h:193
ENGAPI VOID APIENTRY EngAcquireSemaphore(_Inout_ HSEMAPHORE hsem)
smooth NULL
Definition: ftsmooth.c:416
#define _Out_
Definition: no_sal2.h:323
switch(r->id)
Definition: btrfs.c:2904
_In_ DWORD dwIoControlCode
Definition: device.c:497
#define FILE_WRITE_DATA
Definition: nt_native.h:631
DEVMODEW adevmode[1]
Definition: pdevobj.h:47
INIT_FUNCTION NTSTATUS NTAPI InitDeviceImpl(VOID)
Definition: device.c:26
#define TRACE(s)
Definition: solgame.cpp:4
struct _GRAPHICS_DEVICE * pNextGraphicsDevice
Definition: pdevobj.h:61
DWORD_PTR HSEMAPHORE
Definition: axcore.idl:60
__wchar_t WCHAR
Definition: xmlstorage.h:180
return Iosb
Definition: create.c:4426
ULONG iCurrentMode
Definition: pdevobj.h:78
#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:65
struct _DEVMODEINFO * pdmiNext
Definition: pdevobj.h:44
OUT HANDLE pPhysDeviceObject
Definition: ntddvdeo.h:264
WORD dmSize
Definition: wingdi.h:1619
unsigned long DWORD
Definition: ntddk_ex.h:95
static HSEMAPHORE ghsemGraphicsDeviceList
Definition: device.c:20
#define _Inout_
Definition: no_sal2.h:244
* PFILE_OBJECT
Definition: iotypes.h:1955
WCHAR dmDeviceName[CCHDEVICENAME]
Definition: wingdi.h:1616
DWORD dmPelsWidth
Definition: wingdi.h:1647
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
static const WCHAR L[]
Definition: oid.c:1250
#define NTSTATUS
Definition: precomp.h:20
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define GDITAG_DRVSUP
Definition: tags.h:76
#define VOID
Definition: acefi.h:82
struct _VIDEO_WIN32K_CALLBACKS_PARAMS * PVIDEO_WIN32K_CALLBACKS_PARAMS
#define NOTHING
Definition: env_spec_w32.h:461
#define ERROR_MORE_DATA
Definition: dderror.h:13
#define GDITAG_GDEVICE
Definition: tags.h:98
OUT ULONG DualviewFlags
Definition: ntddvdeo.h:265
Status
Definition: gdiplustypes.h:24
#define ERR(fmt,...)
Definition: debug.h:109
#define _In_
Definition: no_sal2.h:204
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
ULONG_PTR SIZE_T
Definition: typedefs.h:78
DWORD dmDisplayFrequency
Definition: wingdi.h:1653
DBG_DEFAULT_CHANNEL(EngDev)
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
static ULONG giDevNum
Definition: device.c:21
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
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
DWORD dmPelsHeight
Definition: wingdi.h:1648
uint32_t * LPDWORD
Definition: typedefs.h:57
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:63
#define IRP_MJ_WRITE
Definition: rdpdr.c:47
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
VOID APIENTRY EngFileWrite(_In_ PFILE_OBJECT pFileObject, _In_reads_(nLength) PVOID lpBuffer, _In_ SIZE_T nLength, _Out_ PSIZE_T lpBytesWritten)
Definition: device.c:472
return STATUS_SUCCESS
Definition: btrfs.c:2938
PDEVMODEINFO pdevmodeInfo
Definition: pdevobj.h:68
static SERVICE_STATUS status
Definition: service.c:31
#define ERROR_DEV_NOT_EXIST
Definition: dderror.h:8
NTSYSAPI BOOLEAN NTAPI RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive)
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
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:414
ULONG iDefaultMode
Definition: pdevobj.h:77
PFILE_OBJECT FileObject
Definition: pdevobj.h:75
#define APIENTRY
Definition: api.h:79
LONGLONG QuadPart
Definition: typedefs.h:112
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
Definition: ps.c:97