ReactOS 0.4.16-dev-297-gc569aee
display.c File Reference
#include <user32.h>
Include dependency graph for display.c:

Go to the source code of this file.

Macros

#define SIZEOF_DEVMODEA_300   124
 
#define SIZEOF_DEVMODEA_400   148
 
#define SIZEOF_DEVMODEA_500   156
 
#define SIZEOF_DEVMODEW_300   188
 
#define SIZEOF_DEVMODEW_400   212
 
#define SIZEOF_DEVMODEW_500   220
 
#define COPYS(f, len)   WideCharToMultiByte(CP_THREAD_ACP, 0, lpExtendedDevMode->f, len, (LPSTR)lpDevMode->f, len, NULL, NULL)
 
#define COPYN(f)   lpDevMode->f = lpExtendedDevMode->f
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (user32)
 
BOOL WINAPI EnumDisplayDevicesA (LPCSTR lpDevice, DWORD iDevNum, PDISPLAY_DEVICEA lpDisplayDevice, DWORD dwFlags)
 
BOOL WINAPI EnumDisplayDevicesW (LPCWSTR lpDevice, DWORD iDevNum, PDISPLAY_DEVICEW lpDisplayDevice, DWORD dwFlags)
 
BOOL WINAPI EnumDisplayMonitors (HDC hdc, LPCRECT lprcClip, MONITORENUMPROC lpfnEnum, LPARAM dwData)
 
BOOL WINAPI EnumDisplaySettingsExA (LPCSTR lpszDeviceName, DWORD iModeNum, LPDEVMODEA lpDevMode, DWORD dwFlags)
 
BOOL WINAPI EnumDisplaySettingsA (LPCSTR lpszDeviceName, DWORD iModeNum, LPDEVMODEA lpDevMode)
 
BOOL WINAPI EnumDisplaySettingsExW (LPCWSTR lpszDeviceName, DWORD iModeNum, LPDEVMODEW lpDevMode, DWORD dwFlags)
 
BOOL WINAPI EnumDisplaySettingsW (LPCWSTR lpszDeviceName, DWORD iModeNum, LPDEVMODEW lpDevMode)
 
BOOL WINAPI GetMonitorInfoA (HMONITOR hMonitor, LPMONITORINFO lpmi)
 
BOOL WINAPI GetMonitorInfoW (HMONITOR hMonitor, LPMONITORINFO lpmi)
 
HMONITOR WINAPI MonitorFromPoint (IN POINT ptPoint, IN DWORD dwFlags)
 
HMONITOR WINAPI MonitorFromRect (IN LPCRECT lpcRect, IN DWORD dwFlags)
 
HMONITOR WINAPI MonitorFromWindow (IN HWND hWnd, IN DWORD dwFlags)
 
LONG WINAPI ChangeDisplaySettingsExA (LPCSTR lpszDeviceName, LPDEVMODEA lpDevMode, HWND hwnd, DWORD dwflags, LPVOID lParam)
 
LONG WINAPI ChangeDisplaySettingsA (LPDEVMODEA lpDevMode, DWORD dwflags)
 
LONG WINAPI ChangeDisplaySettingsExW (LPCWSTR lpszDeviceName, LPDEVMODEW lpDevMode, HWND hwnd, DWORD dwflags, LPVOID lParam)
 
LONG WINAPI ChangeDisplaySettingsW (LPDEVMODEW lpDevMode, DWORD dwflags)
 

Macro Definition Documentation

◆ COPYN

#define COPYN (   f)    lpDevMode->f = lpExtendedDevMode->f

◆ COPYS

#define COPYS (   f,
  len 
)    WideCharToMultiByte(CP_THREAD_ACP, 0, lpExtendedDevMode->f, len, (LPSTR)lpDevMode->f, len, NULL, NULL)

◆ SIZEOF_DEVMODEA_300

#define SIZEOF_DEVMODEA_300   124

Definition at line 12 of file display.c.

◆ SIZEOF_DEVMODEA_400

#define SIZEOF_DEVMODEA_400   148

Definition at line 13 of file display.c.

◆ SIZEOF_DEVMODEA_500

#define SIZEOF_DEVMODEA_500   156

Definition at line 14 of file display.c.

◆ SIZEOF_DEVMODEW_300

#define SIZEOF_DEVMODEW_300   188

Definition at line 15 of file display.c.

◆ SIZEOF_DEVMODEW_400

