ReactOS  0.4.15-dev-1187-g119f102
device.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define TAG_GDEV   'gdev'
 

Functions

VOID NTAPI PDEVOBJ_vRefreshModeList (PPDEVOBJ ppdev)
 
VOID APIENTRY EngFileWrite (_In_ PFILE_OBJECT pFileObject, _In_reads_(nLength) PVOID lpBuffer, _In_ SIZE_T nLength, _Out_ PSIZE_T lpBytesWritten)
 
PGRAPHICS_DEVICE NTAPI EngpFindGraphicsDevice (_In_opt_ PUNICODE_STRING pustrDevice, _In_ ULONG iDevNum, _In_ DWORD dwFlags)
 
PGRAPHICS_DEVICE NTAPI EngpRegisterGraphicsDevice (_In_ PUNICODE_STRING pustrDeviceName, _In_ PUNICODE_STRING pustrDiplayDrivers, _In_ PUNICODE_STRING pustrDescription, _In_ PDEVMODEW pdmDefault)
 
BOOLEAN EngpPopulateDeviceModeList (_Inout_ PGRAPHICS_DEVICE pGraphicsDevice, _In_ PDEVMODEW pdmDefault)
 
INIT_FUNCTION NTSTATUS NTAPI InitDeviceImpl (VOID)
 

Variables

PGRAPHICS_DEVICE gpPrimaryGraphicsDevice
 
PGRAPHICS_DEVICE gpVgaGraphicsDevice
 

Macro Definition Documentation

◆ TAG_GDEV

#define TAG_GDEV   'gdev'

Definition at line 4 of file device.h.

Function Documentation

◆ EngFileWrite()

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

Definition at line 472 of file device.c.

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 }
LONG NTSTATUS
Definition: precomp.h:26
_In_ DWORD nLength
Definition: wincon.h:476
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:173
#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:414
Definition: ps.c:97

◆ EngpFindGraphicsDevice()

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

Definition at line 369 of file device.c.

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 }
VOID WINAPI EngReleaseSemaphore(IN HSEMAPHORE hsem)
Definition: eng.c:235
WCHAR szWinDeviceName[CCHDEVICENAME/2]
Definition: pdevobj.h:60
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 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
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
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 EngpCreatePDEV(), UserEnumDisplayDevices(), and UserEnumDisplaySettings().

◆ EngpPopulateDeviceModeList()

BOOLEAN EngpPopulateDeviceModeList ( _Inout_ PGRAPHICS_DEVICE  pGraphicsDevice,
_In_ PDEVMODEW  pdmDefault 
)

Definition at line 36 of file device.c.

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 }
signed char * PCHAR
Definition: retypes.h:7
NTSTRSAFEAPI RtlStringCbCopyW(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cbDest, _In_ NTSTRSAFE_PCWSTR pszSrc)
Definition: ntstrsafe.h:174
struct _devicemodeW * PDEVMODEW
PDEVMODEINFO NTAPI LDEVOBJ_pdmiGetModes(_In_ PLDEVOBJ pldev, _In_ HANDLE hDriver)
Definition: ldevobj.c:116
#define TRUE
Definition: types.h:120
uint16_t * PWSTR
Definition: typedefs.h:56
WORD dmDriverExtra
Definition: wingdi.h:1620
DWORD dmBitsPerPel
Definition: wingdi.h:1646
PLDEVOBJ NTAPI EngLoadImageEx(_In_z_ LPWSTR pwszDriverName, _In_ ULONG ldevtype)
Definition: ldevobj.c:328
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 FALSE
Definition: types.h:117
ULONG cbdevmode
Definition: pdevobj.h:46
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
DEVMODEW adevmode[1]
Definition: pdevobj.h:47
#define TRACE(s)
Definition: solgame.cpp:4
struct _DEVMODEINFO * pdmiNext
Definition: pdevobj.h:44
WORD dmSize
Definition: wingdi.h:1619
WCHAR dmDeviceName[CCHDEVICENAME]
Definition: wingdi.h:1616
DWORD dmPelsWidth
Definition: wingdi.h:1647
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define GDITAG_GDEVICE
Definition: tags.h:98
#define ERR(fmt,...)
Definition: debug.h:110
DWORD dmDisplayFrequency
Definition: wingdi.h:1653
DWORD dmPelsHeight
Definition: wingdi.h:1648
unsigned int ULONG
Definition: retypes.h:1
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)

Referenced by EngpRegisterGraphicsDevice(), and PDEVOBJ_vRefreshModeList().

◆ EngpRegisterGraphicsDevice()

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

