Remove setupapi-Display_Device patchset

This has been reported as fixed upstream and is no longer required.

Thanks Zhiyi Zhang.
This commit is contained in:
Alistair Leslie-Hughes 2019-09-10 18:16:17 +10:00
parent a15bdaa0ba
commit 27b33a4be9
4 changed files with 0 additions and 309 deletions

View File

@ -1,168 +0,0 @@
From c9b3268ab753c5d00ba39968eba4311fdc6e6100 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 11 Feb 2016 03:17:09 +0100
Subject: [PATCH] setupapi: Create registry keys for display devices and
display drivers.
---
dlls/setupapi/devinst.c | 102 +++++++++++++++++++++++++++++++++++++---
loader/wine.inf.in | 2 +
2 files changed, 98 insertions(+), 6 deletions(-)
diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c
index 9b83c3519be..e666d3bb008 100644
--- a/dlls/setupapi/devinst.c
+++ b/dlls/setupapi/devinst.c
@@ -111,6 +111,15 @@ struct driver
WCHAR description[LINE_LEN];
};
+/* GUIDs */
+static const WCHAR displayGUIDW[] = {'{','4','d','3','6','e','9','6','8','-','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};
+static const WCHAR ddriverGUIDW[] = {'{','4','d','3','6','e','9','6','8','-','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','0','0','0',0};
+
/* is used to identify if a DeviceInfoSet pointer is
valid or not */
#define SETUP_DEVICE_INFO_SET_MAGIC 0xd00ff056
@@ -210,6 +219,90 @@ static struct device_iface *get_device_iface(HDEVINFO devinfo, const SP_DEVICE_I
return (struct device_iface *)data->Reserved;
}
+static void create_display_keys(HKEY enumKey, int index, DISPLAY_DEVICEW *disp)
+{
+ static const WCHAR fmtW[] = {'1','3','&','1','2','3','4','5','&','%','d',0};
+ HKEY devKey, intKey;
+ WCHAR buffer[50];
+ LONG l;
+
+ l = RegCreateKeyExW(enumKey, disp->DeviceID, 0, NULL, 0, KEY_ALL_ACCESS,
+ NULL, &devKey, NULL);
+ if (l) return;
+
+ snprintfW(buffer, sizeof(buffer) / sizeof(WCHAR), fmtW, index);
+ l = RegCreateKeyExW(devKey, buffer, 0, NULL, 0, KEY_ALL_ACCESS,
+ NULL, &intKey, NULL);
+ if (!l)
+ {
+ RegSetValueExW(intKey, ClassGUID, 0, REG_SZ, (BYTE *)displayGUIDW, sizeof(displayGUIDW));
+ RegSetValueExW(intKey, Driver, 0, REG_SZ, (BYTE *)ddriverGUIDW, sizeof(ddriverGUIDW));
+ RegCloseKey(intKey);
+ }
+
+ RegCloseKey(devKey);
+}
+
+static void create_display_driver_keys(void)
+{
+ static const WCHAR DriverDateDataW[] = {'D','r','i','v','e','r','D','a','t','e','D','a','t','a',0};
+ HKEY classesKey, driverKey;
+ SYSTEMTIME systime;
+ FILETIME filetime;
+ LONG l;
+
+ l = RegCreateKeyExW(HKEY_LOCAL_MACHINE, ControlClass, 0, NULL, 0, KEY_ALL_ACCESS,
+ NULL, &classesKey, NULL);
+ if (l) return;
+
+ l = RegCreateKeyExW(classesKey, ddriverGUIDW, 0, NULL, 0, KEY_ALL_ACCESS,
+ NULL, &driverKey, NULL);
+ if (!l)
+ {
+ /* we are really keeping our drivers up to date */
+ GetSystemTime(&systime);
+ if (SystemTimeToFileTime(&systime, &filetime))
+ RegSetValueExW(driverKey, DriverDateDataW, 0, REG_BINARY, (BYTE *)&filetime, sizeof(filetime));
+
+ RegCloseKey(driverKey);
+ }
+
+ RegCloseKey(classesKey);
+}
+
+static LONG open_enum_key(HKEY *key)
+{
+ static BOOL initialized = FALSE;
+ DISPLAY_DEVICEW disp;
+ HKEY enumKey;
+ LONG l;
+
+ l = RegCreateKeyExW(HKEY_LOCAL_MACHINE, Enum, 0, NULL, 0, KEY_ALL_ACCESS,
+ NULL, &enumKey, NULL);
+ if (l) return l;
+
+ if (!initialized)
+ {
+ /* Wine currently does not properly distinguish between monitors and
+ * display devices yet. On a multi monitor system the enumeration
+ * returns multiple devices although there is only one graphic card.
+ * To work around this, we stop the enumeration after the first device. */
+
+ TRACE("creating display keys\n");
+
+ disp.cb = sizeof(disp);
+ if (EnumDisplayDevicesW(NULL, 0, &disp, 0))
+ create_display_keys(enumKey, 0, &disp);
+
+ create_display_driver_keys();
+
+ initialized = TRUE;
+ }
+
+ *key = enumKey;
+ return ERROR_SUCCESS;
+}
+
static inline void copy_device_data(SP_DEVINFO_DATA *data, const struct device *device)
{
data->ClassGuid = device->class;
@@ -523,8 +616,7 @@ static HKEY SETUPDI_CreateDevKey(struct device *device)
HKEY enumKey, key = INVALID_HANDLE_VALUE;
LONG l;
- l = RegCreateKeyExW(HKEY_LOCAL_MACHINE, Enum, 0, NULL, 0, KEY_ALL_ACCESS,
- NULL, &enumKey, NULL);
+ l = open_enum_key(&enumKey);
if (!l)
{
RegCreateKeyExW(enumKey, device->instanceId, 0, NULL, 0,
@@ -2143,8 +2235,7 @@ static void SETUPDI_EnumerateMatchingInterfaces(HDEVINFO DeviceInfoSet,
TRACE("%s\n", debugstr_w(enumstr));
- l = RegCreateKeyExW(HKEY_LOCAL_MACHINE, Enum, 0, NULL, 0, KEY_READ, NULL,
- &enumKey, NULL);
+ l = open_enum_key(&enumKey);
for (i = 0; !l; i++)
{
len = ARRAY_SIZE(subKeyName);
@@ -2364,8 +2455,7 @@ static void SETUPDI_EnumerateDevices(HDEVINFO DeviceInfoSet, const GUID *class,
TRACE("%p, %s, %s, %08x\n", DeviceInfoSet, debugstr_guid(class),
debugstr_w(enumstr), flags);
- l = RegCreateKeyExW(HKEY_LOCAL_MACHINE, Enum, 0, NULL, 0, KEY_READ, NULL,
- &enumKey, NULL);
+ l = open_enum_key(&enumKey);
if (enumKey != INVALID_HANDLE_VALUE)
{
if (enumstr)
diff --git a/loader/wine.inf.in b/loader/wine.inf.in
index 4d28a93c359..7a44e0fe713 100644
--- a/loader/wine.inf.in
+++ b/loader/wine.inf.in
@@ -465,6 +465,8 @@ HKLM,System\CurrentControlSet\Control\ContentIndex\Language\Neutral,"Locale",0x1
[ControlClass]
HKLM,System\CurrentControlSet\Control\Class\{4d36e967-e325-11ce-bfc1-08002be10318},,,"Disk drives"
HKLM,System\CurrentControlSet\Control\Class\{4d36e967-e325-11ce-bfc1-08002be10318},"Class",,"DiskDrive"
+HKLM,System\CurrentControlSet\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318},,,"Display drivers"
+HKLM,System\CurrentControlSet\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318},"Class",,"Display"
HKLM,System\CurrentControlSet\Control\Class\{4d36e978-e325-11ce-bfc1-08002be10318},,,"Ports (COM & LPT)"
HKLM,System\CurrentControlSet\Control\Class\{4d36e978-e325-11ce-bfc1-08002be10318},"Class",,"Ports"
HKLM,System\CurrentControlSet\Control\Class\{6bdd1fc6-810f-11d0-bec7-08002be2092f},,,"Imaging devices"
--
2.20.1

View File

@ -1,101 +0,0 @@
From 9732937171cfb05055b0ef8cb2d4fcf7efddf679 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 11 Feb 2016 03:20:33 +0100
Subject: [PATCH] setupapi: Handle the case that a full driver path is passed
to SetupDiGetClassDevs.
---
dlls/setupapi/devinst.c | 26 ++++++++++++++++++++++++--
dlls/setupapi/tests/devinst.c | 25 +++++++++++++++++++++++--
2 files changed, 47 insertions(+), 4 deletions(-)
diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c
index 38d994e3a..846531343 100644
--- a/dlls/setupapi/devinst.c
+++ b/dlls/setupapi/devinst.c
@@ -2455,8 +2455,30 @@ static void SETUPDI_EnumerateDevices(HDEVINFO DeviceInfoSet, const GUID *class,
&enumStrKey);
if (!l)
{
- SETUPDI_EnumerateMatchingDevices(DeviceInfoSet, enumstr,
- enumStrKey, class, flags);
+ WCHAR *bus, *device;
+ HKEY devKey;
+
+ if (!strchrW(enumstr, '\\'))
+ {
+ SETUPDI_EnumerateMatchingDevices(DeviceInfoSet, enumstr,
+ enumStrKey, class, flags);
+ }
+ else if ((bus = strdupW(enumstr)))
+ {
+ device = strchrW(bus, '\\');
+ *device++ = 0;
+
+ l = RegOpenKeyExW(enumKey, enumstr, 0, KEY_READ, &devKey);
+ if (!l)
+ {
+ SETUPDI_EnumerateMatchingDeviceInstances(DeviceInfoSet, bus, device,
+ devKey, class, flags);
+ RegCloseKey(devKey);
+ }
+
+ HeapFree(GetProcessHeap(), 0, bus);
+ }
+
RegCloseKey(enumStrKey);
}
}
diff --git a/dlls/setupapi/tests/devinst.c b/dlls/setupapi/tests/devinst.c
index afb431f8d..332755190 100644
--- a/dlls/setupapi/tests/devinst.c
+++ b/dlls/setupapi/tests/devinst.c
@@ -1884,6 +1884,28 @@ static void test_device_interface_key(void)
SetupDiDestroyDeviceInfoList(set);
}
+static void testSetupDiGetClassDevsA(void)
+{
+ static GUID displayguid = {0x4d36e968, 0xe325, 0x11ce, {0xbf,0xc1,0x08,0x00,0x2b,0xe1,0x03,0x18}};
+ SP_DEVINFO_DATA devinfo;
+ DISPLAY_DEVICEA disp;
+ HDEVINFO set;
+ BOOL ret;
+
+ disp.cb = sizeof(disp);
+ ok(EnumDisplayDevicesA(NULL, 0, &disp, 0), "EnumDisplayDevices failed: %08x\n", GetLastError());
+
+ SetLastError(0xdeadbeef);
+ set = SetupDiGetClassDevsA(&displayguid, disp.DeviceID, 0, 0);
+ ok(set != INVALID_HANDLE_VALUE, "SetupDiGetClassDevsA failed: %08x\n", GetLastError());
+
+ devinfo.cbSize = sizeof(devinfo);
+ ret = SetupDiEnumDeviceInfo(set, 0, &devinfo);
+ ok(ret, "SetupDiEnumDeviceInfo failed: %08x\n", GetLastError());
+
+ SetupDiDestroyDeviceInfoList(set);
+}
+
static void test_device_install_params(void)
{
SP_DEVINFO_DATA device = {sizeof(device)};
@@ -1951,8 +1973,6 @@ static void test_device_install_params(void)
ok(!params.FileQueue, "Got queue %p.\n", params.FileQueue);
ok(!params.ClassInstallReserved, "Got class installer data %#lx.\n", params.ClassInstallReserved);
ok(!strcasecmp(params.DriverPath, "C:\\windows"), "Got driver path %s.\n", params.DriverPath);
-
- SetupDiDestroyDeviceInfoList(set);
}
#ifdef __i386__
@@ -2135,6 +2155,7 @@ START_TEST(devinst)
test_registry_property_a();
test_registry_property_w();
test_get_inf_class();
+ testSetupDiGetClassDevsA();
test_devnode();
test_device_interface_key();
test_device_install_params();
--
2.21.0

View File

@ -1,38 +0,0 @@
From 879401065780700c0236e51d9e52d629d8a9bb8f Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 2 Oct 2016 18:07:18 +0200
Subject: setupapi: Also create HardwareId registry key for display devices.
---
dlls/setupapi/devinst.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c
index 4b67833..67aa98d 100644
--- a/dlls/setupapi/devinst.c
+++ b/dlls/setupapi/devinst.c
@@ -153,7 +153,7 @@ static void create_display_keys(HKEY enumKey, int index, DISPLAY_DEVICEW *disp)
{
static const WCHAR fmtW[] = {'1','3','&','1','2','3','4','5','&','%','d',0};
HKEY devKey, intKey;
- WCHAR buffer[50];
+ WCHAR *str, buffer[50];
LONG l;
l = RegCreateKeyExW(enumKey, disp->DeviceID, 0, NULL, 0, KEY_ALL_ACCESS,
@@ -167,6 +167,12 @@ static void create_display_keys(HKEY enumKey, int index, DISPLAY_DEVICEW *disp)
{
RegSetValueExW(intKey, ClassGUID, 0, REG_SZ, (BYTE *)displayGUIDW, sizeof(displayGUIDW));
RegSetValueExW(intKey, Driver, 0, REG_SZ, (BYTE *)ddriverGUIDW, sizeof(ddriverGUIDW));
+ if ((str = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (strlenW(disp->DeviceID) + 2) * sizeof(WCHAR))))
+ {
+ lstrcpyW(str, disp->DeviceID); /* we need two \0 for REG_MULTI_SZ */
+ RegSetValueExW(intKey, HardwareId, 0, REG_MULTI_SZ, (BYTE *)str, (strlenW(str) + 2) * sizeof(WCHAR));
+ HeapFree(GetProcessHeap(), 0, str);
+ }
RegCloseKey(intKey);
}
--
2.9.0

View File

@ -1,2 +0,0 @@
Fixes: [35345] Fix enumeration of display driver properties using setupapi
Disabled: True