#define SIZEOF_DEVMODEW_400   212

Definition at line 16 of file display.c.

◆ SIZEOF_DEVMODEW_500

#define SIZEOF_DEVMODEW_500   220

Definition at line 17 of file display.c.

Function Documentation

◆ ChangeDisplaySettingsA()

LONG WINAPI ChangeDisplaySettingsA ( LPDEVMODEA  lpDevMode,
DWORD  dwflags 
)

Definition at line 570 of file display.c.

573{
574 if(lpDevMode)
577}
#define NULL
Definition: types.h:112
static _In_ DWORD dwflags
Definition: dispmode.c:64
static _In_ DWORD _Inout_ PDEVMODEA lpDevMode
Definition: dispmode.c:77
WORD dmDriverExtra
Definition: wingdi.h:1569
LONG WINAPI ChangeDisplaySettingsExA(LPCSTR lpszDeviceName, LPDEVMODEA lpDevMode, HWND hwnd, DWORD dwflags, LPVOID lParam)
Definition: display.c:521

Referenced by Notify(), and test_ChangeDisplaySettingsEx().

◆ ChangeDisplaySettingsExA()

LONG WINAPI ChangeDisplaySettingsExA ( LPCSTR  lpszDeviceName,
LPDEVMODEA  lpDevMode,
HWND  hwnd,
DWORD  dwflags,
LPVOID  lParam 
)

Definition at line 521 of file display.c.

527{
528 LONG rc;
530 PUNICODE_STRING pDeviceName = &DeviceName;
531
532 if (lpszDeviceName != NULL)
533 {
534 if (!RtlCreateUnicodeStringFromAsciiz(pDeviceName, (PCSZ)lpszDeviceName))
535 {
537 return DISP_CHANGE_BADPARAM; /* FIXME what to return? */
538 }
539 }
540 else
541 pDeviceName = NULL;
542
543 if (lpDevMode != NULL)
544 {
545 LPDEVMODEW pDevModeW;
546 pDevModeW = GdiConvertToDevmodeW(lpDevMode);
547 if(pDevModeW)
548 {
549 rc = NtUserChangeDisplaySettings(pDeviceName, pDevModeW, dwflags, lParam);
550 RtlFreeHeap(GetProcessHeap(), 0, pDevModeW);
551 }
552 else
554 }
555 else
556 rc = NtUserChangeDisplaySettings(pDeviceName, NULL, dwflags, lParam);
557
558 if (lpszDeviceName != NULL)
560
561 return rc;
562}
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:608
LPARAM lParam
Definition: combotst.c:139
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
#define GetProcessHeap()
Definition: compat.h:736
#define SetLastError(x)
Definition: compat.h:752
LONG NTAPI NtUserChangeDisplaySettings(PUNICODE_STRING lpszDeviceName, LPDEVMODEW lpDevMode, DWORD dwflags, LPVOID lParam)
Definition: display.c:930
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
long LONG
Definition: pedump.c:60
CONST char * PCSZ
Definition: umtypes.h:125
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3275
DEVMODEW *WINAPI GdiConvertToDevmodeW(const DEVMODEA *)
Definition: misc.c:969
#define DISP_CHANGE_SUCCESSFUL
Definition: winuser.h:190
#define DISP_CHANGE_BADPARAM
Definition: winuser.h:193

Referenced by ChangeDisplaySettingsA(), and init_function_pointers().

◆ ChangeDisplaySettingsExW()

LONG WINAPI ChangeDisplaySettingsExW ( LPCWSTR  lpszDeviceName,
LPDEVMODEW  lpDevMode,
HWND  hwnd,
DWORD  dwflags,
LPVOID  lParam 
)

Definition at line 585 of file display.c.

591{
592 LONG rc;
594 PUNICODE_STRING pDeviceName = &DeviceName;
595
596 if (lpszDeviceName != NULL)
597 RtlInitUnicodeString(pDeviceName, lpszDeviceName);
598 else
599 pDeviceName = NULL;
600
602
603 return rc;
604}
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)

Referenced by ChangeDisplaySettingsW(), init_function_pointers(), START_TEST(), Test_GradientCaptions(), and wined3d_set_adapter_display_mode().

◆ ChangeDisplaySettingsW()

LONG WINAPI ChangeDisplaySettingsW ( LPDEVMODEW  lpDevMode,
DWORD  dwflags 
)

