ReactOS  0.4.15-dev-4871-g4471ee4
device.c File Reference
#include <win32k.h>
#include <ntddvdeo.h>
Include dependency graph for device.c:

Go to the source code of this file.

Macros

#define READ(field, str)
 

Functions

 DBG_DEFAULT_CHANNEL (EngDev)
 
NTSTATUS NTAPI InitDeviceImpl (VOID)
 
NTSTATUS EngpUpdateGraphicsDeviceList (VOID)
 
static HKEY EngpGetRegistryHandleFromDeviceMap (_In_ PGRAPHICS_DEVICE pGraphicsDevice)
 
NTSTATUS EngpGetDisplayDriverParameters (_In_ PGRAPHICS_DEVICE pGraphicsDevice, _Out_ PDEVMODEW pdm)
 
DWORD EngpGetDisplayDriverAccelerationLevel (_In_ PGRAPHICS_DEVICE pGraphicsDevice)
 
VOID UserRefreshDisplay (IN PPDEVOBJ ppdev)
 
VOID NTAPI VideoPortCallout (_In_ PVOID Params)
 
PGRAPHICS_DEVICE NTAPI EngpRegisterGraphicsDevice (_In_ PUNICODE_STRING pustrDeviceName, _In_ PUNICODE_STRING pustrDiplayDrivers, _In_ PUNICODE_STRING pustrDescription)
 
PGRAPHICS_DEVICE NTAPI EngpFindGraphicsDevice (_In_opt_ PUNICODE_STRING pustrDevice, _In_ ULONG iDevNum)
 
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)
 
VOID APIENTRY EngFileWrite (_In_ PFILE_OBJECT pFileObject, _In_reads_(nLength) PVOID lpBuffer, _In_ SIZE_T nLength, _Out_ PSIZE_T lpBytesWritten)
 
 _Success_ (return >=0) NTSTATUS APIENTRY EngFileIoControl(_In_ PFILE_OBJECT pFileObject
 
_In_ DWORD _In_reads_ (nInBufferSize)
 
 _Success_ (return==0)
 

Variables

PGRAPHICS_DEVICE gpPrimaryGraphicsDevice
 
PGRAPHICS_DEVICE gpVgaGraphicsDevice
 
static PGRAPHICS_DEVICE gpGraphicsDeviceFirst = NULL
 
static PGRAPHICS_DEVICE gpGraphicsDeviceLast = NULL
 
static HSEMAPHORE ghsemGraphicsDeviceList
 
static ULONG giDevNum = 1
 
_In_ DWORD dwIoControlCode
 

Macro Definition Documentation

◆ READ

#define READ (   field,
  str 
)
Value:
{ \
NULL, \
RTL_QUERY_REGISTRY_DIRECT, \
L ##str, \
&pdm->field, \
REG_NONE, NULL, 0 \
},
const WCHAR * str
#define NULL
Definition: types.h:112

Function Documentation

◆ _In_reads_()

_In_ DWORD _In_reads_ ( nInBufferSize  )

Definition at line 608 of file device.c.

613 {
615  KEVENT Event;
616  PIRP pIrp;
619 
620  /* Get corresponding device object */
622  if (!pDeviceObject)
623  {
625  }
626 
627  /* Initialize an event */
629 
630  /* Build IO control IRP */
633  lpInBuffer,
634  (ULONG)nInBufferSize,
635  lpOutBuffer,
636  (ULONG)nOutBufferSize,
637  FALSE,
638  &Event,
639  &Iosb);
640  if (!pIrp)
641  {
643  }
644 
645  /* Call the driver */
647 
648  /* Wait if neccessary */
649  if (Status == STATUS_PENDING)
650  {
652  Status = Iosb.Status;
653  }
654 
655  /* Return information to the caller about the operation. */
656  *lpInformation = Iosb.Information;
657 
658  /* This function returns NTSTATUS */
659  return Status;
660 }
_In_ PNDIS_STRING _In_ PNDIS_STRING _Out_ PDEVICE_OBJECT * pDeviceObject
Definition: ndis.h:4679
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define TRUE
Definition: types.h:120
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
PDEVICE_OBJECT NTAPI IoGetRelatedDeviceObject(IN PFILE_OBJECT FileObject)
Definition: device.c:1539
FxIrp * pIrp
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 FALSE
Definition: types.h:117
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:467
_In_ DWORD dwIoControlCode
Definition: device.c:607
Status
Definition: gdiplustypes.h:24
return Iosb
Definition: create.c:4402
#define STATUS_PENDING
Definition: ntstatus.h:82
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218
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
unsigned int ULONG
Definition: retypes.h:1

◆ _Success_() [1/2]

_Success_ ( return >=  0)

◆ _Success_() [2/2]

_Success_ ( return  = =0)

Definition at line 665 of file device.c.

