ReactOS  0.4.15-dev-5146-g069b08d
mdevobj.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _MDEVDISPLAY
 
struct  _MDEVOBJ
 

Typedefs

typedef struct _PDEVOBJPPDEVOBJ
 
typedef struct _MDEVDISPLAY MDEVDISPLAY
 
typedef struct _MDEVDISPLAYPMDEVDISPLAY
 
typedef struct _MDEVOBJ MDEVOBJ
 
typedef struct _MDEVOBJPMDEVOBJ
 

Functions

VOID MDEVOBJ_vEnable (_Inout_ PMDEVOBJ pmdev)
 
BOOL MDEVOBJ_bDisable (_Inout_ PMDEVOBJ pmdev)
 
PMDEVOBJ MDEVOBJ_Create (_In_opt_ PUNICODE_STRING pustrDeviceName, _In_opt_ PDEVMODEW pdm)
 
VOID MDEVOBJ_vDestroy (_Inout_ PMDEVOBJ pmdev)
 

Variables

PMDEVOBJ gpmdev
 

Typedef Documentation

◆ MDEVDISPLAY

◆ MDEVOBJ

◆ PMDEVDISPLAY

◆ PMDEVOBJ

◆ PPDEVOBJ

Definition at line 6 of file mdevobj.h.

Function Documentation

◆ MDEVOBJ_bDisable()

BOOL MDEVOBJ_bDisable ( _Inout_ PMDEVOBJ  pmdev)

Definition at line 29 of file mdevobj.c.

31 {
32  BOOL bSuccess = TRUE;
33  ULONG i, j;
34 
35  for (i = 0; i < pmdev->cDev; i++)
36  {
37  if (!PDEVOBJ_bDisableDisplay(pmdev->dev[i].ppdev))
38  {
39  bSuccess = FALSE;
40  break;
41  }
42  }
43 
44  if (!bSuccess)
45  {
46  /* Failed to disable all PDEVs. Reenable those we have disabled */
47  for (j = 0; j < i; j++)
48  {
49  PDEVOBJ_vEnableDisplay(pmdev->dev[i].ppdev);
50  }
51  }
52 
53  return bSuccess;
54 }
#define TRUE
Definition: types.h:120
static BOOLEAN bSuccess
Definition: drive.cpp:430
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
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 GLint GLint j
Definition: glfuncs.h:250
BOOL PDEVOBJ_bDisableDisplay(_Inout_ PPDEVOBJ ppdev)
Definition: pdevobj.c:360
VOID PDEVOBJ_vEnableDisplay(_Inout_ PPDEVOBJ ppdev)
Definition: pdevobj.c:340
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
unsigned int ULONG
Definition: retypes.h:1

Referenced by PDEVOBJ_lChangeDisplaySettings().

◆ MDEVOBJ_Create()

PMDEVOBJ MDEVOBJ_Create ( _In_opt_ PUNICODE_STRING  pustrDeviceName,
_In_opt_ PDEVMODEW  pdm 
)

Definition at line 57 of file mdevobj.c.

