Re: [2/4] dinput: Handle username in EnumDevicesBySemantics.
27 Feb
2017
27 Feb
'17
10:12 a.m.
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
3209
Age (days ago)
3209
Last active (days ago)
0 comments
1 participants
participants (1)
-
Andrew Eikum