ChangeDisplaySettingsEx() can be called with NULL DeviceName. In this case, we should...
[reactos.git] / 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))
     {