60 {
61  PMDEVOBJ pmdev = NULL;
62  PPDEVOBJ ppdev;
63  PGRAPHICS_DEVICE pGraphicsDevice;
64  DEVMODEW dmDefault;
65  PDEVMODEW localPdm;
66  ULONG iDevNum = 0;
67  ULONG dwAccelerationLevel = 0;
68 
69  TRACE("MDEVOBJ_Create('%wZ' '%dx%dx%d (%d Hz)')\n",
70  pustrDeviceName,
71  pdm ? pdm->dmPelsWidth : 0,
72  pdm ? pdm->dmPelsHeight : 0,
73  pdm ? pdm->dmBitsPerPel : 0,
74  pdm ? pdm->dmDisplayFrequency : 0);
75 
76  pmdev = ExAllocatePoolZero(PagedPool, sizeof(MDEVOBJ) + sizeof(MDEVDISPLAY), GDITAG_MDEV);
77  if (!pmdev)
78  {
79  ERR("Failed to allocate memory for MDEV\n");
80  return NULL;
81  }
82 
83  pmdev->cDev = 0;
84 
85  while (TRUE)
86  {
87  /* Get the right graphics devices: either the specified one, or all of them (one after one) */
88  if (pustrDeviceName)
89  pGraphicsDevice = (iDevNum == 0) ? EngpFindGraphicsDevice(pustrDeviceName, 0) : NULL;
90  else
91  pGraphicsDevice = EngpFindGraphicsDevice(NULL, iDevNum);
92  iDevNum++;
93 
94  if (!pGraphicsDevice)
95  {
96  TRACE("Done enumeration of graphic devices (DeviceName '%wZ' iDevNum %d)\n", pustrDeviceName, iDevNum);
97  break;
98  }
99 
100  if (!pdm)
101  {
102  /* No settings requested. Provide nothing and LDEVOBJ_bProbeAndCaptureDevmode
103  * will read default settings from registry */
104  RtlZeroMemory(&dmDefault, sizeof(dmDefault));
105  dmDefault.dmSize = sizeof(dmDefault);
106  }
107 
108  dwAccelerationLevel = EngpGetDisplayDriverAccelerationLevel(pGraphicsDevice);
109 
110  /* Get or create a PDEV for these settings */
111  if (LDEVOBJ_bProbeAndCaptureDevmode(pGraphicsDevice, pdm ? pdm : &dmDefault, &localPdm, !pdm))
112  {
113  ppdev = PDEVOBJ_Create(pGraphicsDevice, localPdm, dwAccelerationLevel, LDEV_DEVICE_DISPLAY);
114  }
115  else
116  {
117  ppdev = NULL;
118  }
119 
120  if (ppdev)
121  {
122  /* Great. We have a found a matching PDEV. Store it in MDEV */
123  if (pmdev->cDev >= 1)
124  {
125  /* We have to reallocate MDEV to add space for the new display */
126  PMDEVOBJ pmdevBigger = ExAllocatePoolZero(PagedPool, sizeof(MDEVOBJ) + (pmdev->cDev + 1) * sizeof(MDEVDISPLAY), GDITAG_MDEV);
127  if (!pmdevBigger)
128  {
129  WARN("Failed to allocate memory for MDEV. Skipping display '%S'\n", pGraphicsDevice->szWinDeviceName);
130  continue;
131  }
132  else
133  {
134  /* Copy existing data */
135  RtlCopyMemory(pmdevBigger, pmdev, sizeof(MDEVOBJ) + pmdev->cDev * sizeof(MDEVDISPLAY));
137  pmdev = pmdevBigger;
138  }
139  }
140 
141  TRACE("Adding '%S' to MDEV %p\n", pGraphicsDevice->szWinDeviceName, pmdev);
142  PDEVOBJ_vReference(ppdev);
143  pmdev->dev[pmdev->cDev].ppdev = ppdev;
144  pmdev->cDev++;
145  }
146  else
147  {
148  WARN("Failed to add '%S' to MDEV %p\n", pGraphicsDevice->szWinDeviceName, pmdev);
149  }
150  }
151 
152  if (pmdev->cDev == 0)
153  {
154  TRACE("Failed to add any device to MDEV. Returning NULL\n");
155  MDEVOBJ_vDestroy(pmdev);
156  return NULL;
157  }
158 
159  TRACE("Returning new MDEV %p with %d devices\n", pmdev, pmdev->cDev);
160  return pmdev;
161 }
DWORD EngpGetDisplayDriverAccelerationLevel(_In_ PGRAPHICS_DEVICE pGraphicsDevice)
Definition: device.c:214
BOOL LDEVOBJ_bProbeAndCaptureDevmode(_Inout_ PGRAPHICS_DEVICE pGraphicsDevice, _In_ PDEVMODEW RequestedMode, _Out_ PDEVMODEW *pSelectedMode, _In_ BOOL bSearchClosestMode)
Definition: ldevobj.c:735
WCHAR szWinDeviceName[CCHDEVICENAME/2]
Definition: pdevobj.h:60
FORCEINLINE VOID PDEVOBJ_vReference(_In_ PPDEVOBJ ppdev)
Definition: pdevobj.h:161
#define TRUE
Definition: types.h:120
#define WARN(fmt,...)
Definition: debug.h:112
PPDEVOBJ PDEVOBJ_Create(_In_opt_ PGRAPHICS_DEVICE pGraphicsDevice, _In_opt_ PDEVMODEW pdm, _In_ ULONG dwAccelerationLevel, _In_ ULONG ldevtype)
Definition: pdevobj.c:411
#define GDITAG_MDEV
Definition: tags.h:74
VOID MDEVOBJ_vDestroy(_Inout_ PMDEVOBJ pmdev)
Definition: mdevobj.c:164
#define TRACE(s)
Definition: solgame.cpp:4
WORD dmSize
Definition: wingdi.h:1620
PGRAPHICS_DEVICE NTAPI EngpFindGraphicsDevice(_In_opt_ PUNICODE_STRING pustrDevice, _In_ ULONG iDevNum)
Definition: device.c:469
#define ERR(fmt,...)
Definition: debug.h:110
PPDEVOBJ ppdev
Definition: mdevobj.h:10
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
ULONG cDev
Definition: mdevobj.h:15
MDEVDISPLAY dev[0]
Definition: mdevobj.h:17

Referenced by PDEVOBJ_lChangeDisplaySettings().

◆ MDEVOBJ_vDestroy()

VOID MDEVOBJ_vDestroy ( _Inout_ PMDEVOBJ  pmdev)

Definition at line 164 of file mdevobj.c.

166 {
167  ULONG i;
168 
169  for (i = 0; i < pmdev->cDev; i++)
170  {
171  PDEVOBJ_vRelease(pmdev->dev[i].ppdev);
172  }
173 
174  if (pmdev->cDev > 1)
175  PDEVOBJ_vRelease(pmdev->ppdevGlobal);
176 
178 }
#define GDITAG_MDEV
Definition: tags.h:74
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
unsigned int ULONG
Definition: retypes.h:1
VOID NTAPI PDEVOBJ_vRelease(_Inout_ PPDEVOBJ ppdev)
Definition: pdevobj.c:104
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099

Referenced by MDEVOBJ_Create(), and PDEVOBJ_lChangeDisplaySettings().

◆ MDEVOBJ_vEnable()

VOID MDEVOBJ_vEnable ( _Inout_ PMDEVOBJ  pmdev)

Definition at line 17 of file mdevobj.c.

19 {
20  ULONG i;
21 
22  for (i = 0; i < pmdev->cDev; i++)
23  {
24  PDEVOBJ_vEnableDisplay(pmdev->dev[i].ppdev);
25  }
26 }
VOID PDEVOBJ_vEnableDisplay(_Inout_ PPDEVOBJ ppdev)
Definition: pdevobj.c:340
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
unsigned int ULONG
Definition: retypes.h:1

Referenced by PDEVOBJ_lChangeDisplaySettings().

Variable Documentation

◆ gpmdev