676 {
677  PIRP Irp;
679  KEVENT Event;
682 
683  TRACE("EngDeviceIoControl() called\n");
684 
685  if (!hDevice)
686  {
687  return ERROR_INVALID_HANDLE;
688  }
689 
691 
692  DeviceObject = (PDEVICE_OBJECT) hDevice;
693 
695  DeviceObject,
696  lpInBuffer,
698  lpOutBuffer,
700  FALSE,
701  &Event,
702  &Iosb);
703  if (!Irp) return ERROR_NOT_ENOUGH_MEMORY;
704 
706 
707  if (Status == STATUS_PENDING)
708  {
710  Status = Iosb.Status;
711  }
712 
713  TRACE("EngDeviceIoControl(): Returning %X/%X\n", Iosb.Status,
714  Iosb.Information);
715 
716  /* Return information to the caller about the operation. */
717  *lpBytesReturned = (DWORD)Iosb.Information;
718 
719  /* Convert NT status values to win32 error codes. */
720  switch (Status)
721  {
724 
726  return ERROR_MORE_DATA;
727 
729  return ERROR_INVALID_FUNCTION;
730 
733 
736 
738  return ERROR_DEV_NOT_EXIST;
739 
740  case STATUS_PENDING:
741  return ERROR_IO_PENDING;
742  }
743 
744  return Status;
745 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define STATUS_DEVICE_DOES_NOT_EXIST
Definition: ntstatus.h:428
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ DWORD _In_ DWORD _In_ DWORD cjOutBufferSize
Definition: winddi.h:1704
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
#define TRUE
Definition: types.h:120
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
struct _DEVICE_OBJECT * PDEVICE_OBJECT
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
LONG NTSTATUS
Definition: precomp.h:26
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#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
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
return STATUS_NOT_IMPLEMENTED
#define FALSE
Definition: types.h:117
_In_ PIRP Irp
Definition: csq.h:116
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:467
_In_ DWORD _In_ DWORD cjInBufferSize
Definition: winddi.h:1702
switch(r->id)
Definition: btrfs.c:3015
_In_ DWORD dwIoControlCode
Definition: device.c:607
Status
Definition: gdiplustypes.h:24
#define TRACE(s)
Definition: solgame.cpp:4
return Iosb
Definition: create.c:4402
#define STATUS_PENDING
Definition: ntstatus.h:82
#define VOID
Definition: acefi.h:82
#define ERROR_MORE_DATA
Definition: dderror.h:13
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
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
#define ERROR_DEV_NOT_EXIST
Definition: dderror.h:8
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

◆ DBG_DEFAULT_CHANNEL()

DBG_DEFAULT_CHANNEL ( EngDev  )

◆ EngFileWrite()

VOID APIENTRY EngFileWrite ( _In_ PFILE_OBJECT  pFileObject,
_In_reads_(nLength) PVOID  lpBuffer,
_In_ SIZE_T  nLength,
_Out_ PSIZE_T  lpBytesWritten 
)

Definition at line 582 of file device.c.

587 {
589 
590  status = EngpFileIoRequest(pFileObject,
591  IRP_MJ_WRITE,
592  lpBuffer,
593  nLength,
594  0,
595  lpBytesWritten);
596  if (!NT_SUCCESS(status))
597  {
598  *lpBytesWritten = 0;
599  }
600 }
LONG NTSTATUS
Definition: precomp.h:26
_In_ DWORD nLength
Definition: wincon.h:473
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:175
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define IRP_MJ_WRITE
Definition: rdpdr.c:47
static SERVICE_STATUS status
Definition: service.c:31
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:524
Definition: ps.c:97

◆ EngpFileIoRequest()

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 
)
static

Definition at line 524 of file device.c.

531 {
533  KEVENT Event;
534  PIRP pIrp;
537  LARGE_INTEGER liStartOffset;
538 
539  /* Get corresponding device object */
541  if (!pDeviceObject)
542  {
544  }
545 
546  /* Initialize an event */
548 
549  /* Build IRP */
550  liStartOffset.QuadPart = ullStartOffset;
551  pIrp = IoBuildSynchronousFsdRequest(ulMajorFunction,
553  lpBuffer,
554  (ULONG)nBufferSize,
555  &liStartOffset,
556  &Event,
557  &Iosb);
558  if (!pIrp)
559  {
561  }
562 
563  /* Call the driver */
565 
566  /* Wait if neccessary */
567  if (STATUS_PENDING == Status)
568  {
570  Status = Iosb.Status;
571  }
572 
573  /* Return information to the caller about the operation. */
574  *lpInformation = Iosb.Information;
575 
576  /* Return NTSTATUS */
577  return Status;
578 }
_In_ PNDIS_STRING _In_ PNDIS_STRING _Out_ PDEVICE_OBJECT * pDeviceObject
Definition: ndis.h:4679
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
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 TRUE
Definition: types.h:120
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
PDEVICE_OBJECT NTAPI IoGetRelatedDeviceObject(IN PFILE_OBJECT FileObject)
Definition: device.c:1539
FxIrp * pIrp
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 FALSE
Definition: types.h:117
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:175
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:467
Status
Definition: gdiplustypes.h:24
return Iosb
Definition: create.c:4402
#define STATUS_PENDING
Definition: ntstatus.h:82
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218
unsigned int ULONG
Definition: retypes.h:1
LONGLONG QuadPart
Definition: typedefs.h:114