Definition at line 612 of file display.c.

615{
616 if(lpDevMode)
619}
LONG WINAPI ChangeDisplaySettingsExW(LPCWSTR lpszDeviceName, LPDEVMODEW lpDevMode, HWND hwnd, DWORD dwflags, LPVOID lParam)
Definition: display.c:585

Referenced by EnterFullScreen(), LeaveFullScreen(), ProcessUnattendSection(), and test_ChangeDisplaySettingsEx().

◆ EnumDisplayDevicesA()

BOOL WINAPI EnumDisplayDevicesA ( LPCSTR  lpDevice,
DWORD  iDevNum,
PDISPLAY_DEVICEA  lpDisplayDevice,
DWORD  dwFlags 
)

Definition at line 23 of file display.c.

28{
29 BOOL rc;
31 DISPLAY_DEVICEW DisplayDeviceW;
32
34 {
36 return FALSE;
37 }
38
39 RtlZeroMemory(&DisplayDeviceW, sizeof(DISPLAY_DEVICEW));
40 DisplayDeviceW.cb = sizeof(DISPLAY_DEVICEW);
42 iDevNum,
43 &DisplayDeviceW,
44 dwFlags);
45 if (rc)
46 {
47 /* Copy result from DisplayDeviceW to lpDisplayDevice. Buffers have the same size so result is always NULL terminated. */
48 lpDisplayDevice->StateFlags = DisplayDeviceW.StateFlags;
49 WideCharToMultiByte(CP_ACP, 0, DisplayDeviceW.DeviceName, -1,
50 lpDisplayDevice->DeviceName,
51 sizeof(lpDisplayDevice->DeviceName) / sizeof(lpDisplayDevice->DeviceName[0]),
52 NULL, NULL);
53 WideCharToMultiByte(CP_ACP, 0, DisplayDeviceW.DeviceString, -1,
54 lpDisplayDevice->DeviceString,
55 sizeof(lpDisplayDevice->DeviceString) / sizeof(lpDisplayDevice->DeviceString[0]),
56 NULL, NULL);
57 WideCharToMultiByte(CP_ACP, 0, DisplayDeviceW.DeviceID, -1,
58 lpDisplayDevice->DeviceID,
59 sizeof(lpDisplayDevice->DeviceID) / sizeof(lpDisplayDevice->DeviceID[0]),
60 NULL, NULL);
61 WideCharToMultiByte(CP_ACP, 0, DisplayDeviceW.DeviceKey, -1,
62 lpDisplayDevice->DeviceKey,
63 sizeof(lpDisplayDevice->DeviceKey) / sizeof(lpDisplayDevice->DeviceKey[0]),
64 NULL, NULL);
65 }
66
68
69 return rc;
70}
#define FALSE
Definition: types.h:117
#define CP_ACP
Definition: compat.h:109
#define WideCharToMultiByte
Definition: compat.h:111
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL NTAPI NtUserEnumDisplayDevices(PUNICODE_STRING lpDevice, DWORD iDevNum, PDISPLAY_DEVICEW lpDisplayDevice, DWORD dwFlags)
Definition: display.c:350
DWORD StateFlags
Definition: wingdi.h:2812
CHAR DeviceString[128]
Definition: wingdi.h:2811
CHAR DeviceName[32]
Definition: wingdi.h:2810
CHAR DeviceID[128]
Definition: wingdi.h:2813
CHAR DeviceKey[128]
Definition: wingdi.h:2814
WCHAR DeviceName[32]
Definition: wingdi.h:2818
DWORD StateFlags
Definition: wingdi.h:2820
WCHAR DeviceString[128]
Definition: wingdi.h:2819
WCHAR DeviceKey[128]
Definition: wingdi.h:2822
WCHAR DeviceID[128]
Definition: wingdi.h:2821
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
struct _DISPLAY_DEVICEW DISPLAY_DEVICEW

Referenced by GetAdapterInfo(), GetDisplayDeviceInfo(), init_function_pointers(), Main_DirectDraw_GetDeviceIdentifier7(), and testSetupDiGetClassDevsA().

◆ EnumDisplayDevicesW()

BOOL WINAPI EnumDisplayDevicesW ( LPCWSTR  lpDevice,
DWORD  iDevNum,
PDISPLAY_DEVICEW  lpDisplayDevice,
DWORD  dwFlags 
)

◆ EnumDisplayMonitors()

