Zhiyi Zhang : setupapi: Support full path enumerator in SetupDiGetClassDevs.

Alexandre Julliard julliard at winehq.org
Wed Jul 31 13:55:52 CDT 2019


Module: wine
Branch: master
Commit: d5e24897e2cd61a5af71a317c1797757acf1b794
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=d5e24897e2cd61a5af71a317c1797757acf1b794

Author: Zhiyi Zhang <zzhang at codeweavers.com>
Date:   Tue Jul 16 17:36:48 2019 +0800

setupapi: Support full path enumerator in SetupDiGetClassDevs.

Based on a patch by Michael Müller.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=35345
Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/setupapi/devinst.c       | 17 +++++++++++++++--
 dlls/setupapi/tests/devinst.c |  6 ------
 2 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c
index a69e826..f0d75f9 100644
--- a/dlls/setupapi/devinst.c
+++ b/dlls/setupapi/devinst.c
@@ -2392,8 +2392,21 @@ static void SETUPDI_EnumerateDevices(HDEVINFO DeviceInfoSet, const GUID *class,
                     &enumStrKey);
             if (!l)
             {
-                SETUPDI_EnumerateMatchingDevices(DeviceInfoSet, enumstr,
-                        enumStrKey, class, flags);
+                WCHAR *bus, *device;
+
+                if (!wcschr(enumstr, '\\'))
+                {
+                    SETUPDI_EnumerateMatchingDevices(DeviceInfoSet, enumstr, enumStrKey, class, flags);
+                }
+                else if ((bus = strdupW(enumstr)))
+                {
+                    device = wcschr(bus, '\\');
+                    *device++ = 0;
+
+                    SETUPDI_EnumerateMatchingDeviceInstances(DeviceInfoSet, bus, device, enumStrKey, class, flags);
+                    HeapFree(GetProcessHeap(), 0, bus);
+                }
+
                 RegCloseKey(enumStrKey);
             }
         }
diff --git a/dlls/setupapi/tests/devinst.c b/dlls/setupapi/tests/devinst.c
index 430dede..57adeeb 100644
--- a/dlls/setupapi/tests/devinst.c
+++ b/dlls/setupapi/tests/devinst.c
@@ -2823,11 +2823,9 @@ static void test_get_class_devs(void)
     set = SetupDiGetClassDevsA(NULL, "ROOT\\LEGACY_BOGUS", NULL, DIGCF_ALLCLASSES);
     ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
     check_device_list(set, &GUID_NULL);
-todo_wine {
     check_device_info(set, 0, &guid2, "ROOT\\LEGACY_BOGUS\\BAR");
     check_device_info(set, 1, &guid, "ROOT\\LEGACY_BOGUS\\FOO");
     check_device_info(set, 2, &guid, "ROOT\\LEGACY_BOGUS\\QUX");
-}
     check_device_info(set, 3, NULL, NULL);
     check_device_iface(set, NULL, &iface_guid, 0, 0, NULL);
     ret = SetupDiDestroyDeviceInfoList(set);
@@ -2836,10 +2834,8 @@ todo_wine {
     set = SetupDiGetClassDevsA(&guid, "ROOT\\LEGACY_BOGUS", NULL, 0);
     ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
     check_device_list(set, &guid);
-todo_wine {
     check_device_info(set, 0, &guid, "ROOT\\LEGACY_BOGUS\\FOO");
     check_device_info(set, 1, &guid, "ROOT\\LEGACY_BOGUS\\QUX");
-}
     check_device_info(set, 2, NULL, NULL);
     check_device_iface(set, NULL, &iface_guid, 0, 0, NULL);
     ret = SetupDiDestroyDeviceInfoList(set);
@@ -2848,11 +2844,9 @@ todo_wine {
     set = SetupDiGetClassDevsA(&guid, "ROOT\\LEGACY_BOGUS", NULL, DIGCF_ALLCLASSES);
     ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
     check_device_list(set, &GUID_NULL);
-todo_wine {
     check_device_info(set, 0, &guid2, "ROOT\\LEGACY_BOGUS\\BAR");
     check_device_info(set, 1, &guid, "ROOT\\LEGACY_BOGUS\\FOO");
     check_device_info(set, 2, &guid, "ROOT\\LEGACY_BOGUS\\QUX");
-}
     check_device_info(set, 3, NULL, NULL);
     check_device_iface(set, NULL, &iface_guid, 0, 0, NULL);
     ret = SetupDiDestroyDeviceInfoList(set);




More information about the wine-cvs mailing list