Referenced by EngFileWrite().

◆ EngpFindGraphicsDevice()

PGRAPHICS_DEVICE NTAPI EngpFindGraphicsDevice ( _In_opt_ PUNICODE_STRING  pustrDevice,
_In_ ULONG  iDevNum 
)

Definition at line 469 of file device.c.

472 {
473  UNICODE_STRING ustrCurrent;
474  PGRAPHICS_DEVICE pGraphicsDevice;
475  ULONG i;
476  TRACE("EngpFindGraphicsDevice('%wZ', %lu)\n",
477  pustrDevice, iDevNum);
478 
479  /* Lock list */
481 
482  if (pustrDevice && pustrDevice->Buffer)
483  {
484  /* Find specified video adapter by name */
485  for (pGraphicsDevice = gpGraphicsDeviceFirst;
486  pGraphicsDevice;
487  pGraphicsDevice = pGraphicsDevice->pNextGraphicsDevice)
488  {
489  /* Compare the device name */
490  RtlInitUnicodeString(&ustrCurrent, pGraphicsDevice->szWinDeviceName);
491  if (RtlEqualUnicodeString(&ustrCurrent, pustrDevice, FALSE))
492  {
493  break;
494  }
495  }
496 
497  if (pGraphicsDevice)
498  {
499  /* Validate selected monitor number */
500 #if 0
501  if (iDevNum >= pGraphicsDevice->dwMonCnt)
502  pGraphicsDevice = NULL;
503 #else
504  /* FIXME: dwMonCnt not initialized, see EngpRegisterGraphicsDevice */
505 #endif
506  }
507  }
508  else
509  {
510  /* Select video adapter by device number */
511  for (pGraphicsDevice = gpGraphicsDeviceFirst, i = 0;
512  pGraphicsDevice && i < iDevNum;
513  pGraphicsDevice = pGraphicsDevice->pNextGraphicsDevice, i++);
514  }
515 
516  /* Unlock list */
518 
519  return pGraphicsDevice;
520 }
VOID WINAPI EngReleaseSemaphore(IN HSEMAPHORE hsem)
Definition: eng.c:235
WCHAR szWinDeviceName[CCHDEVICENAME/2]
Definition: pdevobj.h:60
#define FALSE
Definition: types.h:117
static PGRAPHICS_DEVICE gpGraphicsDeviceFirst
Definition: device.c:18
ENGAPI VOID APIENTRY EngAcquireSemaphore(_Inout_ HSEMAPHORE hsem)
#define TRACE(s)
Definition: solgame.cpp:4
struct _GRAPHICS_DEVICE * pNextGraphicsDevice
Definition: pdevobj.h:61
static HSEMAPHORE ghsemGraphicsDeviceList
Definition: device.c:20
DWORD dwMonCnt
Definition: pdevobj.h:73
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
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSYSAPI BOOLEAN NTAPI RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive)

Referenced by co_IntInitializeDesktopGraphics(), EngpUpdateGraphicsDeviceList(), MDEVOBJ_Create(), PDEVOBJ_lChangeDisplaySettings(), UserEnumDisplayDevices(), and UserEnumDisplaySettings().

◆ EngpGetDisplayDriverAccelerationLevel()

DWORD EngpGetDisplayDriverAccelerationLevel ( _In_ PGRAPHICS_DEVICE  pGraphicsDevice)

Definition at line 214 of file device.c.

216 {
217  HKEY hKey;
218  DWORD dwAccelerationLevel = 0;
219  RTL_QUERY_REGISTRY_TABLE DisplaySettingsTable[] =
220  {
221  {
222  NULL,
224  L"Acceleration.Level",
225  &dwAccelerationLevel,
226  REG_NONE, NULL, 0
227  },
228  {0}
229  };
230 
231  hKey = EngpGetRegistryHandleFromDeviceMap(pGraphicsDevice);
232  if (!hKey)
233  return 0;
234 
236  (PWSTR)hKey,
237  DisplaySettingsTable,
238  NULL,
239  NULL);
240  ZwClose(hKey);
241 
242  return dwAccelerationLevel;
243 }
NTSYSAPI NTSTATUS WINAPI RtlQueryRegistryValues(ULONG, PCWSTR, PRTL_QUERY_REGISTRY_TABLE, PVOID, PVOID)
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
uint16_t * PWSTR
Definition: typedefs.h:56
static HKEY EngpGetRegistryHandleFromDeviceMap(_In_ PGRAPHICS_DEVICE pGraphicsDevice)
Definition: device.c:130
#define L(x)
Definition: ntvdm.h:50
unsigned long DWORD
Definition: ntddk_ex.h:95
#define RTL_REGISTRY_HANDLE
Definition: nt_native.h:168
FxAutoRegKey hKey
#define NULL
Definition: types.h:112
#define REG_NONE
Definition: nt_native.h:1492
#define RTL_QUERY_REGISTRY_DIRECT
Definition: nt_native.h:144