Definition at line 227 of file device.c.

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 }
BOOLEAN EngpPopulateDeviceModeList(_Inout_ PGRAPHICS_DEVICE pGraphicsDevice, _In_ PDEVMODEW pdmDefault)
Definition: device.c:36
VOID WINAPI EngReleaseSemaphore(IN HSEMAPHORE hsem)
Definition: eng.c:235
_In_ PNDIS_STRING _In_ PNDIS_STRING _Out_ PDEVICE_OBJECT * pDeviceObject
Definition: ndis.h:4679
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
_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
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:262
#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:167
static PGRAPHICS_DEVICE gpGraphicsDeviceFirst
Definition: device.c:18
ENGAPI VOID APIENTRY EngAcquireSemaphore(_Inout_ HSEMAPHORE hsem)
smooth NULL
Definition: ftsmooth.c:416
#define FILE_WRITE_DATA
Definition: nt_native.h:631
#define TRACE(s)
Definition: solgame.cpp:4
struct _GRAPHICS_DEVICE * pNextGraphicsDevice
Definition: pdevobj.h:61
__wchar_t WCHAR
Definition: xmlstorage.h:180
ULONG iCurrentMode
Definition: pdevobj.h:78
#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:264
static HSEMAPHORE ghsemGraphicsDeviceList
Definition: device.c:20
* PFILE_OBJECT
Definition: iotypes.h:1978
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
Status
Definition: gdiplustypes.h:24
static const WCHAR L[]
Definition: oid.c:1250
#define NTSTATUS
Definition: precomp.h:20
#define GDITAG_DRVSUP
Definition: tags.h:76
#define GDITAG_GDEVICE
Definition: tags.h:98
OUT ULONG DualviewFlags
Definition: ntddvdeo.h:265
#define ERR(fmt,...)
Definition: debug.h:110
static ULONG giDevNum
Definition: device.c:21
unsigned int ULONG
Definition: retypes.h:1
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
PDEVMODEINFO pdevmodeInfo
Definition: pdevobj.h:68
ULONG iDefaultMode
Definition: pdevobj.h:77
PFILE_OBJECT FileObject
Definition: pdevobj.h:75

Referenced by InitDisplayDriver().

◆ InitDeviceImpl()

INIT_FUNCTION 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
return STATUS_SUCCESS
Definition: btrfs.c:3014

Referenced by DriverEntry().

◆ PDEVOBJ_vRefreshModeList()

VOID NTAPI PDEVOBJ_vRefreshModeList ( PPDEVOBJ  ppdev)

Definition at line 264 of file pdevobj.c.

266 {
267  PGRAPHICS_DEVICE pGraphicsDevice;
268  PDEVMODEINFO pdminfo, pdmiNext;
269  DEVMODEW dmDefault;
270  DEVMODEW dmCurrent;
271 
272  /* Lock the PDEV */
274 
275  pGraphicsDevice = ppdev->pGraphicsDevice;
276 
277  /* Remember our default mode */
278  dmDefault = *pGraphicsDevice->pDevModeList[pGraphicsDevice->iDefaultMode].pdm;
279  dmCurrent = *ppdev->pdmwDev;
280 
281  /* Clear out the modes */
282  for (pdminfo = pGraphicsDevice->pdevmodeInfo;
283  pdminfo;
284  pdminfo = pdmiNext)
285  {
286  pdmiNext = pdminfo->pdmiNext;
288  }
289  pGraphicsDevice->pdevmodeInfo = NULL;
290  ExFreePoolWithTag(pGraphicsDevice->pDevModeList, GDITAG_GDEVICE);
291  pGraphicsDevice->pDevModeList = NULL;
292 
293  /* Now re-populate the list */
294  if (!EngpPopulateDeviceModeList(pGraphicsDevice, &dmDefault))
295  {
296  DPRINT1("FIXME: EngpPopulateDeviceModeList failed, we just destroyed a perfectly good mode list\n");
297  }
298 
299  ppdev->pdmwDev = PDEVOBJ_pdmMatchDevMode(ppdev, &dmCurrent);
300 
301  /* Unlock PDEV */
303 }
BOOLEAN EngpPopulateDeviceModeList(_Inout_ PGRAPHICS_DEVICE pGraphicsDevice, _In_ PDEVMODEW pdmDefault)
Definition: device.c:36
VOID WINAPI EngReleaseSemaphore(IN HSEMAPHORE hsem)
Definition: eng.c:235
#define GDITAG_DEVMODE
Definition: tags.h:73
PDEVMODEENTRY pDevModeList
Definition: pdevobj.h:70
PDEVMODEW pdm
Definition: pdevobj.h:53
ENGAPI VOID APIENTRY EngAcquireSemaphore(_Inout_ HSEMAPHORE hsem)
smooth NULL
Definition: ftsmooth.c:416
PDEVMODEW pdmwDev
Definition: pdevobj.h:130
HSEMAPHORE hsemDevLock
Definition: pdevobj.h:91
struct _DEVMODEINFO * pdmiNext
Definition: pdevobj.h:44
PDEVMODEW NTAPI PDEVOBJ_pdmMatchDevMode(PPDEVOBJ ppdev, PDEVMODEW pdm)
Definition: pdevobj.c:307
#define GDITAG_GDEVICE
Definition: tags.h:98
#define DPRINT1
Definition: precomp.h:8
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
PDEVMODEINFO pdevmodeInfo
Definition: pdevobj.h:68
PGRAPHICS_DEVICE pGraphicsDevice
Definition: pdevobj.h:128
ULONG iDefaultMode
Definition: pdevobj.h:77

Referenced by UserEnumDisplaySettings().

Variable Documentation

◆ gpPrimaryGraphicsDevice

PGRAPHICS_DEVICE gpPrimaryGraphicsDevice

Definition at line 15 of file device.c.

Referenced by EngpCreatePDEV(), and InitVideo().

◆ gpVgaGraphicsDevice

PGRAPHICS_DEVICE gpVgaGraphicsDevice

Definition at line 16 of file device.c.

Referenced by InitVideo().