BOOL WINAPI EnumDisplayMonitors ( HDC  hdc,
LPCRECT  lprcClip,
MONITORENUMPROC  lpfnEnum,
LPARAM  dwData 
)

Definition at line 104 of file display.c.

109{
110 INT iCount, i;
111 HMONITOR *hMonitorList;
112 LPRECT pRectList;
113 HANDLE hHeap;
114 BOOL ret = FALSE;
115
116 /* get list of monitors/rects */
117 iCount = NtUserEnumDisplayMonitors(hdc, lprcClip, NULL, NULL, 0);
118 if (iCount < 0)
119 {
120 /* FIXME: SetLastError() */
121 return FALSE;
122 }
123 if (iCount == 0)
124 {
125 return TRUE;
126 }
127
128 hHeap = GetProcessHeap();
129 hMonitorList = HeapAlloc(hHeap, 0, sizeof (HMONITOR) * iCount);
130 if (hMonitorList == NULL)
131 {
133 return FALSE;
134 }
135 pRectList = HeapAlloc(hHeap, 0, sizeof (RECT) * iCount);
136 if (pRectList == NULL)
137 {
139 goto cleanup;
140 }
141
142 iCount = NtUserEnumDisplayMonitors(hdc, lprcClip, hMonitorList, pRectList, iCount);
143 if (iCount <= 0)
144 {
145 /* FIXME: SetLastError() */
146 goto cleanup;
147 }
148
149 /* enumerate list */
150 for (i = 0; i < iCount; i++)
151 {
152 HMONITOR hMonitor = hMonitorList[i];
153 LPRECT pMonitorRect = pRectList + i;
154 HDC hMonitorDC = NULL;
155
156 if (hdc != NULL)
157 {
158 /* make monitor DC */
159 hMonitorDC = hdc;
160 }
161
162 if (!lpfnEnum(hMonitor, hMonitorDC, pMonitorRect, dwData))
163 goto cleanup; /* return FALSE */
164 }
165
166 ret = TRUE;
167
168cleanup:
169 if(hMonitorList)
170 HeapFree(hHeap, 0, hMonitorList);
171 if(pRectList)
172 HeapFree(hHeap, 0, pRectList);
173 return ret;
174}
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define TRUE
Definition: types.h:120
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
static void cleanup(void)
Definition: main.c:1335
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
INT NTAPI NtUserEnumDisplayMonitors(OPTIONAL IN HDC hDC, OPTIONAL IN LPCRECT pRect, OPTIONAL OUT HMONITOR *hMonitorList, OPTIONAL OUT LPRECT monitorRectList, OPTIONAL IN DWORD listSize)
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:88
static HANDLE ULONG_PTR dwData
Definition: file.c:35
int32_t INT
Definition: typedefs.h:58
int ret

◆ EnumDisplaySettingsA()

BOOL WINAPI EnumDisplaySettingsA ( LPCSTR  lpszDeviceName,
DWORD  iModeNum,
LPDEVMODEA  lpDevMode 
)

Definition at line 312 of file display.c.

316{
317 /* Fixup sizes */
318 lpDevMode->dmSize = FIELD_OFFSET(DEVMODEA, dmICMMethod);
320
321 return EnumDisplaySettingsExA(lpszDeviceName, iModeNum, lpDevMode, 0);
322}
static _In_ DWORD iModeNum
Definition: dispmode.c:77
WORD dmSize
Definition: wingdi.h:1568
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
BOOL WINAPI EnumDisplaySettingsExA(LPCSTR lpszDeviceName, DWORD iModeNum, LPDEVMODEA lpDevMode, DWORD dwFlags)
Definition: display.c:182

Referenced by CreateDisplayModeList(), GetAdapterMode(), Notify(), START_TEST(), test_ChangeDisplaySettingsEx(), test_CreateCompatibleDC(), test_EnumDisplaySettings(), test_GdiConvertToDevmodeW(), and test_WM_DISPLAYCHANGE().

◆ EnumDisplaySettingsExA()

BOOL WINAPI EnumDisplaySettingsExA ( LPCSTR  lpszDeviceName,
DWORD  iModeNum,
LPDEVMODEA  lpDevMode,
DWORD  dwFlags 
)

Definition at line 182 of file display.c.