Referenced by MDEVOBJ_Create().

◆ EngpGetDisplayDriverParameters()

NTSTATUS EngpGetDisplayDriverParameters ( _In_ PGRAPHICS_DEVICE  pGraphicsDevice,
_Out_ PDEVMODEW  pdm 
)

Definition at line 168 of file device.c.

171 {
172  HKEY hKey;
174  RTL_QUERY_REGISTRY_TABLE DisplaySettingsTable[] =
175  {
176 #define READ(field, str) \
177  { \
178  NULL, \
179  RTL_QUERY_REGISTRY_DIRECT, \
180  L ##str, \
181  &pdm->field, \
182  REG_NONE, NULL, 0 \
183  },
184  READ(dmBitsPerPel, "DefaultSettings.BitsPerPel")
185  READ(dmPelsWidth, "DefaultSettings.XResolution")
186  READ(dmPelsHeight, "DefaultSettings.YResolution")
187  READ(dmDisplayFlags, "DefaultSettings.Flags")
188  READ(dmDisplayFrequency, "DefaultSettings.VRefresh")
189  READ(dmPanningWidth, "DefaultSettings.XPanning")
190  READ(dmPanningHeight, "DefaultSettings.YPanning")
191  READ(dmDisplayOrientation, "DefaultSettings.Orientation")
192  READ(dmDisplayFixedOutput, "DefaultSettings.FixedOutput")
193  READ(dmPosition.x, "Attach.RelativeX")
194  READ(dmPosition.y, "Attach.RelativeY")
195 #undef READ
196  {0}
197  };
198 
199  hKey = EngpGetRegistryHandleFromDeviceMap(pGraphicsDevice);
200  if (!hKey)
201  return STATUS_UNSUCCESSFUL;
202 
204  (PWSTR)hKey,
205  DisplaySettingsTable,
206  NULL,
207  NULL);
208 
209  ZwClose(hKey);
210  return Status;
211 }
NTSYSAPI NTSTATUS WINAPI RtlQueryRegistryValues(ULONG, PCWSTR, PRTL_QUERY_REGISTRY_TABLE, PVOID, PVOID)
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
uint16_t * PWSTR
Definition: typedefs.h:56
LONG NTSTATUS
Definition: precomp.h:26
static HKEY EngpGetRegistryHandleFromDeviceMap(_In_ PGRAPHICS_DEVICE pGraphicsDevice)
Definition: device.c:130
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
Status
Definition: gdiplustypes.h:24
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define READ(field, str)
#define RTL_REGISTRY_HANDLE
Definition: nt_native.h:168
FxAutoRegKey hKey
#define NULL
Definition: types.h:112
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

Referenced by LDEVOBJ_bProbeAndCaptureDevmode().

◆ EngpGetRegistryHandleFromDeviceMap()

static HKEY EngpGetRegistryHandleFromDeviceMap ( _In_ PGRAPHICS_DEVICE  pGraphicsDevice)
static

Definition at line 130 of file device.c.

132 {
133  static const PWCHAR KEY_VIDEO = L"\\Registry\\Machine\\HARDWARE\\DEVICEMAP\\VIDEO";
134  HKEY hKey;
135  WCHAR szDeviceKey[256];
136  ULONG cbSize;
138 
139  /* Open the device map registry key */
141  if (!NT_SUCCESS(Status))
142  {
143  ERR("Could not open HARDWARE\\DEVICEMAP\\VIDEO registry key: status 0x%08x\n", Status);
144  return NULL;
145  }
146 
147  /* Query the registry path */
148  cbSize = sizeof(szDeviceKey);
150  pGraphicsDevice->szNtDeviceName,
151  REG_SZ,
152  szDeviceKey,
153  &cbSize);
154  ZwClose(hKey);
155 
156  /* Open the registry key */
157  Status = RegOpenKey(szDeviceKey, &hKey);
158  if (!NT_SUCCESS(Status))
159  {
160  ERR("Could not open registry key '%S': status 0x%08x\n", szDeviceKey, Status);
161  return NULL;
162  }
163 
164  return hKey;
165 }
static const PWCHAR KEY_VIDEO
Definition: display.c:15
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
LONG NTSTATUS
Definition: precomp.h:26
uint16_t * PWCHAR
Definition: typedefs.h:56
#define L(x)
Definition: ntvdm.h:50
Status
Definition: gdiplustypes.h:24
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ERR(fmt,...)
Definition: debug.h:110
FxAutoRegKey hKey
#define NULL
Definition: types.h:112
#define RegQueryValue
Definition: winreg.h:523
unsigned int ULONG
Definition: retypes.h:1
#define RegOpenKey
Definition: winreg.h:519
#define REG_SZ
Definition: layer.c:22

