ReactOS  0.4.13-dev-92-gf251225
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 DBG_DEFAULT_CHANNEL(EngDev)
12 
15 
19 static ULONG giDevNum = 1;
20 
21 INIT_FUNCTION
23 NTAPI
25 {
29 
30  return STATUS_SUCCESS;
31 }
32 
33 BOOLEAN
35  _Inout_ PGRAPHICS_DEVICE pGraphicsDevice,
36  _In_ PDEVMODEW pdmDefault)
37 {
38  PWSTR pwsz;
39  PLDEVOBJ pldev;
40  PDEVMODEINFO pdminfo;
41  PDEVMODEW pdm, pdmEnd;
42  ULONG i, cModes = 0;
43  BOOLEAN bModeMatch = FALSE;
44 
45  ASSERT(pGraphicsDevice->pdevmodeInfo == NULL);
46  ASSERT(pGraphicsDevice->pDevModeList == NULL);
47 
48  pwsz = pGraphicsDevice->pDiplayDrivers;
49 
50  /* Loop through the driver names
51  * This is a REG_MULTI_SZ string */
52  for (; *pwsz; pwsz += wcslen(pwsz) + 1)
53  {
54  TRACE("trying driver: %ls\n", pwsz);
55  /* Try to load the display driver */
56  pldev = EngLoadImageEx(pwsz, LDEV_DEVICE_DISPLAY);
57  if (!pldev)
58  {
59  ERR("Could not load driver: '%ls'\n", pwsz);
60  continue;
61  }
62 
63  /* Get the mode list from the driver */
64  pdminfo = LDEVOBJ_pdmiGetModes(pldev, pGraphicsDevice->DeviceObject);
65  if (!pdminfo)
66  {
67  ERR("Could not get mode list for '%ls'\n", pwsz);
68  continue;
69  }
70 
71  /* Attach the mode info to the device */
72  pdminfo->pdmiNext = pGraphicsDevice->pdevmodeInfo;
73  pGraphicsDevice->pdevmodeInfo = pdminfo;
74 
75  /* Loop all DEVMODEs */
76  pdmEnd = (DEVMODEW*)((PCHAR)pdminfo->adevmode + pdminfo->cbdevmode);
77  for (pdm = pdminfo->adevmode;
78  (pdm + 1 <= pdmEnd) && (pdm->dmSize != 0);
79  pdm = (DEVMODEW*)((PCHAR)pdm + pdm->dmSize + pdm->dmDriverExtra))
80  {
81  /* Count this DEVMODE */
82  cModes++;
83 
84  /* Some drivers like the VBox driver don't fill the dmDeviceName
85  with the name of the display driver. So fix that here. */
86  wcsncpy(pdm->dmDeviceName, pwsz, CCHDEVICENAME);
87  pdm->dmDeviceName[CCHDEVICENAME - 1] = 0;
88  }
89 
90  // FIXME: release the driver again until it's used?
91  }
92 
93  if (!pGraphicsDevice->pdevmodeInfo || cModes == 0)
94  {
95  ERR("No devmodes\n");
96  return FALSE;
97  }
98 
99  /* Allocate an index buffer */
100  pGraphicsDevice->cDevModes = cModes;
101  pGraphicsDevice->pDevModeList = ExAllocatePoolWithTag(PagedPool,
102  cModes * sizeof(DEVMODEENTRY),
104  if (!pGraphicsDevice->pDevModeList)
105  {
106  ERR("No devmode list\n");
107  return FALSE;
108  }
109 
110  TRACE("Looking for mode %lux%lux%lu(%lu Hz)\n",
111  pdmDefault->dmPelsWidth,
112  pdmDefault->dmPelsHeight,
113  pdmDefault->dmBitsPerPel,
114  pdmDefault->dmDisplayFrequency);
115 
116  /* Loop through all DEVMODEINFOs */
117  for (pdminfo = pGraphicsDevice->pdevmodeInfo, i = 0;
118  pdminfo;
119  pdminfo = pdminfo->pdmiNext)
120  {
121  /* Calculate End of the DEVMODEs */
122  pdmEnd = (DEVMODEW*)((PCHAR)pdminfo->adevmode + pdminfo->cbdevmode);
123 
124  /* Loop through the DEVMODEs */
125  for (pdm = pdminfo->adevmode;
126  (pdm + 1 <= pdmEnd) && (pdm->dmSize != 0);
127  pdm = (PDEVMODEW)((PCHAR)pdm + pdm->dmSize + pdm->dmDriverExtra))
128  {
129  TRACE(" %S has mode %lux%lux%lu(%lu Hz)\n",
130  pdm->dmDeviceName,
131  pdm->dmPelsWidth,
132  pdm->dmPelsHeight,
133  pdm->dmBitsPerPel,
134  pdm->dmDisplayFrequency);
135  /* Compare with the default entry */
136  if (!bModeMatch &&
137  pdm->dmBitsPerPel == pdmDefault->dmBitsPerPel &&
138  pdm->dmPelsWidth == pdmDefault->dmPelsWidth &&
139  pdm->dmPelsHeight == pdmDefault->dmPelsHeight)
140  {
141  pGraphicsDevice->iDefaultMode = i;
142  pGraphicsDevice->iCurrentMode = i;
143  TRACE("Found default entry: %lu '%ls'\n", i, pdm->dmDeviceName);
144  if (pdm->dmDisplayFrequency == pdmDefault->dmDisplayFrequency)
145  {
146  /* Uh oh, even the display frequency matches. */
147  bModeMatch = TRUE;
148  }
149  }
150 
151  /* Initialize the entry */
152  pGraphicsDevice->pDevModeList[i].dwFlags = 0;
153  pGraphicsDevice->pDevModeList[i].pdm = pdm;
154  i++;
155  }
156  }
157  return TRUE;
158 }
159 
161 NTAPI
163  _In_ PUNICODE_STRING pustrDeviceName,
164  _In_ PUNICODE_STRING pustrDiplayDrivers,
165  _In_ PUNICODE_STRING pustrDescription,
166  _In_ PDEVMODEW pdmDefault)
167 {
168  PGRAPHICS_DEVICE pGraphicsDevice;
170  PFILE_OBJECT pFileObject;
172  PWSTR pwsz;
173  ULONG cj;
174  SIZE_T cjWritten;
175  BOOL bEnable = TRUE;
176 
177  TRACE("EngpRegisterGraphicsDevice(%wZ)\n", pustrDeviceName);
178 
179  /* Allocate a GRAPHICS_DEVICE structure */
180  pGraphicsDevice = ExAllocatePoolWithTag(PagedPool,
181  sizeof(GRAPHICS_DEVICE),
183  if (!pGraphicsDevice)
184  {
185  ERR("ExAllocatePoolWithTag failed\n");
186  return NULL;
187  }
188 
189  /* Try to open the driver */
190  Status = IoGetDeviceObjectPointer(pustrDeviceName,
192  &pFileObject,
193  &pDeviceObject);
194  if (!NT_SUCCESS(Status))
195  {
196  ERR("Could not open driver %wZ, 0x%lx\n", pustrDeviceName, Status);
197  ExFreePoolWithTag(pGraphicsDevice, GDITAG_GDEVICE);
198  return NULL;
199  }
200 
201  /* Enable the device */
202  EngFileWrite(pFileObject, &bEnable, sizeof(BOOL), &cjWritten);
203 
204  /* Copy the device and file object pointers */
205  pGraphicsDevice->DeviceObject = pDeviceObject;
206  pGraphicsDevice->FileObject = pFileObject;
207 
208  /* Copy device name */
209  RtlStringCbCopyNW(pGraphicsDevice->szNtDeviceName,
210  sizeof(pGraphicsDevice->szNtDeviceName),
211  pustrDeviceName->Buffer,
212  pustrDeviceName->Length);
213 
214  /* Create a win device name (FIXME: virtual devices!) */
215  swprintf(pGraphicsDevice->szWinDeviceName, L"\\\\.\\DISPLAY%d", (int)giDevNum);
216 
217  /* Allocate a buffer for the strings */
218  cj = pustrDiplayDrivers->Length + pustrDescription->Length + sizeof(WCHAR);
220  if (!pwsz)
221  {
222  ERR("Could not allocate string buffer\n");
223  ASSERT(FALSE); // FIXME
224  ExFreePoolWithTag(pGraphicsDevice, GDITAG_GDEVICE);
225  return NULL;
226  }
227 
228  /* Copy display driver names */
229  pGraphicsDevice->pDiplayDrivers = pwsz;
230  RtlCopyMemory(pGraphicsDevice->pDiplayDrivers,
231  pustrDiplayDrivers->Buffer,
232  pustrDiplayDrivers->Length);
233 
234  /* Copy description */
235  pGraphicsDevice->pwszDescription = pwsz + pustrDiplayDrivers->Length / sizeof(WCHAR);
236  RtlCopyMemory(pGraphicsDevice->pwszDescription,
237  pustrDescription->Buffer,
238  pustrDescription->Length);
239  pGraphicsDevice->pwszDescription[pustrDescription->Length/sizeof(WCHAR)] = 0;
240 
241  /* Initialize the pdevmodeInfo list and default index */
242  pGraphicsDevice->pdevmodeInfo = NULL;
243  pGraphicsDevice->iDefaultMode = 0;
244  pGraphicsDevice->iCurrentMode = 0;
245 
246  // FIXME: initialize state flags
247  pGraphicsDevice->StateFlags = 0;
248 
249  /* Create the mode list */
250  pGraphicsDevice->pDevModeList = NULL;
251  if (!EngpPopulateDeviceModeList(pGraphicsDevice, pdmDefault))
252  {
253  ExFreePoolWithTag(pGraphicsDevice, GDITAG_GDEVICE);
254  return NULL;
255  }
256 
257  /* Lock loader */
259 
260  /* Insert the device into the global list */
261  pGraphicsDevice->pNextGraphicsDevice = NULL;
263  gpGraphicsDeviceLast->pNextGraphicsDevice = pGraphicsDevice;
264  gpGraphicsDeviceLast = pGraphicsDevice;
266  gpGraphicsDeviceFirst = pGraphicsDevice;
267 
268  /* Increment device number */
269  giDevNum++;
270 
271  /* Unlock loader */
273  TRACE("Prepared %lu modes for %ls\n", pGraphicsDevice->cDevModes, pGraphicsDevice->pwszDescription);
274 
275  return pGraphicsDevice;
276 }
277 
278 
280 NTAPI
282  _In_opt_ PUNICODE_STRING pustrDevice,
283  _In_ ULONG iDevNum,
285 {
286  UNICODE_STRING ustrCurrent;
287  PGRAPHICS_DEVICE pGraphicsDevice;
288  ULONG i;
289  TRACE("EngpFindGraphicsDevice('%wZ', %lu, 0x%lx)\n",
290  pustrDevice, iDevNum, dwFlags);
291 
292  /* Lock list */
294 
295  if (pustrDevice && pustrDevice->Buffer)
296  {
297  /* Loop through the list of devices */
298  for (pGraphicsDevice = gpGraphicsDeviceFirst;
299  pGraphicsDevice;
300  pGraphicsDevice = pGraphicsDevice->pNextGraphicsDevice)
301  {
302  /* Compare the device name */
303  RtlInitUnicodeString(&ustrCurrent, pGraphicsDevice->szWinDeviceName);
304  if (RtlEqualUnicodeString(&ustrCurrent, pustrDevice, FALSE))
305  {
306  break;
307  }
308  }
309  }
310  else
311  {
312  /* Loop through the list of devices */
313  for (pGraphicsDevice = gpGraphicsDeviceFirst, i = 0;
314  pGraphicsDevice && i < iDevNum;
315  pGraphicsDevice = pGraphicsDevice->pNextGraphicsDevice, i++);
316  }
317 
318  /* Unlock list */
320 
321  return pGraphicsDevice;
322 }
323 
324 
325 static
326 NTSTATUS
328  _In_ PFILE_OBJECT pFileObject,
329  _In_ ULONG ulMajorFunction,
330  _In_reads_(nBufferSize) PVOID lpBuffer,
331  _In_ SIZE_T nBufferSize,
332  _In_ ULONGLONG ullStartOffset,
333  _Out_ PULONG_PTR lpInformation)
334 {
336  KEVENT Event;
337  PIRP pIrp;
340  LARGE_INTEGER liStartOffset;
341 
342  /* Get corresponding device object */
344  if (!pDeviceObject)
345  {
347  }
348 
349  /* Initialize an event */
351 
352  /* Build IRP */
353  liStartOffset.QuadPart = ullStartOffset;
354  pIrp = IoBuildSynchronousFsdRequest(ulMajorFunction,
356  lpBuffer,
357  (ULONG)nBufferSize,
358  &liStartOffset,
359  &Event,
360  &Iosb);
361  if (!pIrp)
362  {
364  }
365 
366  /* Call the driver */
368 
369  /* Wait if neccessary */
370  if (STATUS_PENDING == Status)
371  {
373  Status = Iosb.Status;
374  }
375 
376  /* Return information to the caller about the operation. */
377  *lpInformation = Iosb.Information;
378 
379  /* Return NTSTATUS */
380  return Status;
381 }
382 
383 VOID
384 APIENTRY
386  _In_ PFILE_OBJECT pFileObject,
389  _Out_ PSIZE_T lpBytesWritten)
390 {
392 
393  status = EngpFileIoRequest(pFileObject,
394  IRP_MJ_WRITE,
395  lpBuffer,
396  nLength,
397  0,
398  lpBytesWritten);
399  if (!NT_SUCCESS(status))
400  {
401  *lpBytesWritten = 0;
402  }
403 }
404 
405 _Success_(return>=0)
406 NTSTATUS
407 APIENTRY
408 EngFileIoControl(
409  _In_ PFILE_OBJECT pFileObject,
411  _In_reads_(nInBufferSize) PVOID lpInBuffer,
412  _In_ SIZE_T nInBufferSize,
413  _Out_writes_(nOutBufferSize) PVOID lpOutBuffer,
414  _In_ SIZE_T nOutBufferSize,
415  _Out_ PULONG_PTR lpInformation)
416 {
418  KEVENT Event;
419  PIRP pIrp;
422 
423  /* Get corresponding device object */
425  if (!pDeviceObject)
426  {
428  }
429 
430  /* Initialize an event */
432 
433  /* Build IO control IRP */
436  lpInBuffer,
437  (ULONG)nInBufferSize,
438  lpOutBuffer,
439  (ULONG)nOutBufferSize,
440  FALSE,
441  &Event,
442  &Iosb);
443  if (!pIrp)
444  {
446  }
447 
448  /* Call the driver */
450 
451  /* Wait if neccessary */
452  if (Status == STATUS_PENDING)
453  {
455  Status = Iosb.Status;
456  }
457 
458  /* Return information to the caller about the operation. */
459  *lpInformation = Iosb.Information;
460 
461  /* This function returns NTSTATUS */
462  return Status;
463 }
464 
465 /*
466  * @implemented
467  */
468 _Success_(return==0)
469 DWORD
470 APIENTRY
471 EngDeviceIoControl(
472  _In_ HANDLE hDevice,
479 {
480  PIRP Irp;
482  KEVENT Event;
485 
486  TRACE("EngDeviceIoControl() called\n");
487 
488  if (!hDevice)
489  {
490  return ERROR_INVALID_HANDLE;
491  }
492 
494 
495  DeviceObject = (PDEVICE_OBJECT) hDevice;
496 
498  DeviceObject,
499  lpInBuffer,
501  lpOutBuffer,
503  FALSE,
504  &Event,
505  &Iosb);
506  if (!Irp) return ERROR_NOT_ENOUGH_MEMORY;
507 
509 
510  if (Status == STATUS_PENDING)
511  {
513  Status = Iosb.Status;
514  }
515 
516  TRACE("EngDeviceIoControl(): Returning %X/%X\n", Iosb.Status,
517  Iosb.Information);
518 
519  /* Return information to the caller about the operation. */
520  *lpBytesReturned = (DWORD)Iosb.Information;
521 
522  /* Convert NT status values to win32 error codes. */
523  switch (Status)
524  {
527 
529  return ERROR_MORE_DATA;
530 
532  return ERROR_INVALID_FUNCTION;
533 
536 
539 
541  return ERROR_DEV_NOT_EXIST;
542 
543  case STATUS_PENDING:
544  return ERROR_IO_PENDING;
545  }
546 
547  return Status;
548 }
549 
550 /* EOF */
BOOLEAN EngpPopulateDeviceModeList(_Inout_ PGRAPHICS_DEVICE pGraphicsDevice, _In_ PDEVMODEW pdmDefault)
Definition: device.c:34
signed char * PCHAR
Definition: retypes.h:7
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
VOID WINAPI EngReleaseSemaphore(IN HSEMAPHORE hsem)
Definition: eng.c:235
#define STATUS_DEVICE_DOES_NOT_EXIST
Definition: ntstatus.h:414
_In_ PNDIS_STRING _In_ PNDIS_STRING _Out_ PDEVICE_OBJECT * pDeviceObject
Definition: ndis.h:4661
#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:411
struct _devicemodeW * PDEVMODEW
static PGRAPHICS_DEVICE gpGraphicsDeviceLast
Definition: device.c:17
PDEVICE_OBJECT DeviceObject
Definition: pdevobj.h:63
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
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:1599
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:1434
PDEVICE_OBJECT NTAPI IoGetRelatedDeviceObject(IN PFILE_OBJECT FileObject)
Definition: device.c:1538
PGRAPHICS_DEVICE gpVgaGraphicsDevice
Definition: device.c:14
DWORD dmBitsPerPel
Definition: wingdi.h:1625
PGRAPHICS_DEVICE gpPrimaryGraphicsDevice
Definition: device.c:13
#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:64
#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:162
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:281
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
unsigned int BOOL
Definition: ntddk_ex.h:94
#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:411
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:173
ULONG cbdevmode
Definition: pdevobj.h:46
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:434
LPWSTR pwszDescription
Definition: pdevobj.h:72
_In_ DWORD _In_ DWORD cjInBufferSize
Definition: winddi.h:1702
static PGRAPHICS_DEVICE gpGraphicsDeviceFirst
Definition: device.c:16
unsigned char BOOLEAN
#define _Out_writes_bytes_opt_(a)
Definition: btrfs_drv.h:171
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:2691
_In_ DWORD dwIoControlCode
Definition: device.c:410
#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:24
#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
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
WORD dmSize
Definition: wingdi.h:1598
#define swprintf(buf, format,...)
Definition: sprintf.c:56
unsigned long DWORD
Definition: ntddk_ex.h:95
static HSEMAPHORE ghsemGraphicsDeviceList
Definition: device.c:18
#define _Inout_
Definition: no_sal2.h:244
* PFILE_OBJECT
Definition: iotypes.h:1954
WCHAR dmDeviceName[CCHDEVICENAME]
Definition: wingdi.h:1595
DWORD dmPelsWidth
Definition: wingdi.h:1626
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
static const WCHAR L[]
Definition: oid.c:1250
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define GDITAG_DRVSUP
Definition: tags.h:76
#define VOID
Definition: acefi.h:82
#define DBG_DEFAULT_CHANNEL(ch)
Definition: debug.h:102
#define ERROR_MORE_DATA
Definition: dderror.h:13
#define GDITAG_GDEVICE
Definition: tags.h:98
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:1632
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
_In_ BOOL bEnable
Definition: winddi.h:3426
_CRTIMP wchar_t *__cdecl wcsncpy(wchar_t *_Dest, const wchar_t *_Source, size_t _Count)
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
#define CCHDEVICENAME
Definition: ddrawi.h:63
static ULONG giDevNum
Definition: device.c:19
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:1627
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:385
return STATUS_SUCCESS
Definition: btrfs.c:2725
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:327
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