ReactOS 0.4.15-dev-7924-g5949c20
display.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * PURPOSE: Video initialization and display settings
5 * FILE: win32ss/user/ntuser/display.c
6 * PROGRAMER: Timo Kreuzer (timo.kreuzer@reactos.org)
7 */
8
9#include <win32k.h>
11
14
15static const PWCHAR KEY_VIDEO = L"\\Registry\\Machine\\HARDWARE\\DEVICEMAP\\VIDEO";
16
17VOID
19{
20 RegWriteDWORD(hkey, L"DefaultSettings.BitsPerPel", pdm->dmBitsPerPel);
21 RegWriteDWORD(hkey, L"DefaultSettings.XResolution", pdm->dmPelsWidth);
22 RegWriteDWORD(hkey, L"DefaultSettings.YResolution", pdm->dmPelsHeight);
23 RegWriteDWORD(hkey, L"DefaultSettings.Flags", pdm->dmDisplayFlags);
24 RegWriteDWORD(hkey, L"DefaultSettings.VRefresh", pdm->dmDisplayFrequency);
25 RegWriteDWORD(hkey, L"DefaultSettings.XPanning", pdm->dmPanningWidth);
26 RegWriteDWORD(hkey, L"DefaultSettings.YPanning", pdm->dmPanningHeight);
27 RegWriteDWORD(hkey, L"DefaultSettings.Orientation", pdm->dmDisplayOrientation);
28 RegWriteDWORD(hkey, L"DefaultSettings.FixedOutput", pdm->dmDisplayFixedOutput);
29 RegWriteDWORD(hkey, L"Attach.RelativeX", pdm->dmPosition.x);
30 RegWriteDWORD(hkey, L"Attach.RelativeY", pdm->dmPosition.y);
31// RegWriteDWORD(hkey, L"Attach.ToDesktop, pdm->dmBitsPerPel", pdm->);
32}
33
34VOID
36{
37 DWORD dwValue;
38
39 /* Zero out the structure */
40 RtlZeroMemory(pdm, sizeof(DEVMODEW));
41
42/* Helper macro */
43#define READ(field, str, flag) \
44 if (RegReadDWORD(hkey, L##str, &dwValue)) \
45 { \
46 pdm->field = dwValue; \
47 pdm->dmFields |= flag; \
48 }
49
50 /* Read all present settings */
51 READ(dmBitsPerPel, "DefaultSettings.BitsPerPel", DM_BITSPERPEL);
52 READ(dmPelsWidth, "DefaultSettings.XResolution", DM_PELSWIDTH);
53 READ(dmPelsHeight, "DefaultSettings.YResolution", DM_PELSHEIGHT);
54 READ(dmDisplayFlags, "DefaultSettings.Flags", DM_DISPLAYFLAGS);
55 READ(dmDisplayFrequency, "DefaultSettings.VRefresh", DM_DISPLAYFREQUENCY);
56 READ(dmPanningWidth, "DefaultSettings.XPanning", DM_PANNINGWIDTH);
57 READ(dmPanningHeight, "DefaultSettings.YPanning", DM_PANNINGHEIGHT);
58 READ(dmDisplayOrientation, "DefaultSettings.Orientation", DM_DISPLAYORIENTATION);
59 READ(dmDisplayFixedOutput, "DefaultSettings.FixedOutput", DM_DISPLAYFIXEDOUTPUT);
60 READ(dmPosition.x, "Attach.RelativeX", DM_POSITION);
61 READ(dmPosition.y, "Attach.RelativeY", DM_POSITION);
62}
63
68 IN PWSTR pwszRegKey)
69{
70 PGRAPHICS_DEVICE pGraphicsDevice;
71 UNICODE_STRING ustrDeviceName, ustrDisplayDrivers, ustrDescription;
73 WCHAR awcBuffer[128];
74 ULONG cbSize;
75 HKEY hkey;
76 DWORD dwVga;
77
78 TRACE("InitDisplayDriver(%S, %S);\n",
79 pwszDeviceName, pwszRegKey);
80
81 /* Open the driver's registry key */
82 Status = RegOpenKey(pwszRegKey, &hkey);
83 if (!NT_SUCCESS(Status))
84 {
85 ERR("Failed to open registry key: %ls\n", pwszRegKey);
86 return NULL;
87 }
88
89 /* Query the diplay drivers */
90 cbSize = sizeof(awcBuffer) - 10;
91 Status = RegQueryValue(hkey,
92 L"InstalledDisplayDrivers",
94 awcBuffer,
95 &cbSize);
96 if (!NT_SUCCESS(Status))
97 {
98 ERR("Didn't find 'InstalledDisplayDrivers', status = 0x%lx\n", Status);
99 ZwClose(hkey);
100 return NULL;
101 }
102
103 /* Initialize the UNICODE_STRING */
104 ustrDisplayDrivers.Buffer = awcBuffer;
105 ustrDisplayDrivers.MaximumLength = (USHORT)cbSize;
106 ustrDisplayDrivers.Length = (USHORT)cbSize;
107
108 /* Set Buffer for description and size of remaining buffer */
109 ustrDescription.Buffer = awcBuffer + (cbSize / sizeof(WCHAR));
110 cbSize = sizeof(awcBuffer) - cbSize;
111
112 /* Query the device string */
113 Status = RegQueryValue(hkey,
114 L"Device Description",
115 REG_SZ,
116 ustrDescription.Buffer,
117 &cbSize);
118 if (NT_SUCCESS(Status))
119 {
120 ustrDescription.MaximumLength = (USHORT)cbSize;
121 ustrDescription.Length = (USHORT)cbSize;
122 }
123 else
124 {
125 RtlInitUnicodeString(&ustrDescription, L"<unknown>");
126 }
127
128 /* Query if this is a VGA compatible driver */
129 cbSize = sizeof(DWORD);
130 Status = RegQueryValue(hkey, L"VgaCompatible", REG_DWORD, &dwVga, &cbSize);
131 if (!NT_SUCCESS(Status)) dwVga = 0;
132
133 /* Close the registry key */
134 ZwClose(hkey);
135
136 /* Register the device with GDI */
137 RtlInitUnicodeString(&ustrDeviceName, pwszDeviceName);
138 pGraphicsDevice = EngpRegisterGraphicsDevice(&ustrDeviceName,
139 &ustrDisplayDrivers,
140 &ustrDescription);
141 if (pGraphicsDevice && dwVga)
142 {
143 pGraphicsDevice->StateFlags |= DISPLAY_DEVICE_VGA_COMPATIBLE;
144 }
145
146 return pGraphicsDevice;
147}
148
150NTAPI
152{
154 HKEY hkey;
155
156 TRACE("----------------------------- InitVideo() -------------------------------\n");
157
158 /* Check if VGA mode is requested, by finding the special volatile key created by VIDEOPRT */
159 Status = RegOpenKey(L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\GraphicsDrivers\\BaseVideo", &hkey);
160 if (NT_SUCCESS(Status))
161 ZwClose(hkey);
163 if (gbBaseVideo)
164 ERR("VGA mode requested.\n");
165
166 /* Initialize all display devices */
168 if (!NT_SUCCESS(Status))
169 return Status;
170
171 /* Check if we had any success */
173 {
174 /* Check if there is a VGA device we skipped */
176 {
177 /* There is, use the VGA device */
179 }
180 else
181 {
182 ERR("No usable display driver was found.\n");
183 return STATUS_UNSUCCESSFUL;
184 }
185 }
186
188
189 return STATUS_SUCCESS;
190}
191
192VOID
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}
230
232NTAPI
234 PUNICODE_STRING pustrDevice,
235 DWORD iDevNum,
236 PDISPLAY_DEVICEW pdispdev,
238{
239 PGRAPHICS_DEVICE pGraphicsDevice;
240 PDEVICE_OBJECT pdo;
241 PWCHAR pHardwareId;
242 ULONG cbSize, dwLength;
243 HKEY hkey;
245
246 if (!pustrDevice)
247 {
248 /* Check if some devices have been added since last time */
250 }
251
252 /* Ask gdi for the GRAPHICS_DEVICE */
253 pGraphicsDevice = EngpFindGraphicsDevice(pustrDevice, iDevNum);
254 if (!pGraphicsDevice)
255 {
256 /* No device found */
257 if (iDevNum == 0)
258 ERR("No GRAPHICS_DEVICE found for '%wZ', iDevNum %lu\n", pustrDevice, iDevNum);
259 else
260 TRACE("No GRAPHICS_DEVICE found for '%wZ', iDevNum %lu\n", pustrDevice, iDevNum);
261 return STATUS_UNSUCCESSFUL;
262 }
263
264 /* Open the device map registry key */
265 Status = RegOpenKey(KEY_VIDEO, &hkey);
266 if (!NT_SUCCESS(Status))
267 {
268 /* No device found */
269 ERR("Could not open reg key\n");
270 return STATUS_UNSUCCESSFUL;
271 }
272
273 /* Query the registry path */
274 cbSize = sizeof(pdispdev->DeviceKey);
275 RegQueryValue(hkey,
276 pGraphicsDevice->szNtDeviceName,
277 REG_SZ,
278 pdispdev->DeviceKey,
279 &cbSize);
280
281 /* Close registry key */
282 ZwClose(hkey);
283
284 /* Copy device name, device string and StateFlags */
285 RtlStringCbCopyW(pdispdev->DeviceName, sizeof(pdispdev->DeviceName), pGraphicsDevice->szWinDeviceName);
286 RtlStringCbCopyW(pdispdev->DeviceString, sizeof(pdispdev->DeviceString), pGraphicsDevice->pwszDescription);
287 pdispdev->StateFlags = pGraphicsDevice->StateFlags;
288 pdispdev->DeviceID[0] = UNICODE_NULL;
289
290 /* Fill in DeviceID */
291 if (!pustrDevice)
292 pdo = pGraphicsDevice->PhysDeviceHandle;
293 else
294#if 0
295 pdo = pGraphicsDevice->pvMonDev[iDevNum].pdo;
296#else
297 /* FIXME: pvMonDev not initialized, see EngpRegisterGraphicsDevice */
298 pdo = NULL;
299#endif
300
301 if (pdo != NULL)
302 {
305 0,
306 NULL,
307 &dwLength);
308
310 {
311 pHardwareId = ExAllocatePoolWithTag(PagedPool,
312 dwLength,
314 if (!pHardwareId)
315 {
318 }
319
322 dwLength,
323 pHardwareId,
324 &dwLength);
325
326 if (!NT_SUCCESS(Status))
327 {
328 ERR("IoGetDeviceProperty() failed with status 0x%08lx\n", Status);
329 }
330 else
331 {
332 /* For video adapters it should be the first Hardware ID
333 * which usually is the longest one and unique enough */
334 RtlStringCbCopyW(pdispdev->DeviceID, sizeof(pdispdev->DeviceID), pHardwareId);
335
336 if (pustrDevice)
337 {
338 /* For monitors it should be the first Hardware ID,
339 * which we already have obtained above,
340 * concatenated with the unique driver registry key */
341
342 RtlStringCbCatW(pdispdev->DeviceID, sizeof(pdispdev->DeviceID), L"\\");
343
344 /* FIXME: DevicePropertyDriverKeyName string should be appended */
345 pHardwareId[0] = UNICODE_NULL;
346 RtlStringCbCatW(pdispdev->DeviceID, sizeof(pdispdev->DeviceID), pHardwareId);
347 }
348
349 TRACE("Hardware ID: %ls\n", pdispdev->DeviceID);
350 }
351
353 }
354 else
355 {
356 ERR("IoGetDeviceProperty() failed with status 0x%08lx\n", Status);
357 }
358 }
359
360 return STATUS_SUCCESS;
361}
362
363//NTSTATUS
364BOOL
365NTAPI
367 PUNICODE_STRING pustrDevice,
368 DWORD iDevNum,
369 PDISPLAY_DEVICEW pDisplayDevice,
371{
372 UNICODE_STRING ustrDevice;
373 WCHAR awcDevice[CCHDEVICENAME];
374 DISPLAY_DEVICEW dispdev;
376
377 TRACE("Enter NtUserEnumDisplayDevices(%wZ, %lu)\n",
378 pustrDevice, iDevNum);
379
380 dispdev.cb = sizeof(dispdev);
381
382 if (pustrDevice)
383 {
384 /* Initialize destination string */
385 RtlInitEmptyUnicodeString(&ustrDevice, awcDevice, sizeof(awcDevice));
386
388 {
389 /* Probe the UNICODE_STRING and the buffer */
390 ProbeForRead(pustrDevice, sizeof(UNICODE_STRING), 1);
391 ProbeForRead(pustrDevice->Buffer, pustrDevice->Length, 1);
392
393 /* Copy the string */
394 RtlCopyUnicodeString(&ustrDevice, pustrDevice);
395 }
397 {
398// _SEH2_YIELD(return _SEH2_GetExceptionCode());
400 }
402
403 if (ustrDevice.Length > 0)
404 pustrDevice = &ustrDevice;
405 else
406 pustrDevice = NULL;
407 }
408
409 /* If name is given only iDevNum==0 gives results */
410 if (pustrDevice && iDevNum != 0)
411 return FALSE;
412
413 /* Acquire global USER lock */
415
416 /* Call the internal function */
417 Status = UserEnumDisplayDevices(pustrDevice, iDevNum, &dispdev, dwFlags);
418
419 /* Release lock */
420 UserLeave();
421
422 /* On success copy data to caller */
423 if (NT_SUCCESS(Status))
424 {
425 /* Enter SEH */
427 {
428 /* First probe the cb field */
429 ProbeForWrite(&pDisplayDevice->cb, sizeof(DWORD), 1);
430
431 /* Check the buffer size */
432 if (pDisplayDevice->cb)
433 {
434 /* Probe the output buffer */
435 pDisplayDevice->cb = min(pDisplayDevice->cb, sizeof(dispdev));
436 ProbeForWrite(pDisplayDevice, pDisplayDevice->cb, 1);
437
438 /* Copy as much as the given buffer allows */
439 RtlCopyMemory(pDisplayDevice, &dispdev, pDisplayDevice->cb);
440 }
441 }
443 {
445 }
447 }
448
449 TRACE("Leave NtUserEnumDisplayDevices, Status = 0x%lx\n", Status);
450 /* Return the result */
451// return Status;
452 return NT_SUCCESS(Status); // FIXME
453}
454
456NTAPI
458 PUNICODE_STRING pustrDevice,
459 PDEVMODEW *ppdm)
460{
461 PPDEVOBJ ppdev;
462
463 /* Get the PDEV for the device */
464 ppdev = EngpGetPDEV(pustrDevice);
465 if (!ppdev)
466 {
467 /* No device found */
468 ERR("No PDEV found!\n");
470 }
471
472 *ppdm = ppdev->pdmwDev;
473 PDEVOBJ_vRelease(ppdev);
474
475 return STATUS_SUCCESS;
476}
477
479NTAPI
481 PUNICODE_STRING pustrDevice,
483 LPDEVMODEW *ppdm,
485{
486 PGRAPHICS_DEVICE pGraphicsDevice;
487 PDEVMODEENTRY pdmentry;
488 ULONG i, iFoundMode;
489 PPDEVOBJ ppdev;
490
491 TRACE("Enter UserEnumDisplaySettings('%wZ', %lu)\n",
492 pustrDevice, iModeNum);
493
494 /* Ask GDI for the GRAPHICS_DEVICE */
495 pGraphicsDevice = EngpFindGraphicsDevice(pustrDevice, 0);
496 ppdev = EngpGetPDEV(pustrDevice);
497
498 if (!pGraphicsDevice || !ppdev)
499 {
500 /* No device found */
501 ERR("No device found!\n");
503 }
504
505 /* let's politely ask the driver for an updated mode list,
506 just in case there's something new in there (vbox) */
507
509 PDEVOBJ_vRelease(ppdev);
510
511 iFoundMode = 0;
512 for (i = 0; i < pGraphicsDevice->cDevModes; i++)
513 {
514 pdmentry = &pGraphicsDevice->pDevModeList[i];
515
516 /* FIXME: Consider EDS_RAWMODE */
517#if 0
518 if ((!(dwFlags & EDS_RAWMODE) && (pdmentry->dwFlags & 1)) ||!
519 (dwFlags & EDS_RAWMODE))
520#endif
521 {
522 /* Is this the one we want? */
523 if (iFoundMode == iModeNum)
524 {
525 *ppdm = pdmentry->pdm;
526 return STATUS_SUCCESS;
527 }
528
529 /* Increment number of found modes */
530 iFoundMode++;
531 }
532 }
533
534 /* Nothing was found */
536}
537
539NTAPI
541 OUT PHKEY phkey,
542 IN PUNICODE_STRING pustrDevice,
543 IN BOOL bGlobal)
544{
545 HKEY hkey;
546 DISPLAY_DEVICEW dispdev;
548
549 /* Get device info */
550 Status = UserEnumDisplayDevices(pustrDevice, 0, &dispdev, 0);
551 if (!NT_SUCCESS(Status))
552 return Status;
553
554 if (bGlobal)
555 {
556 // FIXME: Need to fix the registry key somehow
557 }
558
559 /* Open the registry key */
560 Status = RegOpenKey(dispdev.DeviceKey, &hkey);
561 if (!NT_SUCCESS(Status))
562 return Status;
563
564 *phkey = hkey;
565
566 return Status;
567}
568
570NTAPI
572 IN PUNICODE_STRING pustrDevice,
573 OUT LPDEVMODEW pdm)
574{
575 HKEY hkey;
576 NTSTATUS Status = UserOpenDisplaySettingsKey(&hkey, pustrDevice, 0);
577 if(NT_SUCCESS(Status))
578 {
579 RegReadDisplaySettings(hkey, pdm);
580 ZwClose(hkey);
581 return STATUS_SUCCESS;
582 }
583 return Status;
584}
585
589 IN PUNICODE_STRING pustrDevice,
593{
594 UNICODE_STRING ustrDeviceUser;
595 UNICODE_STRING ustrDevice;
596 WCHAR awcDevice[CCHDEVICENAME];
598 ULONG cbSize, cbExtra;
599 DEVMODEW dmReg, *pdm;
600
601 TRACE("Enter NtUserEnumDisplaySettings(%wZ, %lu, %p, 0x%lx)\n",
602 pustrDevice, iModeNum, lpDevMode, dwFlags);
603
605 {
606 ProbeForRead(lpDevMode, sizeof(DEVMODEW), sizeof(UCHAR));
607
608 cbSize = lpDevMode->dmSize;
609 cbExtra = lpDevMode->dmDriverExtra;
610
611 ProbeForWrite(lpDevMode, cbSize + cbExtra, sizeof(UCHAR));
612 }
614 {
616 }
617 _SEH2_END;
618
619 if (cbSize != sizeof(DEVMODEW))
620 {
622 }
623
624 if (pustrDevice)
625 {
626 /* Initialize destination string */
627 RtlInitEmptyUnicodeString(&ustrDevice, awcDevice, sizeof(awcDevice));
628
630 {
631 /* Probe the UNICODE_STRING and the buffer */
632 ustrDeviceUser = ProbeForReadUnicodeString(pustrDevice);
633
634 if (!ustrDeviceUser.Length || !ustrDeviceUser.Buffer)
636
637 ProbeForRead(ustrDeviceUser.Buffer,
638 ustrDeviceUser.Length,
639 sizeof(UCHAR));
640
641 /* Copy the string */
642 RtlCopyUnicodeString(&ustrDevice, &ustrDeviceUser);
643 }
645 {
647 }
648 _SEH2_END;
649
650 pustrDevice = &ustrDevice;
651 }
652
653 /* Acquire global USER lock */
655
657 {
658 /* Get the registry settings */
659 Status = UserEnumRegistryDisplaySettings(pustrDevice, &dmReg);
660 pdm = &dmReg;
661 pdm->dmSize = sizeof(DEVMODEW);
662 }
664 {
665 /* Get the current settings */
666 Status = UserEnumCurrentDisplaySettings(pustrDevice, &pdm);
667 }
668 else
669 {
670 /* Get specified settings */
671 Status = UserEnumDisplaySettings(pustrDevice, iModeNum, &pdm, dwFlags);
672 }
673
674 /* Release lock */
675 UserLeave();
676
677 /* Did we succeed? */
678 if (NT_SUCCESS(Status))
679 {
680 /* Copy some information back */
682 {
683 /* Output what we got */
684 RtlCopyMemory(lpDevMode, pdm, min(cbSize, pdm->dmSize));
685
686 /* Output private/extra driver data */
687 if (cbExtra > 0 && pdm->dmDriverExtra > 0)
688 {
689 RtlCopyMemory((PCHAR)lpDevMode + cbSize,
690 (PCHAR)pdm + pdm->dmSize,
691 min(cbExtra, pdm->dmDriverExtra));
692 }
693 }
695 {
697 }
698 _SEH2_END;
699 }
700
701 return Status;
702}
703
704VOID
706 DWORD flags)
707{
708 if (flags & CDS_FULLSCREEN)
710 else
712}
713
714LONG
717 PUNICODE_STRING pustrDevice,
718 LPDEVMODEW pdm,
719 DWORD flags,
721{
722 DEVMODEW dm;
724 HKEY hkey;
726 PPDEVOBJ ppdev;
727 WORD OrigBC;
728 //PDESKTOP pdesk;
729 PDEVMODEW newDevMode = NULL;
730
731 /* If no DEVMODE is given, use registry settings */
732 if (!pdm)
733 {
734 /* Get the registry settings */
735 Status = UserEnumRegistryDisplaySettings(pustrDevice, &dm);
736 if (!NT_SUCCESS(Status))
737 {
738 ERR("Could not load registry settings\n");
740 }
741 }
742 else if (pdm->dmSize < FIELD_OFFSET(DEVMODEW, dmFields))
743 {
744 return DISP_CHANGE_BADMODE; /* This is what WinXP SP3 returns */
745 }
746 else
747 {
748 dm = *pdm;
749 }
750
751 /* Save original bit count */
752 OrigBC = gpsi->BitCount;
753
754 /* Check params */
756 {
757 ERR("Devmode doesn't specify the resolution.\n");
758 return DISP_CHANGE_BADMODE;
759 }
760
761 /* Get the PDEV */
762 ppdev = EngpGetPDEV(pustrDevice);
763 if (!ppdev)
764 {
765 ERR("Failed to get PDEV\n");
767 }
768
769 /* Fixup values */
770 if (dm.dmBitsPerPel == 0 || !(dm.dmFields & DM_BITSPERPEL))
771 {
772 dm.dmBitsPerPel = ppdev->pdmwDev->dmBitsPerPel;
774 }
775
776 if ((dm.dmFields & DM_DISPLAYFREQUENCY) && (dm.dmDisplayFrequency == 0))
778
779 /* Look for the requested DEVMODE */
780 if (!LDEVOBJ_bProbeAndCaptureDevmode(ppdev->pGraphicsDevice, &dm, &newDevMode, FALSE))
781 {
782 ERR("Could not find a matching DEVMODE\n");
783 lResult = DISP_CHANGE_BADMODE;
784 goto leave;
785 }
786 else if (flags & CDS_TEST)
787 {
788 /* It's possible, go ahead! */
789 lResult = DISP_CHANGE_SUCCESSFUL;
790 goto leave;
791 }
792
793 /* Shall we update the registry? */
795 {
796 /* Open the local or global settings key */
797 Status = UserOpenDisplaySettingsKey(&hkey, pustrDevice, flags & CDS_GLOBAL);
798 if (NT_SUCCESS(Status))
799 {
800 /* Store the settings */
801 RegWriteDisplaySettings(hkey, newDevMode);
802
803 /* Close the registry key */
804 ZwClose(hkey);
805 }
806 else
807 {
808 ERR("Could not open registry key\n");
809 lResult = DISP_CHANGE_NOTUPDATED;
810 }
811 }
812
813 /* Check if DEVMODE matches the current mode */
814 if (newDevMode->dmSize == ppdev->pdmwDev->dmSize &&
815 RtlCompareMemory(newDevMode, ppdev->pdmwDev, newDevMode->dmSize) == newDevMode->dmSize &&
816 !(flags & CDS_RESET))
817 {
818 ERR("DEVMODE matches, nothing to do\n");
819 goto leave;
820 }
821
822 /* Shall we apply the settings? */
823 if (!(flags & CDS_NORESET))
824 {
825 ULONG_PTR ulResult;
826 PVOID pvOldCursor;
827 TEXTMETRICW tmw;
828
829 /* Remove mouse pointer */
830 pvOldCursor = UserSetCursor(NULL, TRUE);
831
832 /* Do the mode switch */
833 ulResult = PDEVOBJ_bSwitchMode(ppdev, newDevMode);
834
835 /* Restore mouse pointer, no hooks called */
836 pvOldCursor = UserSetCursor(pvOldCursor, TRUE);
837 ASSERT(pvOldCursor == NULL);
838
839 /* Check for success or failure */
840 if (!ulResult)
841 {
842 /* Setting mode failed */
843 ERR("Failed to set mode\n");
844
845 /* Set the correct return value */
846 if ((flags & CDS_UPDATEREGISTRY) && (lResult != DISP_CHANGE_NOTUPDATED))
847 lResult = DISP_CHANGE_RESTART;
848 else
849 lResult = DISP_CHANGE_FAILED;
850 }
851 else
852 {
853 /* Setting mode succeeded */
854 lResult = DISP_CHANGE_SUCCESSFUL;
856 ppdev->pdmwDev = newDevMode;
857
859
860 /* Update the system metrics */
861 InitMetrics();
862
863 /* Set new size of the monitor */
864 UserUpdateMonitorSize((HDEV)ppdev);
865
866 /* Update the SERVERINFO */
867 gpsi->dmLogPixels = ppdev->gdiinfo.ulLogPixelsY;
868 gpsi->Planes = ppdev->gdiinfo.cPlanes;
869 gpsi->BitsPixel = ppdev->gdiinfo.cBitsPixel;
870 gpsi->BitCount = gpsi->Planes * gpsi->BitsPixel;
871 gpsi->aiSysMet[SM_CXSCREEN] = ppdev->gdiinfo.ulHorzRes;
872 gpsi->aiSysMet[SM_CYSCREEN] = ppdev->gdiinfo.ulVertRes;
873 if (ppdev->gdiinfo.flRaster & RC_PALETTE)
874 {
875 gpsi->PUSIFlags |= PUSIF_PALETTEDISPLAY;
876 }
877 else
878 {
879 gpsi->PUSIFlags &= ~PUSIF_PALETTEDISPLAY;
880 }
881 // Font is realized and this dc was previously set to internal DC_ATTR.
882 gpsi->cxSysFontChar = IntGetCharDimensions(hSystemBM, &tmw, (DWORD*)&gpsi->cySysFontChar);
883 gpsi->tmSysFont = tmw;
884 }
885
886 /*
887 * Refresh the display on success and even on failure,
888 * since the display may have been messed up.
889 */
890
891 /* Remove all cursor clipping */
893
894 //pdesk = IntGetActiveDesktop();
895 //IntHideDesktop(pdesk);
896
897 /* Send WM_DISPLAYCHANGE to all toplevel windows */
899 WM_DISPLAYCHANGE,
900 gpsi->BitCount,
901 MAKELONG(gpsi->aiSysMet[SM_CXSCREEN], gpsi->aiSysMet[SM_CYSCREEN]),
903 100,
904 &ulResult );
905
906 ERR("BitCount New %d Orig %d ChkNew %d\n",gpsi->BitCount,OrigBC,ppdev->gdiinfo.cBitsPixel);
907
908 /* Not full screen and different bit count, send messages */
909 if (!(flags & CDS_FULLSCREEN) &&
910 gpsi->BitCount != OrigBC)
911 {
912 ERR("Detect settings changed.\n");
915 }
916
917 //co_IntShowDesktop(pdesk, ppdev->gdiinfo.ulHorzRes, ppdev->gdiinfo.ulVertRes);
918
920 }
921
922leave:
923 if (newDevMode && newDevMode != ppdev->pdmwDev)
925
926 /* Release the PDEV */
927 PDEVOBJ_vRelease(ppdev);
928
929 return lResult;
930}
931
932VOID
934 PPROCESSINFO ppiCurrent)
935{
936 if (ppiCurrent == gpFullscreen)
937 {
939 if (gpFullscreen)
940 ERR("Failed to restore display mode!\n");
941 }
942}
943
944LONG
947 PUNICODE_STRING pustrDevice,
951{
952 WCHAR awcDevice[CCHDEVICENAME];
953 UNICODE_STRING ustrDevice;
954 DEVMODEW dmLocal;
955 LONG lRet;
956
957 /* Check arguments */
958 if ((dwflags != CDS_VIDEOPARAMETERS) && (lParam != NULL))
959 {
962 }
963
964 /* Check flags */
966 {
968 }
969
970 if ((dwflags & CDS_RESET) && (dwflags & CDS_NORESET))
971 {
973 }
974
975 /* Copy the device name */
976 if (pustrDevice)
977 {
978 /* Initialize destination string */
979 RtlInitEmptyUnicodeString(&ustrDevice, awcDevice, sizeof(awcDevice));
980
982 {
983 /* Probe the UNICODE_STRING and the buffer */
984 ProbeForRead(pustrDevice, sizeof(UNICODE_STRING), 1);
985 ProbeForRead(pustrDevice->Buffer, pustrDevice->Length, 1);
986
987 /* Copy the string */
988 RtlCopyUnicodeString(&ustrDevice, pustrDevice);
989 }
991 {
992 /* Set and return error */
995 }
997
998 pustrDevice = &ustrDevice;
999 }
1000
1001 /* Copy devmode */
1002 if (lpDevMode)
1003 {
1004 _SEH2_TRY
1005 {
1006 /* Probe the size field of the structure */
1007 ProbeForRead(lpDevMode, sizeof(dmLocal.dmSize), 1);
1008
1009 /* Calculate usable size */
1010 dmLocal.dmSize = min(sizeof(dmLocal), lpDevMode->dmSize);
1011
1012 /* Probe and copy the full DEVMODE */
1013 ProbeForRead(lpDevMode, dmLocal.dmSize, 1);
1014 RtlCopyMemory(&dmLocal, lpDevMode, dmLocal.dmSize);
1015 }
1017 {
1018 /* Set and return error */
1021 }
1022 _SEH2_END
1023
1024 /* Check for extra parameters */
1025 if (dmLocal.dmDriverExtra > 0)
1026 {
1027 /* FIXME: TODO */
1028 ERR("lpDevMode->dmDriverExtra is IGNORED!\n");
1029 dmLocal.dmDriverExtra = 0;
1030 }
1031
1032 /* Use the local structure */
1033 lpDevMode = &dmLocal;
1034 }
1035
1036 // FIXME: Copy videoparameters
1037
1038 /* Acquire global USER lock */
1040
1041 /* Call internal function */
1042 lRet = UserChangeDisplaySettings(pustrDevice, lpDevMode, dwflags, NULL);
1043
1044 /* Release lock */
1045 UserLeave();
1046
1047 return lRet;
1048}
LONG NTSTATUS
Definition: precomp.h:26
#define ERR(fmt,...)
Definition: debug.h:110
#define DBG_DEFAULT_CHANNEL(ch)
Definition: debug.h:103
#define leave
Definition: btrfs_drv.h:138
LPARAM lParam
Definition: combotst.c:139
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define CCHDEVICENAME
Definition: ddrawi.h:63
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define APIENTRY
Definition: api.h:79
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
static DWORD DWORD * dwLength
Definition: fusion.c:86
PSERVERINFO gpsi
Definition: imm.c:18
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define RtlCompareMemory(s1, s2, l)
Definition: env_spec_w32.h:465
#define PagedPool
Definition: env_spec_w32.h:308
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
Status
Definition: gdiplustypes.h:25
GLbitfield flags
Definition: glext.h:7161
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 EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define PUSIF_PALETTEDISPLAY
Definition: ntuser.h:993
HDC hSystemBM
Definition: stockobj.c:52
#define REG_SZ
Definition: layer.c:22
BOOL LDEVOBJ_bProbeAndCaptureDevmode(_Inout_ PGRAPHICS_DEVICE pGraphicsDevice, _In_ PDEVMODEW RequestedMode, _Out_ PDEVMODEW *pSelectedMode, _In_ BOOL bSearchClosestMode)
Definition: ldevobj.c:737
#define ASSERT(a)
Definition: mode.c:44
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
static _In_ DWORD dwflags
Definition: dispmode.c:64
static _In_ DWORD iModeNum
Definition: dispmode.c:77
static _In_ DWORD _Inout_ PDEVMODEA lpDevMode
Definition: dispmode.c:77
#define min(a, b)
Definition: monoChain.cc:55
PCURICON_OBJECT FASTCALL UserSetCursor(PCURICON_OBJECT NewCursor, BOOL ForceChange)
Definition: msgqueue.c:93
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define REG_MULTI_SZ
Definition: nt_native.h:1501
#define DWORD
Definition: nt_native.h:44
#define UNICODE_NULL
#define ExRaiseStatus
Definition: ntoskrnl.h:114
#define STATUS_INVALID_PARAMETER_2
Definition: ntstatus.h:476
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define STATUS_INVALID_PARAMETER_1
Definition: ntstatus.h:475
NTSTRSAFEAPI RtlStringCbCopyW(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cbDest, _In_ NTSTRSAFE_PCWSTR pszSrc)
Definition: ntstrsafe.h:174
NTSTRSAFEAPI RtlStringCbCatW(_Inout_updates_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cbDest, _In_ NTSTRSAFE_PCWSTR pszSrc)
Definition: ntstrsafe.h:636
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:251
PTHREADINFO gptiCurrent
Definition: ntuser.c:15
VOID FASTCALL UserEnterShared(VOID)
Definition: ntuser.c:235
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:242
#define L(x)
Definition: ntvdm.h:50
PPDEVOBJ NTAPI EngpGetPDEV(_In_opt_ PUNICODE_STRING pustrDeviceName)
Definition: pdevobj.c:815
BOOL NTAPI PDEVOBJ_bSwitchMode(PPDEVOBJ ppdev, PDEVMODEW pdm)
Definition: pdevobj.c:712
VOID NTAPI PDEVOBJ_vRelease(_Inout_ PPDEVOBJ ppdev)
Definition: pdevobj.c:105
FORCEINLINE VOID PDEVOBJ_vReference(_In_ PPDEVOBJ ppdev)
Definition: pdevobj.h:160
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
NTSTATUS NTAPI IoGetDeviceProperty(IN PDEVICE_OBJECT DeviceObject, IN DEVICE_REGISTRY_PROPERTY DeviceProperty, IN ULONG BufferLength, OUT PVOID PropertyBuffer, OUT PULONG ResultLength)
Definition: pnpmgr.c:1382
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:159
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:34
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:162
#define REG_DWORD
Definition: sdbapi.c:596
#define ProbeForReadUnicodeString(Ptr)
Definition: probe.h:77
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
#define TRACE(s)
Definition: solgame.cpp:4
PDEVMODEW pdm
Definition: pdevobj.h:53
DWORD dwFlags
Definition: pdevobj.h:52
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
ULONG cBitsPixel
Definition: winddi.h:884
DWORD StateFlags
Definition: pdevobj.h:66
PDEVMODEENTRY pDevModeList
Definition: pdevobj.h:70
WCHAR szWinDeviceName[CCHDEVICENAME/2]
Definition: pdevobj.h:60
WCHAR szNtDeviceName[CCHDEVICENAME/2]
Definition: pdevobj.h:59
LPWSTR pwszDescription
Definition: pdevobj.h:72
ULONG cDevModes
Definition: pdevobj.h:69
PVIDEO_MONITOR_DEVICE pvMonDev
Definition: pdevobj.h:74
PDEVICE_OBJECT PhysDeviceHandle
Definition: pdevobj.h:64
GDIINFO gdiinfo
Definition: pdevobj.h:123
PDEVMODEW pdmwDev
Definition: pdevobj.h:129
PGRAPHICS_DEVICE pGraphicsDevice
Definition: pdevobj.h:127
LONG y
Definition: windef.h:330
LONG x
Definition: windef.h:329
PPROCESSINFO ppi
Definition: win32.h:88
USHORT MaximumLength
Definition: env_spec_w32.h:370
WORD dmDriverExtra
Definition: wingdi.h:1569
WORD dmSize
Definition: wingdi.h:1568
DWORD dmBitsPerPel
Definition: wingdi.h:1647
POINTL dmPosition
Definition: wingdi.h:1635
DWORD dmDisplayFixedOutput
Definition: wingdi.h:1637
DWORD dmFields
Definition: wingdi.h:1622
DWORD dmDisplayOrientation
Definition: wingdi.h:1636
DWORD dmPelsWidth
Definition: wingdi.h:1648
WORD dmDriverExtra
Definition: wingdi.h:1621
DWORD dmDisplayFlags
Definition: wingdi.h:1651
DWORD dmPelsHeight
Definition: wingdi.h:1649
DWORD dmDisplayFrequency
Definition: wingdi.h:1654
WORD dmSize
Definition: wingdi.h:1620
BOOL InitSysParams()
uint16_t * PWSTR
Definition: typedefs.h:56
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define NTAPI
Definition: typedefs.h:36
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
#define MAKELONG(a, b)
Definition: typedefs.h:249
uint16_t * PWCHAR
Definition: typedefs.h:56
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
char * PCHAR
Definition: typedefs.h:51
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
PGRAPHICS_DEVICE NTAPI EngpRegisterGraphicsDevice(_In_ PUNICODE_STRING pustrDeviceName, _In_ PUNICODE_STRING pustrDiplayDrivers, _In_ PUNICODE_STRING pustrDescription)
Definition: device.c:497
PGRAPHICS_DEVICE NTAPI EngpFindGraphicsDevice(_In_opt_ PUNICODE_STRING pustrDevice, _In_ ULONG iDevNum)
Definition: device.c:641
NTSTATUS EngpUpdateGraphicsDeviceList(VOID)
Definition: device.c:174
PGRAPHICS_DEVICE gpPrimaryGraphicsDevice
Definition: device.c:15
PGRAPHICS_DEVICE gpVgaGraphicsDevice
Definition: device.c:16
VOID NTAPI PDEVOBJ_vRefreshModeList(PPDEVOBJ ppdev)
Definition: pdevobj.c:436
VOID FASTCALL SetLastNtError(_In_ NTSTATUS Status)
Definition: error.c:31
DWORD FASTCALL IntGetCharDimensions(HDC hdc, PTEXTMETRICW ptm, PDWORD height)
Definition: font.c:329
VOID NTAPI RegWriteDWORD(HKEY hkey, PCWSTR pwszValue, DWORD dwData)
Definition: registry.c:139
BOOL APIENTRY UserClipCursor(RECTL *prcl)
Definition: cursoricon.c:698
VOID APIENTRY UserRedrawDesktop(VOID)
Definition: desktop.c:1599
NTSTATUS NTAPI UserEnumRegistryDisplaySettings(IN PUNICODE_STRING pustrDevice, OUT LPDEVMODEW pdm)
Definition: display.c:571
VOID UserDisplayNotifyShutdown(PPROCESSINFO ppiCurrent)
Definition: display.c:933
BOOL NTAPI NtUserEnumDisplayDevices(PUNICODE_STRING pustrDevice, DWORD iDevNum, PDISPLAY_DEVICEW pDisplayDevice, DWORD dwFlags)
Definition: display.c:366
NTSTATUS APIENTRY NtUserEnumDisplaySettings(IN PUNICODE_STRING pustrDevice, IN DWORD iModeNum, OUT LPDEVMODEW lpDevMode, IN DWORD dwFlags)
Definition: display.c:588
VOID UserRefreshDisplay(IN PPDEVOBJ ppdev)
Definition: display.c:193
BOOL gbBaseVideo
Definition: display.c:12
NTSTATUS NTAPI UserEnumDisplayDevices(PUNICODE_STRING pustrDevice, DWORD iDevNum, PDISPLAY_DEVICEW pdispdev, DWORD dwFlags)
Definition: display.c:233
VOID UserUpdateFullscreen(DWORD flags)
Definition: display.c:705
#define READ(field, str, flag)
PGRAPHICS_DEVICE NTAPI InitDisplayDriver(IN PWSTR pwszDeviceName, IN PWSTR pwszRegKey)
Definition: display.c:66
LONG APIENTRY UserChangeDisplaySettings(PUNICODE_STRING pustrDevice, LPDEVMODEW pdm, DWORD flags, LPVOID lParam)
Definition: display.c:716
VOID RegWriteDisplaySettings(HKEY hkey, PDEVMODEW pdm)
Definition: display.c:18
NTSTATUS NTAPI InitVideo(VOID)
Definition: display.c:151
NTSTATUS NTAPI UserOpenDisplaySettingsKey(OUT PHKEY phkey, IN PUNICODE_STRING pustrDevice, IN BOOL bGlobal)
Definition: display.c:540
NTSTATUS NTAPI UserEnumDisplaySettings(PUNICODE_STRING pustrDevice, DWORD iModeNum, LPDEVMODEW *ppdm, DWORD dwFlags)
Definition: display.c:480
static const PWCHAR KEY_VIDEO
Definition: display.c:15
static PPROCESSINFO gpFullscreen
Definition: display.c:13
NTSTATUS NTAPI UserEnumCurrentDisplaySettings(PUNICODE_STRING pustrDevice, PDEVMODEW *ppdm)
Definition: display.c:457
VOID RegReadDisplaySettings(HKEY hkey, PDEVMODEW pdm)
Definition: display.c:35
LONG APIENTRY NtUserChangeDisplaySettings(PUNICODE_STRING pustrDevice, LPDEVMODEW lpDevMode, DWORD dwflags, LPVOID lParam)
Definition: display.c:946
BOOL FASTCALL UserSendNotifyMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:2040
LRESULT FASTCALL co_IntSendMessageTimeout(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, UINT uFlags, UINT uTimeout, ULONG_PTR *uResult)
Definition: message.c:1657
BOOL NTAPI InitMetrics(VOID)
Definition: metric.c:44
NTSTATUS NTAPI UserUpdateMonitorSize(IN HDEV hDev)
Definition: monitor.c:225
#define GDITAG_DEVMODE
Definition: tags.h:73
#define USERTAG_DISPLAYINFO
Definition: tags.h:225
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:22
_In_ LPWSTR _In_ ULONG _In_ ULONG _In_ ULONG _Out_ DEVINFO _In_ HDEV _In_ LPWSTR pwszDeviceName
Definition: winddi.h:3556
#define DM_DISPLAYFREQUENCY
Definition: wingdi.h:1272
#define DISPLAY_DEVICE_VGA_COMPATIBLE
Definition: wingdi.h:1400
#define DM_PELSWIDTH
Definition: wingdi.h:1269
#define DM_POSITION
Definition: wingdi.h:1255
#define DM_PANNINGHEIGHT
Definition: wingdi.h:1278
struct _devicemodeW DEVMODEW
#define DM_BITSPERPEL
Definition: wingdi.h:1268
#define DM_DISPLAYORIENTATION
Definition: wingdi.h:1257
#define DM_PELSHEIGHT
Definition: wingdi.h:1270
#define DM_PANNINGWIDTH
Definition: wingdi.h:1277
#define DM_DISPLAYFLAGS
Definition: wingdi.h:1271
#define RC_PALETTE
Definition: wingdi.h:790
#define RegOpenKey
Definition: winreg.h:519
#define RegQueryValue
Definition: winreg.h:523
#define CDS_TEST
Definition: winuser.h:182
#define DISP_CHANGE_NOTUPDATED
Definition: winuser.h:196
#define SM_CYSCREEN
Definition: winuser.h:960
#define CDS_VIDEOPARAMETERS
Definition: winuser.h:186
#define DISP_CHANGE_BADMODE
Definition: winuser.h:195
#define HWND_BROADCAST
Definition: winuser.h:1204
#define DISP_CHANGE_SUCCESSFUL
Definition: winuser.h:190
#define CDS_FULLSCREEN
Definition: winuser.h:183
#define ENUM_REGISTRY_SETTINGS
Definition: winuser.h:180
#define DISP_CHANGE_BADPARAM
Definition: winuser.h:193
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1626
#define CDS_UPDATEREGISTRY
Definition: winuser.h:181
#define DISP_CHANGE_BADFLAGS
Definition: winuser.h:192
#define DISP_CHANGE_FAILED
Definition: winuser.h:194
#define CDS_NORESET
Definition: winuser.h:189
#define WM_SETTINGCHANGE
Definition: winuser.h:1629
#define ENUM_CURRENT_SETTINGS
Definition: winuser.h:179
#define CDS_RESET
Definition: winuser.h:187
#define SM_CXSCREEN
Definition: winuser.h:959
#define DISP_CHANGE_RESTART
Definition: winuser.h:191
#define CDS_GLOBAL
Definition: winuser.h:184
#define SMTO_NORMAL
Definition: winuser.h:1225
@ DevicePropertyHardwareID
Definition: iotypes.h:1196
unsigned char UCHAR
Definition: xmlstorage.h:181
__wchar_t WCHAR
Definition: xmlstorage.h:180