[PATCH 1/3] RawInput: Uppercase the device names up to the GUID.

Rémi Bernon rbernon at codeweavers.com
Wed Feb 24 01:55:07 CST 2021


On 2/22/21 12:50 PM, Arkadiusz Hiler wrote:
> This is a preparation for a patch that changes setupapi to return lowercased
> device paths, which is the source of RawInput device names. On Windows
> RawInput returns mostly uppercase names (except the GUID part) and we want to
> keep Wine's old behavior in this regards as SDL 2.0.14+ looks for uppercase IG_
> to match xinput devices to their RawInput counterparts.
> 
> Signed-off-by: Arkadiusz Hiler <ahiler at codeweavers.com>
> ---
>   dlls/user32/rawinput.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/dlls/user32/rawinput.c b/dlls/user32/rawinput.c
> index ba11a121bc5..13aac0278d5 100644
> --- a/dlls/user32/rawinput.c
> +++ b/dlls/user32/rawinput.c
> @@ -94,7 +94,7 @@ static struct device *add_device(HDEVINFO set, SP_DEVICE_INTERFACE_DATA *iface)
>       SP_DEVICE_INTERFACE_DETAIL_DATA_W *detail;
>       struct device *device;
>       HANDLE file;
> -    WCHAR *path;
> +    WCHAR *path, *pos;
>       DWORD size;
>   
>       SetupDiGetDeviceInterfaceDetailW(set, iface, NULL, 0, &size, NULL);
> @@ -121,6 +121,9 @@ static struct device *add_device(HDEVINFO set, SP_DEVICE_INTERFACE_DATA *iface)
>       }
>       heap_free(detail);
>   
> +    /* upper case everything but the GUID */
> +    for (pos = path; *pos && *pos != '{'; pos++) *pos = towupper(*pos);
> +
>       file = CreateFileW(path, GENERIC_READ | GENERIC_WRITE,
>               FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0);
>       if (file == INVALID_HANDLE_VALUE)
> 

Hi Arek!

I'd think a test to validate this could be nice. I know we don't have 
any gamepad device available on the test bot, but maybe it's still 
possible to validate at least with with mouse / keyboard devices? It 
would also let us check the test manually on a real Windows with a 
gamepad plugged in.

Also, the commit title should probably be "user32:", not "RawInput:".

Cheers,
-- 
Rémi Bernon <rbernon at codeweavers.com>



More information about the wine-devel mailing list