From 547a92d26b034a226b65a64aec229412129bdd61 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sat, 27 May 2017 04:15:55 +0200
Subject: [PATCH] user32: Return a more reasonable display DeviceID.

---
 dlls/user32/misc.c          |  7 ++++++-
 dlls/user32/tests/monitor.c | 12 ++++++++++++
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/dlls/user32/misc.c b/dlls/user32/misc.c
index a6b7644020f..c1c812dbd51 100644
--- a/dlls/user32/misc.c
+++ b/dlls/user32/misc.c
@@ -249,7 +249,12 @@ static const WCHAR adapter_device_deviceid[] = {'P','C','I','\\','V','E','N','_'
                                                 'D','E','V','_','0','0','0','0',0};
 static const WCHAR display_device_name[] = {'%','s','\\','M','o','n','i','t','o','r','0',0};
 static const WCHAR display_device_string[] = {'W','i','n','e',' ','D','i','s','p','l','a','y',0};
-static const WCHAR display_device_deviceid[] = {'M','O','N','I','T','O','R','\\','W','I','N','E','%','0','4','d',0};
+static const WCHAR display_device_deviceid[] = {'M','O','N','I','T','O','R','\\',
+                                                'D','e','f','a','u','l','t','_','M','o','n','i','t','o','r','\\',
+                                                '{','4','D','3','6','E','9','6','E','-','E','3','2','5','-',
+                                                '1','1','C','E','-','B','F','C','1','-',
+                                                '0','8','0','0','2','B','E','1','0','3','1','8','}','\\',
+                                                '%','0','4','d',0};
 
 struct display_devices_enum_info
 {
diff --git a/dlls/user32/tests/monitor.c b/dlls/user32/tests/monitor.c
index 8bf284a5e1c..6a886da1b63 100644
--- a/dlls/user32/tests/monitor.c
+++ b/dlls/user32/tests/monitor.c
@@ -225,6 +225,7 @@ static void test_enumdisplaydevices(void)
     int adapter_index;
     int monitor_index;
     BOOL ret;
+    int num;
 
     if (!pEnumDisplayDevicesA)
     {
@@ -276,6 +277,17 @@ static void test_enumdisplaydevices(void)
     ok(!strcmp(primary_monitor_device_name, primary_device_name),
        "monitor device name %s, device name %s\n", primary_monitor_device_name,
        primary_device_name);
+
+    dd.cb = sizeof(dd);
+    for (num = 0;; num++)
+    {
+        ret = pEnumDisplayDevicesA(primary_device_name, num, &dd, 0);
+        if (!ret) break;
+
+        dd.DeviceID[63] = 0;
+        ok(!strcasecmp(dd.DeviceID, "Monitor\\Default_Monitor\\{4D36E96E-E325-11CE-BFC1-08002BE10318}\\"),
+           "DeviceID \"%s\" does not start with \"Monitor\\Default_Monitor\\...\" prefix\n", dd.DeviceID);
+    }
 }
 
 struct vid_mode
-- 
2.20.1

