[PATCH 3/3] setupapi: Use lowercase device paths.

Arkadiusz Hiler ahiler at codeweavers.com
Mon Feb 22 05:50:38 CST 2021


Some games are doing case sensitive matches on the device paths obtained from
setupapi and expect them to be lowercase.

This fixes Virginia (and possibly other games using Rewired) not being able to
discover DualShock 4 over bus_udev.

Signed-off-by: Arkadiusz Hiler <ahiler at codeweavers.com>
---
 dlls/setupapi/devinst.c       |  3 +++
 dlls/setupapi/tests/devinst.c | 13 +++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c
index de0413e74f5..d5ddd3a6b41 100644
--- a/dlls/setupapi/devinst.c
+++ b/dlls/setupapi/devinst.c
@@ -403,6 +403,9 @@ static LPWSTR SETUPDI_CreateSymbolicLinkPath(LPCWSTR instanceId,
             lstrcpyW(ret + printed + 1, ReferenceString);
         }
     }
+
+    CharLowerW(ret);
+
     return ret;
 }
 
diff --git a/dlls/setupapi/tests/devinst.c b/dlls/setupapi/tests/devinst.c
index 48b84c21e84..ea8d9b5a682 100644
--- a/dlls/setupapi/tests/devinst.c
+++ b/dlls/setupapi/tests/devinst.c
@@ -1025,6 +1025,18 @@ static void test_register_device_info(void)
     SetupDiDestroyDeviceInfoList(set);
 }
 
+static void check_all_lower_case(int line, const char* str)
+{
+    const char *cur;
+
+    for (cur = str; *cur; cur++)
+    {
+        BOOL is_lower = (tolower(*cur) == *cur);
+        ok_(__FILE__, line)(is_lower, "Expected device path to be all lowercase but got %s.\n", str);
+        if (!is_lower) break;
+    }
+}
+
 static void check_device_iface_(int line, HDEVINFO set, SP_DEVINFO_DATA *device,
         const GUID *class, int index, DWORD flags, const char *path)
 {
@@ -1046,6 +1058,7 @@ static void check_device_iface_(int line, HDEVINFO set, SP_DEVINFO_DATA *device,
         ret = SetupDiGetDeviceInterfaceDetailA(set, &iface, detail, sizeof(buffer), NULL, NULL);
         ok_(__FILE__, line)(ret, "Failed to get interface detail, error %#x.\n", GetLastError());
         ok_(__FILE__, line)(!strcasecmp(detail->DevicePath, path), "Got unexpected path %s.\n", detail->DevicePath);
+        check_all_lower_case(line, detail->DevicePath);
     }
     else
     {
-- 
2.30.1




More information about the wine-devel mailing list