Referenced by EngpGetDisplayDriverAccelerationLevel(), and EngpGetDisplayDriverParameters().

◆ EngpRegisterGraphicsDevice()

PGRAPHICS_DEVICE NTAPI EngpRegisterGraphicsDevice ( _In_ PUNICODE_STRING  pustrDeviceName,
_In_ PUNICODE_STRING  pustrDiplayDrivers,
_In_ PUNICODE_STRING  pustrDescription 
)

Definition at line 311 of file device.c.

315 {
316  PGRAPHICS_DEVICE pGraphicsDevice;
318  PFILE_OBJECT pFileObject;
320  VIDEO_WIN32K_CALLBACKS Win32kCallbacks;
321  ULONG ulReturn;
322  PWSTR pwsz;
323  ULONG cj;
324 
325  TRACE("EngpRegisterGraphicsDevice(%wZ)\n", pustrDeviceName);
326 
327  /* Allocate a GRAPHICS_DEVICE structure */
328  pGraphicsDevice = ExAllocatePoolWithTag(PagedPool,
329  sizeof(GRAPHICS_DEVICE),
331  if (!pGraphicsDevice)
332  {
333  ERR("ExAllocatePoolWithTag failed\n");
334  return NULL;
335  }
336 
337  /* Try to open and enable the device */
338  Status = IoGetDeviceObjectPointer(pustrDeviceName,
340  &pFileObject,
341  &pDeviceObject);
342  if (!NT_SUCCESS(Status))
343  {
344  ERR("Could not open device %wZ, 0x%lx\n", pustrDeviceName, Status);
345  ExFreePoolWithTag(pGraphicsDevice, GDITAG_GDEVICE);
346  return NULL;
347  }
348 
349  /* Copy the device and file object pointers */
350  pGraphicsDevice->DeviceObject = pDeviceObject;
351  pGraphicsDevice->FileObject = pFileObject;
352 
353  /* Initialize and register the device with videoprt for Win32k callbacks */
354  Win32kCallbacks.PhysDisp = pGraphicsDevice;
355  Win32kCallbacks.Callout = VideoPortCallout;
356  // Reset the data being returned prior to the call.
357  Win32kCallbacks.bACPI = FALSE;
358  Win32kCallbacks.pPhysDeviceObject = NULL;
359  Win32kCallbacks.DualviewFlags = 0;
360  Status = (NTSTATUS)EngDeviceIoControl((HANDLE)pDeviceObject,
362  &Win32kCallbacks,
363  sizeof(Win32kCallbacks),
364  &Win32kCallbacks,
365  sizeof(Win32kCallbacks),
366  &ulReturn);
367  if (Status != ERROR_SUCCESS)
368  {
369  ERR("EngDeviceIoControl(0x%p, IOCTL_VIDEO_INIT_WIN32K_CALLBACKS) failed, Status 0x%lx\n",
371  }
372  // TODO: Set flags according to the results.
373  // if (Win32kCallbacks.bACPI)
374  // if (Win32kCallbacks.DualviewFlags & ???)
375  pGraphicsDevice->PhysDeviceHandle = Win32kCallbacks.pPhysDeviceObject;
376 
377  /* FIXME: Enumerate children monitor devices for this video adapter
378  *
379  * - Force the adapter to re-enumerate its monitors:
380  * IoSynchronousInvalidateDeviceRelations(pdo, BusRelations)
381  *
382  * - Retrieve all monitor PDOs from VideoPrt:
383  * EngDeviceIoControl(0x%p, IOCTL_VIDEO_ENUM_MONITOR_PDO)
384  *
385  * - Initialize these fields and structures accordingly:
386  * pGraphicsDevice->dwMonCnt
387  * pGraphicsDevice->pvMonDev[0..dwMonCnt-1]
388  */
389 
390  /* Copy the device name */
391  RtlStringCbCopyNW(pGraphicsDevice->szNtDeviceName,
392  sizeof(pGraphicsDevice->szNtDeviceName),
393  pustrDeviceName->Buffer,
394  pustrDeviceName->Length);
395 
396  /* Create a Win32 device name (FIXME: virtual devices!) */
397  RtlStringCbPrintfW(pGraphicsDevice->szWinDeviceName,
398  sizeof(pGraphicsDevice->szWinDeviceName),
399  L"\\\\.\\DISPLAY%d",
400  (int)giDevNum);
401 
402  /* Allocate a buffer for the strings */
403  cj = pustrDiplayDrivers->Length + pustrDescription->Length + sizeof(WCHAR);
405  if (!pwsz)
406  {
407  ERR("Could not allocate string buffer\n");
408  ASSERT(FALSE); // FIXME
409  ExFreePoolWithTag(pGraphicsDevice, GDITAG_GDEVICE);
410  return NULL;
411  }
412 
413  /* Copy the display driver names */
414  pGraphicsDevice->pDiplayDrivers = pwsz;
415  RtlCopyMemory(pGraphicsDevice->pDiplayDrivers,
416  pustrDiplayDrivers->Buffer,
417  pustrDiplayDrivers->Length);
418 
419  /* Copy the description */
420  pGraphicsDevice->pwszDescription = pwsz + pustrDiplayDrivers->Length / sizeof(WCHAR);
421  RtlCopyMemory(pGraphicsDevice->pwszDescription,
422  pustrDescription->Buffer,
423  pustrDescription->Length);
424  pGraphicsDevice->pwszDescription[pustrDescription->Length/sizeof(WCHAR)] = 0;
425 
426  /* Initialize the pdevmodeInfo list */
427  pGraphicsDevice->pdevmodeInfo = NULL;
428 
429  // FIXME: initialize state flags
430  pGraphicsDevice->StateFlags = 0;
431 
432  /* Create the mode list */
433  pGraphicsDevice->pDevModeList = NULL;
434 
435  /* Lock loader */
437 
438  /* Insert the device into the global list */
439  pGraphicsDevice->pNextGraphicsDevice = NULL;
441  gpGraphicsDeviceLast->pNextGraphicsDevice = pGraphicsDevice;
442  gpGraphicsDeviceLast = pGraphicsDevice;
444  gpGraphicsDeviceFirst = pGraphicsDevice;
445 
446  /* Increment the device number */
447  giDevNum++;
448 
449  /* Unlock loader */
451  TRACE("Prepared %lu modes for %ls\n", pGraphicsDevice->cDevModes, pGraphicsDevice->pwszDescription);
452 
453  /* HACK: already in graphic mode; display wallpaper on this new display */
455  {
456  UNICODE_STRING DriverName = RTL_CONSTANT_STRING(L"DISPLAY");
457  UNICODE_STRING DisplayName;
458  HDC hdc;
459  RtlInitUnicodeString(&DisplayName, pGraphicsDevice->szWinDeviceName);
460  hdc = IntGdiCreateDC(&DriverName, &DisplayName, NULL, NULL, FALSE);
462  }
463 
464  return pGraphicsDevice;
465 }
VOID WINAPI EngReleaseSemaphore(IN HSEMAPHORE hsem)
Definition: eng.c:235
_In_ PNDIS_STRING _In_ PNDIS_STRING _Out_ PDEVICE_OBJECT * pDeviceObject
Definition: ndis.h:4679
_In_ ULONG cj
Definition: winddi.h:3540
static PGRAPHICS_DEVICE gpGraphicsDeviceLast
Definition: device.c:19
#define ERROR_SUCCESS
Definition: deptool.c:10
PDEVICE_OBJECT DeviceObject
Definition: pdevobj.h:63
WCHAR szWinDeviceName[CCHDEVICENAME/2]
Definition: pdevobj.h:60
WCHAR szNtDeviceName[CCHDEVICENAME/2]
Definition: pdevobj.h:59
uint16_t * PWSTR
Definition: typedefs.h:56
DWORD StateFlags
Definition: pdevobj.h:66
LONG NTSTATUS
Definition: precomp.h:26
static HDC
Definition: imagelist.c:92
PDEVMODEENTRY pDevModeList
Definition: pdevobj.h:70
NTSTATUS NTAPI IoGetDeviceObjectPointer(IN PUNICODE_STRING ObjectName, IN ACCESS_MASK DesiredAccess, OUT PFILE_OBJECT *FileObject, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1435
IN PVIDEO_WIN32K_CALLOUT Callout
Definition: ntddvdeo.h:263
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h: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
LPWSTR pwszDescription
Definition: pdevobj.h:72
VOID NTAPI VideoPortCallout(_In_ PVOID Params)
Definition: device.c:251
static PGRAPHICS_DEVICE gpGraphicsDeviceFirst
Definition: device.c:18
ENGAPI VOID APIENTRY EngAcquireSemaphore(_Inout_ HSEMAPHORE hsem)
BOOL FASTCALL IntPaintDesktop(HDC hDC)
Definition: desktop.c:1827
#define FILE_WRITE_DATA
Definition: nt_native.h:631
PDEVICE_OBJECT PhysDeviceHandle
Definition: pdevobj.h:64
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
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
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
OUT HANDLE pPhysDeviceObject
Definition: ntddvdeo.h:265
static HSEMAPHORE ghsemGraphicsDeviceList
Definition: device.c:20
* PFILE_OBJECT
Definition: iotypes.h:1998
#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 GDITAG_GDEVICE
Definition: tags.h:99
OUT ULONG DualviewFlags
Definition: ntddvdeo.h:266
#define ERR(fmt,...)
Definition: debug.h:110
static ULONG giDevNum
Definition: device.c:21
HDC FASTCALL IntGdiCreateDC(PUNICODE_STRING Driver, PUNICODE_STRING pustrDevice, PVOID pUMdhpdev, CONST PDEVMODEW pdmInit, BOOL CreateAsIC)
Definition: dclife.c:1040
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
HDC ScreenDeviceContext
Definition: desktop.c:36
PDEVMODEINFO pdevmodeInfo
Definition: pdevobj.h:68
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
PFILE_OBJECT FileObject
Definition: pdevobj.h:75
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14

Referenced by InitDisplayDriver().

◆ EngpUpdateGraphicsDeviceList()

NTSTATUS EngpUpdateGraphicsDeviceList ( VOID  )

Definition at line 36 of file device.c.

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 }
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
DWORD StateFlags
Definition: pdevobj.h:66
_Check_return_ _CRTIMP int __cdecl _wtoi(_In_z_ const wchar_t *_Str)
LONG NTSTATUS
Definition: precomp.h:26
PGRAPHICS_DEVICE gpVgaGraphicsDevice
Definition: device.c:16
PGRAPHICS_DEVICE NTAPI InitDisplayDriver(IN PWSTR pwszDeviceName, IN PWSTR pwszRegKey)
Definition: display.c:66
PGRAPHICS_DEVICE gpPrimaryGraphicsDevice
Definition: device.c:15
#define L(x)
Definition: ntvdm.h:50
Status
Definition: gdiplustypes.h:24
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
BOOL NTAPI RegReadDWORD(HKEY hkey, PWSTR pwszValue, PDWORD pdwData)
Definition: registry.c:150
PGRAPHICS_DEVICE NTAPI EngpFindGraphicsDevice(_In_opt_ PUNICODE_STRING pustrDevice, _In_ ULONG iDevNum)
Definition: device.c:469
int _cdecl swprintf(const WCHAR *,...)
#define ERR(fmt,...)
Definition: debug.h:110
#define NULL
Definition: types.h:112
#define DISPLAY_DEVICE_VGA_COMPATIBLE
Definition: wingdi.h:1400
#define RegQueryValue
Definition: winreg.h:523
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define STATUS_SUCCESS
Definition: shellext.h:65
#define RegOpenKey
Definition: winreg.h:519
#define REG_SZ
Definition: layer.c:22

Referenced by InitVideo(), and UserEnumDisplayDevices().

◆ InitDeviceImpl()

NTSTATUS NTAPI InitDeviceImpl ( VOID  )

Definition at line 26 of file device.c.

27 {
31 
32  return STATUS_SUCCESS;
33 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
static HSEMAPHORE ghsemGraphicsDeviceList
Definition: device.c:20
HSEMAPHORE WINAPI EngCreateSemaphore(VOID)
Definition: eng.c:75
#define STATUS_SUCCESS
Definition: shellext.h:65

Referenced by DriverEntry().

◆ UserRefreshDisplay()

VOID UserRefreshDisplay ( IN PPDEVOBJ  ppdev)

Definition at line 193 of file display.c.

194 {
195  ULONG_PTR ulResult;
196  // PVOID pvOldCursor;
197 
198  // TODO: Re-enable the cursor reset code once this function becomes called
199  // from within a Win32 thread... Indeed UserSetCursor() requires this, but
200  // at the moment this function is directly called from a separate thread
201  // from within videoprt, instead of by a separate win32k system thread.
202 
203  if (!ppdev)
204  return;
205 
206  PDEVOBJ_vReference(ppdev);
207 
208  /* Remove mouse pointer */
209  // pvOldCursor = UserSetCursor(NULL, TRUE);
210 
211  /* Do the mode switch -- Use the actual same current mode */
212  ulResult = PDEVOBJ_bSwitchMode(ppdev, ppdev->pdmwDev);
213  ASSERT(ulResult);
214 
215  /* Restore mouse pointer, no hooks called */
216  // pvOldCursor = UserSetCursor(pvOldCursor, TRUE);
217  // ASSERT(pvOldCursor == NULL);
218 
219  /* Update the system metrics */
220  InitMetrics();
221 
222  /* Set new size of the monitor */
223  // UserUpdateMonitorSize((HDEV)ppdev);
224 
225  //co_IntShowDesktop(pdesk, ppdev->gdiinfo.ulHorzRes, ppdev->gdiinfo.ulVertRes);
227 
228  PDEVOBJ_vRelease(ppdev);
229 }
BOOL NTAPI PDEVOBJ_bSwitchMode(PPDEVOBJ ppdev, PDEVMODEW pdm)
Definition: pdevobj.c:640
FORCEINLINE VOID PDEVOBJ_vReference(_In_ PPDEVOBJ ppdev)
Definition: pdevobj.h:161
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define ASSERT(a)
Definition: mode.c:44
BOOL NTAPI InitMetrics(VOID)
Definition: metric.c:33
VOID APIENTRY UserRedrawDesktop(VOID)
Definition: desktop.c:1599
VOID NTAPI PDEVOBJ_vRelease(_Inout_ PPDEVOBJ ppdev)
Definition: pdevobj.c:104

Referenced by VideoPortCallout().

◆ VideoPortCallout()

VOID NTAPI VideoPortCallout ( _In_ PVOID  Params)

Definition at line 251 of file device.c.

253 {
254 /*
255  * IMPORTANT NOTICE!! On Windows XP/2003 this function triggers the creation of
256  * a specific VideoPortCalloutThread() system thread using the same mechanism
257  * as the RIT/desktop/Ghost system threads.
258  */
259 
261 
262  TRACE("VideoPortCallout(0x%p, 0x%x)\n",
263  CallbackParams, CallbackParams ? CallbackParams->CalloutType : -1);
264 
265  if (!CallbackParams)
266  return;
267 
268  switch (CallbackParams->CalloutType)
269  {
271  {
272  TRACE("VideoPortCallout: VideoFindAdapterCallout called - Param = %s\n",
273  CallbackParams->Param ? "TRUE" : "FALSE");
274  if (CallbackParams->Param == TRUE)
275  {
276  /* Re-enable the display */
278  }
279  else
280  {
281  /* Disable the display */
282  NOTHING; // Nothing to do for the moment...
283  }
284 
285  CallbackParams->Status = STATUS_SUCCESS;
286  break;
287  }
288 
292  case VideoWakeupCallout:
298  ERR("VideoPortCallout: CalloutType 0x%x is UNIMPLEMENTED!\n", CallbackParams->CalloutType);
299  CallbackParams->Status = STATUS_NOT_IMPLEMENTED;
300  break;
301 
302  default:
303  ERR("VideoPortCallout: Unknown CalloutType 0x%x\n", CallbackParams->CalloutType);
304  CallbackParams->Status = STATUS_UNSUCCESSFUL;
305  break;
306  }
307 }
_In_ WDFIOTARGET _In_ PWDF_REQUEST_COMPLETION_PARAMS Params
Definition: wdfrequest.h:306
VIDEO_WIN32K_CALLBACKS_PARAMS_TYPE CalloutType
Definition: ntddvdeo.h:250
#define TRUE
Definition: types.h:120
VOID UserRefreshDisplay(IN PPDEVOBJ ppdev)
Definition: display.c:193
return STATUS_NOT_IMPLEMENTED
#define TRACE(s)
Definition: solgame.cpp:4
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
struct _VIDEO_WIN32K_CALLBACKS_PARAMS * PVIDEO_WIN32K_CALLBACKS_PARAMS
#define NOTHING
Definition: env_spec_w32.h:461
#define ERR(fmt,...)
Definition: debug.h:110
PPDEVOBJ ppdevGlobal
Definition: mdevobj.h:16
PMDEVOBJ gpmdev
Definition: mdevobj.c:14
#define STATUS_SUCCESS
Definition: shellext.h:65

Referenced by EngpRegisterGraphicsDevice().

Variable Documentation

◆ dwIoControlCode

_In_ DWORD dwIoControlCode

Definition at line 607 of file device.c.

Referenced by _In_reads_(), and _Success_().

◆ ghsemGraphicsDeviceList

HSEMAPHORE ghsemGraphicsDeviceList
static

Definition at line 20 of file device.c.

Referenced by EngpFindGraphicsDevice(), EngpRegisterGraphicsDevice(), and InitDeviceImpl().

◆ giDevNum

ULONG giDevNum = 1
static

Definition at line 21 of file device.c.

Referenced by EngpRegisterGraphicsDevice().

◆ gpGraphicsDeviceFirst

PGRAPHICS_DEVICE gpGraphicsDeviceFirst = NULL
static

Definition at line 18 of file device.c.

Referenced by EngpFindGraphicsDevice(), and EngpRegisterGraphicsDevice().

◆ gpGraphicsDeviceLast

PGRAPHICS_DEVICE gpGraphicsDeviceLast = NULL
static

Definition at line 19 of file device.c.

Referenced by EngpRegisterGraphicsDevice().

◆ gpPrimaryGraphicsDevice

PGRAPHICS_DEVICE gpPrimaryGraphicsDevice

◆ gpVgaGraphicsDevice

PGRAPHICS_DEVICE gpVgaGraphicsDevice

Definition at line 16 of file device.c.

Referenced by EngpUpdateGraphicsDeviceList(), and InitVideo().