187{
189 UNICODE_STRING usDeviceName;
190 PUNICODE_STRING pusDeviceName = NULL;
191 LPDEVMODEW lpExtendedDevMode;
192 BOOL Result = FALSE;
193
194 if (lpszDeviceName)
195 {
196 if (!RtlCreateUnicodeStringFromAsciiz(&usDeviceName, (PCSZ)lpszDeviceName))
197 {
199 return FALSE;
200 }
201 pusDeviceName = &usDeviceName;
202 }
203
204 /* Allocate memory for DEVMODEW and extra data */
205 lpExtendedDevMode = RtlAllocateHeap(RtlGetProcessHeap(),
207 sizeof(DEVMODEW) + lpDevMode->dmDriverExtra);
208 if (!lpExtendedDevMode)
209 {
210 if (pusDeviceName)
211 RtlFreeUnicodeString(&usDeviceName);
212
213 return FALSE;
214 }
215
216 /* Initialize structure fields */
217 lpExtendedDevMode->dmSize = sizeof(DEVMODEW);
218 lpExtendedDevMode->dmDriverExtra = lpDevMode->dmDriverExtra;
219
220 Status = NtUserEnumDisplaySettings(pusDeviceName, iModeNum, lpExtendedDevMode, dwFlags);
221
222 if (pusDeviceName)
223 RtlFreeUnicodeString(&usDeviceName);
224
225 if (NT_SUCCESS(Status))
226 {
227 /* Store old structure size */
228 WORD OldSize = lpDevMode->dmSize;
229
230#define COPYS(f,len) WideCharToMultiByte(CP_THREAD_ACP, 0, lpExtendedDevMode->f, len, (LPSTR)lpDevMode->f, len, NULL, NULL)
231#define COPYN(f) lpDevMode->f = lpExtendedDevMode->f
232
233 COPYS(dmDeviceName, CCHDEVICENAME);
234 COPYN(dmSpecVersion);
235 COPYN(dmDriverVersion);
236 COPYN(dmFields);
237 COPYN(dmPosition.x);
238 COPYN(dmPosition.y);
239 COPYN(dmScale);
240 COPYN(dmCopies);
241 COPYN(dmDefaultSource);
242 COPYN(dmPrintQuality);
243 COPYN(dmColor);
244 COPYN(dmDuplex);
245 COPYN(dmYResolution);
246 COPYN(dmTTOption);
247 COPYN(dmCollate);
248 COPYS(dmFormName,CCHFORMNAME);
249 COPYN(dmLogPixels);
250 COPYN(dmBitsPerPel);
251 COPYN(dmPelsWidth);
252 COPYN(dmPelsHeight);
253 COPYN(dmDisplayFlags); // aka dmNup
254 COPYN(dmDisplayFrequency);
255
256 /* we're done with 0x300 fields */
257 if (OldSize > SIZEOF_DEVMODEA_300)
258 {
259 COPYN(dmICMMethod);
260 COPYN(dmICMIntent);
261 COPYN(dmMediaType);
262 COPYN(dmDitherType);
263 COPYN(dmReserved1);
264 COPYN(dmReserved2);
265
266 /* we're done with 0x400 fields */
267 if (OldSize > SIZEOF_DEVMODEA_400)
268 {
269 COPYN(dmPanningWidth);
270 COPYN(dmPanningHeight);
271 }
272 }
273
274 /* Restore old size */
275 lpDevMode->dmSize = OldSize;
276
277 /* Extra data presented? */
278 if (lpDevMode->dmDriverExtra && lpExtendedDevMode->dmDriverExtra)
279 {
280 /* We choose the smallest size */
281 if (lpDevMode->dmDriverExtra > lpExtendedDevMode->dmDriverExtra)
282 lpDevMode->dmDriverExtra = lpExtendedDevMode->dmDriverExtra;
283
284 /* Copy extra data */
285 RtlCopyMemory((PUCHAR)lpDevMode + OldSize,
286 lpExtendedDevMode + 1,
288 }
289
290 /* If the size of source structure is less, than used, we clean unsupported flags */
291 if (OldSize < FIELD_OFFSET(DEVMODEA, dmPanningHeight))
292 lpDevMode->dmFields &= ~DM_PANNINGHEIGHT;
293
294 if (OldSize < FIELD_OFFSET(DEVMODEA, dmPanningWidth))
295 lpDevMode->dmFields &= ~DM_PANNINGWIDTH;
296
297 Result = TRUE;
298 }
299
300 /* Free memory */
301 RtlFreeHeap(RtlGetProcessHeap(), 0, lpExtendedDevMode);
302
303 return Result;
304}
LONG NTSTATUS
Definition: precomp.h:26
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:590
#define CCHDEVICENAME
Definition: ddrawi.h:63
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
unsigned short WORD
Definition: ntddk_ex.h:93
Status
Definition: gdiplustypes.h:25
NTSTATUS NTAPI NtUserEnumDisplaySettings(PUNICODE_STRING lpszDeviceName, DWORD iModeNum, LPDEVMODEW lpDevMode, DWORD dwFlags)
DWORD dmFields
Definition: wingdi.h:1570
WORD dmDriverExtra
Definition: wingdi.h:1621
WORD dmSize
Definition: wingdi.h:1620
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
unsigned char * PUCHAR
Definition: typedefs.h:53
#define COPYN(f)
#define COPYS(f, len)
#define SIZEOF_DEVMODEA_300
Definition: display.c:12
#define SIZEOF_DEVMODEA_400
Definition: display.c:13
#define CCHFORMNAME
Definition: wingdi.h:67
struct _devicemodeW DEVMODEW
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409

Referenced by EnumDisplaySettingsA().

◆ EnumDisplaySettingsExW()

BOOL WINAPI EnumDisplaySettingsExW ( LPCWSTR  lpszDeviceName,
DWORD  iModeNum,
LPDEVMODEW  lpDevMode,
DWORD  dwFlags 
)

Definition at line 330 of file display.c.

335{
337 UNICODE_STRING usDeviceName;
338 PUNICODE_STRING pusDeviceName = NULL;
339 LPDEVMODEW lpExtendedDevMode;
340 BOOL Result = FALSE;
341
342 if (lpszDeviceName)
343 {
344 RtlInitUnicodeString(&usDeviceName, lpszDeviceName);
345 pusDeviceName = &usDeviceName;
346 }
347
348 /* Allocate memory for DEVMODEW and extra data */
349 lpExtendedDevMode = RtlAllocateHeap(RtlGetProcessHeap(),
351 sizeof(DEVMODEW) + lpDevMode->dmDriverExtra);
352 if (!lpExtendedDevMode)
353 return FALSE;
354
355 /* Initialize structure fields */
356 lpExtendedDevMode->dmSize = sizeof(DEVMODEW);
357 lpExtendedDevMode->dmDriverExtra = lpDevMode->dmDriverExtra;
358
359 Status = NtUserEnumDisplaySettings(pusDeviceName, iModeNum, lpExtendedDevMode, dwFlags);
360 if (NT_SUCCESS(Status))
361 {
362 /* Store old structure sizes */
363 WORD OldSize = lpDevMode->dmSize;
364 WORD OldDriverExtra = lpDevMode->dmDriverExtra;
365
366 /* Copy general data */
367 RtlCopyMemory(lpDevMode, lpExtendedDevMode, OldSize);
368
369 /* Restore old sizes */
370 lpDevMode->dmSize = OldSize;
371 lpDevMode->dmDriverExtra = OldDriverExtra;
372
373 /* Extra data presented? */
374 if (lpDevMode->dmDriverExtra && lpExtendedDevMode->dmDriverExtra)
375 {
376 /* We choose the smallest size */
377 if (lpDevMode->dmDriverExtra > lpExtendedDevMode->dmDriverExtra)
378 lpDevMode->dmDriverExtra = lpExtendedDevMode->dmDriverExtra;
379
380 /* Copy extra data */
381 RtlCopyMemory((PUCHAR)lpDevMode + OldSize,
382 lpExtendedDevMode + 1,
384 }
385
386 /* If the size of source structure is less, than used, we clean unsupported flags */
387 if (OldSize < FIELD_OFFSET(DEVMODEW, dmPanningHeight))
388 lpDevMode->dmFields &= ~DM_PANNINGHEIGHT;
389
390 if (OldSize < FIELD_OFFSET(DEVMODEW, dmPanningWidth))
391 lpDevMode->dmFields &= ~DM_PANNINGWIDTH;
392
393 Result = TRUE;
394 }
395
396 /* Free memory */
397 RtlFreeHeap(RtlGetProcessHeap(), 0, lpExtendedDevMode);
398
399 return Result;
400}

Referenced by EnumDisplaySettingsW(), get_display_frequency(), GetPossibleSettings(), pCDevSettings_Initialize(), SettingsPageProc(), wined3d_enum_adapter_modes(), wined3d_get_adapter_display_mode(), and wined3d_get_adapter_mode_count().

◆ EnumDisplaySettingsW()

BOOL WINAPI EnumDisplaySettingsW ( LPCWSTR  lpszDeviceName,
DWORD  iModeNum,
LPDEVMODEW  lpDevMode 
)

Definition at line 408 of file display.c.

412{
413 /* Fixup sizes */
414 lpDevMode->dmSize = FIELD_OFFSET(DEVMODEW, dmICMMethod);
416
417 return EnumDisplaySettingsExW(lpszDeviceName, iModeNum, lpDevMode, 0);
418}
BOOL WINAPI EnumDisplaySettingsExW(LPCWSTR lpszDeviceName, DWORD iModeNum, LPDEVMODEW lpDevMode, DWORD dwFlags)
Definition: display.c:330

Referenced by GetSystemColorDepth(), InitializeDialog(), ProcessUnattendSection(), SHIsTempDisplayMode(), START_TEST(), Test_GradientCaptions(), and wined3d_set_adapter_display_mode().

◆ GetMonitorInfoA()

BOOL WINAPI GetMonitorInfoA ( HMONITOR  hMonitor,
LPMONITORINFO  lpmi 
)

Definition at line 426 of file display.c.

429{
430 if (lpmi->cbSize == sizeof (MONITORINFO))
431 {
432 return NtUserGetMonitorInfo(hMonitor, lpmi);
433 }
434 else if (lpmi->cbSize != sizeof (MONITORINFOEXA))
435 {
437 return FALSE;
438 }
439 else
440 {
441 MONITORINFOEXW miExW;
442 INT res;
443
444 miExW.cbSize = sizeof (MONITORINFOEXW);
445 if (!NtUserGetMonitorInfo(hMonitor, (LPMONITORINFO)&miExW))
446 {
447 return FALSE;
448 }
449 memcpy(lpmi, &miExW, sizeof (MONITORINFO));
450 res = WideCharToMultiByte(CP_THREAD_ACP, 0, miExW.szDevice, -1,
451 ((LPMONITORINFOEXA)lpmi)->szDevice, CCHDEVICENAME,
452 NULL, NULL);
453 if (res == 0)
454 {
455 WARN("WideCharToMultiByte() failed!\n");
456 return FALSE;
457 }
458 }
459
460 return TRUE;
461}
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
GLuint res
Definition: glext.h:9613
BOOL NTAPI NtUserGetMonitorInfo(IN HMONITOR hMonitor, OUT LPMONITORINFO pMonitorInfo)
Definition: monitor.c:728
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
DWORD cbSize
Definition: winuser.h:3787
#define CP_THREAD_ACP
Definition: winnls.h:235
struct tagMONITORINFOEXW MONITORINFOEXW
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList

◆ GetMonitorInfoW()

BOOL WINAPI GetMonitorInfoW ( HMONITOR  hMonitor,
LPMONITORINFO  lpmi 
)

Definition at line 469 of file display.c.

472{
473 return NtUserGetMonitorInfo(hMonitor, lpmi);
474}

◆ MonitorFromPoint()

HMONITOR WINAPI MonitorFromPoint ( IN POINT  ptPoint,
IN DWORD  dwFlags 
)

Definition at line 482 of file display.c.

485{
486 return NtUserMonitorFromPoint(ptPoint, dwFlags);
487}
HMONITOR NTAPI NtUserMonitorFromPoint(IN POINT point, IN DWORD dwFlags)
Definition: monitor.c:827

◆ MonitorFromRect()

HMONITOR WINAPI MonitorFromRect ( IN LPCRECT  lpcRect,
IN DWORD  dwFlags 
)

Definition at line 495 of file display.c.

498{
499 return NtUserMonitorFromRect(lpcRect, dwFlags);
500}
HMONITOR NTAPI NtUserMonitorFromRect(IN LPCRECT pRect, IN DWORD dwFlags)

◆ MonitorFromWindow()

HMONITOR WINAPI MonitorFromWindow ( IN HWND  hWnd,
IN DWORD  dwFlags 
)

Definition at line 508 of file display.c.

511{
513}
HWND hWnd
Definition: settings.c:17
HMONITOR NTAPI NtUserMonitorFromWindow(IN HWND hWnd, IN DWORD dwFlags)
Definition: monitor.c:967

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( user32  )