ChangeDisplaySettingsEx() can be called with NULL DeviceName. In this case, we should...
authorAleksey Bragin <aleksey@reactos.org>
Tue, 12 Dec 2006 12:18:17 +0000 (12:18 +0000)
committerAleksey Bragin <aleksey@reactos.org>
Tue, 12 Dec 2006 12:18:17 +0000 (12:18 +0000)
Right now, this case is fixed by substituting the value to a hardcoded one "\\.\DISPLAY1" in case of NULL and call is made to store the values in registry.

svn path=/trunk/; revision=25129

reactos/subsystems/win32/win32k/objects/dc.c

index f52f593..de2c20b 100644 (file)
@@ -2914,6 +2914,7 @@ IntChangeDisplaySettings(
 
     UNICODE_STRING DeviceName;
     UNICODE_STRING RegistryKey;
+    UNICODE_STRING InDeviceName;
     OBJECT_ATTRIBUTES ObjectAttributes;
     HANDLE DevInstRegKey;
     ULONG NewValue;
@@ -2922,6 +2923,14 @@ IntChangeDisplaySettings(
 
     dwflags &= ~CDS_UPDATEREGISTRY;
 
+    /* Check if pDeviceName is NULL, we need to retrieve it */
+    if (pDeviceName == NULL)
+    {
+      /* FIXME: It is a hack, but there is no proper way right now */
+      RtlInitUnicodeString(&InDeviceName, L"\\\\.\\DISPLAY1");
+      pDeviceName = &InDeviceName;
+    }
+
     Status = GetVideoDeviceName(&DeviceName, pDeviceName);
     if (!NT_SUCCESS(Status))
     {