setupapi: Use lowercase device paths.

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

This fixes Virginia not being able to discover DualShock 4.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Arkadiusz Hiler 2021-12-23 15:33:09 +01:00 committed by Alexandre Julliard
parent a60c5e6961
commit 30a026d245
3 changed files with 17 additions and 1 deletions

View File

@ -100,7 +100,7 @@ static BOOL CALLBACK enum_callback(const DIDEVICEINSTANCEW *instance, void *cont
joystick->num_effects = 0;
IDirectInputDevice8_GetProperty(joystick->device, DIPROP_GUIDANDPATH, &prop_guid_path.diph);
joystick->is_xinput = wcsstr(prop_guid_path.wszPath, L"&IG_") != NULL;
joystick->is_xinput = wcsstr(prop_guid_path.wszPath, L"&ig_") != NULL;
if (joystick->forcefeedback) data->num_ff++;

View File

@ -407,6 +407,9 @@ static LPWSTR SETUPDI_CreateSymbolicLinkPath(LPCWSTR instanceId,
lstrcpyW(ret + printed + 1, ReferenceString);
}
}
CharLowerW(ret);
return ret;
}

View File

@ -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
{