[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-devel
Subject:    Re: [2/4] dinput: Handle username in EnumDevicesBySemantics.
From:       Andrew Eikum <aeikum () codeweavers ! com>
Date:       2017-02-27 16:12:36
Message-ID: 20170227161235.GS22656 () foghorn ! codeweavers ! com
[Download RAW message or body]

On Thu, Feb 23, 2017 at 01:22:19AM +0200, Jetro Jormalainen wrote:
> @@ -955,6 +998,14 @@ static HRESULT WINAPI IDirectInput8AImpl_EnumDevicesBySemantics(
>  
>      didevi.dwSize = sizeof(didevi);
>  
> +    if (ptszUserName)
> +    {
> +        username_size = MultiByteToWideChar(CP_ACP, 0, ptszUserName, -1, 0, 0);
> +        MultiByteToWideChar(CP_ACP, 0, ptszUserName, -1, username_w, username_size);

Normally, we use the return from MultiByteToWideChar to allocate the
destination buffer. You could switch to that. I'm not opposed to doing
it on the stack like this, but then there's no need for username_size.
You can just pass the size of the buffer in WCHARs as the last param
of MultiByteToWideChar.

Andrew



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic