dinput: Proper conversion of username parameters for Set and BuildActionMap.
This commit is contained in:
parent
7e3d51b7c6
commit
64c1f4778c
|
@ -486,14 +486,24 @@ HRESULT WINAPI JoystickAGenericImpl_BuildActionMap(LPDIRECTINPUTDEVICE8A iface,
|
||||||
JoystickGenericImpl *This = impl_from_IDirectInputDevice8A(iface);
|
JoystickGenericImpl *This = impl_from_IDirectInputDevice8A(iface);
|
||||||
DIACTIONFORMATW diafW;
|
DIACTIONFORMATW diafW;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
WCHAR *lpszUserNameW = NULL;
|
||||||
|
int username_size;
|
||||||
|
|
||||||
diafW.rgoAction = HeapAlloc(GetProcessHeap(), 0, sizeof(DIACTIONW)*lpdiaf->dwNumActions);
|
diafW.rgoAction = HeapAlloc(GetProcessHeap(), 0, sizeof(DIACTIONW)*lpdiaf->dwNumActions);
|
||||||
_copy_diactionformatAtoW(&diafW, lpdiaf);
|
_copy_diactionformatAtoW(&diafW, lpdiaf);
|
||||||
|
|
||||||
hr = JoystickWGenericImpl_BuildActionMap(&This->base.IDirectInputDevice8W_iface, &diafW, NULL, dwFlags);
|
if (lpszUserName != NULL)
|
||||||
|
{
|
||||||
|
username_size = MultiByteToWideChar(CP_ACP, 0, lpszUserName, -1, NULL, 0);
|
||||||
|
lpszUserNameW = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*username_size);
|
||||||
|
MultiByteToWideChar(CP_ACP, 0, lpszUserName, -1, lpszUserNameW, username_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = JoystickWGenericImpl_BuildActionMap(&This->base.IDirectInputDevice8W_iface, &diafW, lpszUserNameW, dwFlags);
|
||||||
|
|
||||||
_copy_diactionformatWtoA(lpdiaf, &diafW);
|
_copy_diactionformatWtoA(lpdiaf, &diafW);
|
||||||
HeapFree(GetProcessHeap(), 0, diafW.rgoAction);
|
HeapFree(GetProcessHeap(), 0, diafW.rgoAction);
|
||||||
|
HeapFree(GetProcessHeap(), 0, lpszUserNameW);
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
@ -518,13 +528,23 @@ HRESULT WINAPI JoystickAGenericImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface,
|
||||||
JoystickGenericImpl *This = impl_from_IDirectInputDevice8A(iface);
|
JoystickGenericImpl *This = impl_from_IDirectInputDevice8A(iface);
|
||||||
DIACTIONFORMATW diafW;
|
DIACTIONFORMATW diafW;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
WCHAR *lpszUserNameW = NULL;
|
||||||
|
int username_size;
|
||||||
|
|
||||||
diafW.rgoAction = HeapAlloc(GetProcessHeap(), 0, sizeof(DIACTIONW)*lpdiaf->dwNumActions);
|
diafW.rgoAction = HeapAlloc(GetProcessHeap(), 0, sizeof(DIACTIONW)*lpdiaf->dwNumActions);
|
||||||
_copy_diactionformatAtoW(&diafW, lpdiaf);
|
_copy_diactionformatAtoW(&diafW, lpdiaf);
|
||||||
|
|
||||||
hr = JoystickWGenericImpl_SetActionMap(&This->base.IDirectInputDevice8W_iface, &diafW, NULL, dwFlags);
|
if (lpszUserName != NULL)
|
||||||
|
{
|
||||||
|
username_size = MultiByteToWideChar(CP_ACP, 0, lpszUserName, -1, NULL, 0);
|
||||||
|
lpszUserNameW = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*username_size);
|
||||||
|
MultiByteToWideChar(CP_ACP, 0, lpszUserName, -1, lpszUserNameW, username_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = JoystickWGenericImpl_SetActionMap(&This->base.IDirectInputDevice8W_iface, &diafW, lpszUserNameW, dwFlags);
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, diafW.rgoAction);
|
HeapFree(GetProcessHeap(), 0, diafW.rgoAction);
|
||||||
|
HeapFree(GetProcessHeap(), 0, lpszUserNameW);
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -542,14 +542,24 @@ static HRESULT WINAPI SysKeyboardAImpl_BuildActionMap(LPDIRECTINPUTDEVICE8A ifac
|
||||||
SysKeyboardImpl *This = impl_from_IDirectInputDevice8A(iface);
|
SysKeyboardImpl *This = impl_from_IDirectInputDevice8A(iface);
|
||||||
DIACTIONFORMATW diafW;
|
DIACTIONFORMATW diafW;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
WCHAR *lpszUserNameW = NULL;
|
||||||
|
int username_size;
|
||||||
|
|
||||||
diafW.rgoAction = HeapAlloc(GetProcessHeap(), 0, sizeof(DIACTIONW)*lpdiaf->dwNumActions);
|
diafW.rgoAction = HeapAlloc(GetProcessHeap(), 0, sizeof(DIACTIONW)*lpdiaf->dwNumActions);
|
||||||
_copy_diactionformatAtoW(&diafW, lpdiaf);
|
_copy_diactionformatAtoW(&diafW, lpdiaf);
|
||||||
|
|
||||||
hr = SysKeyboardWImpl_BuildActionMap(&This->base.IDirectInputDevice8W_iface, &diafW, NULL, dwFlags);
|
if (lpszUserName != NULL)
|
||||||
|
{
|
||||||
|
username_size = MultiByteToWideChar(CP_ACP, 0, lpszUserName, -1, NULL, 0);
|
||||||
|
lpszUserNameW = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*username_size);
|
||||||
|
MultiByteToWideChar(CP_ACP, 0, lpszUserName, -1, lpszUserNameW, username_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = SysKeyboardWImpl_BuildActionMap(&This->base.IDirectInputDevice8W_iface, &diafW, lpszUserNameW, dwFlags);
|
||||||
|
|
||||||
_copy_diactionformatWtoA(lpdiaf, &diafW);
|
_copy_diactionformatWtoA(lpdiaf, &diafW);
|
||||||
HeapFree(GetProcessHeap(), 0, diafW.rgoAction);
|
HeapFree(GetProcessHeap(), 0, diafW.rgoAction);
|
||||||
|
HeapFree(GetProcessHeap(), 0, lpszUserNameW);
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
@ -572,13 +582,23 @@ static HRESULT WINAPI SysKeyboardAImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface,
|
||||||
SysKeyboardImpl *This = impl_from_IDirectInputDevice8A(iface);
|
SysKeyboardImpl *This = impl_from_IDirectInputDevice8A(iface);
|
||||||
DIACTIONFORMATW diafW;
|
DIACTIONFORMATW diafW;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
WCHAR *lpszUserNameW = NULL;
|
||||||
|
int username_size;
|
||||||
|
|
||||||
diafW.rgoAction = HeapAlloc(GetProcessHeap(), 0, sizeof(DIACTIONW)*lpdiaf->dwNumActions);
|
diafW.rgoAction = HeapAlloc(GetProcessHeap(), 0, sizeof(DIACTIONW)*lpdiaf->dwNumActions);
|
||||||
_copy_diactionformatAtoW(&diafW, lpdiaf);
|
_copy_diactionformatAtoW(&diafW, lpdiaf);
|
||||||
|
|
||||||
hr = SysKeyboardWImpl_SetActionMap(&This->base.IDirectInputDevice8W_iface, &diafW, NULL, dwFlags);
|
if (lpszUserName != NULL)
|
||||||
|
{
|
||||||
|
username_size = MultiByteToWideChar(CP_ACP, 0, lpszUserName, -1, NULL, 0);
|
||||||
|
lpszUserNameW = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*username_size);
|
||||||
|
MultiByteToWideChar(CP_ACP, 0, lpszUserName, -1, lpszUserNameW, username_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = SysKeyboardWImpl_SetActionMap(&This->base.IDirectInputDevice8W_iface, &diafW, lpszUserNameW, dwFlags);
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, diafW.rgoAction);
|
HeapFree(GetProcessHeap(), 0, diafW.rgoAction);
|
||||||
|
HeapFree(GetProcessHeap(), 0, lpszUserNameW);
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -791,14 +791,24 @@ static HRESULT WINAPI SysMouseAImpl_BuildActionMap(LPDIRECTINPUTDEVICE8A iface,
|
||||||
SysMouseImpl *This = impl_from_IDirectInputDevice8A(iface);
|
SysMouseImpl *This = impl_from_IDirectInputDevice8A(iface);
|
||||||
DIACTIONFORMATW diafW;
|
DIACTIONFORMATW diafW;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
WCHAR *lpszUserNameW = NULL;
|
||||||
|
int username_size;
|
||||||
|
|
||||||
diafW.rgoAction = HeapAlloc(GetProcessHeap(), 0, sizeof(DIACTIONW)*lpdiaf->dwNumActions);
|
diafW.rgoAction = HeapAlloc(GetProcessHeap(), 0, sizeof(DIACTIONW)*lpdiaf->dwNumActions);
|
||||||
_copy_diactionformatAtoW(&diafW, lpdiaf);
|
_copy_diactionformatAtoW(&diafW, lpdiaf);
|
||||||
|
|
||||||
hr = SysMouseWImpl_BuildActionMap(&This->base.IDirectInputDevice8W_iface, &diafW, NULL, dwFlags);
|
if (lpszUserName != NULL)
|
||||||
|
{
|
||||||
|
username_size = MultiByteToWideChar(CP_ACP, 0, lpszUserName, -1, NULL, 0);
|
||||||
|
lpszUserNameW = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*username_size);
|
||||||
|
MultiByteToWideChar(CP_ACP, 0, lpszUserName, -1, lpszUserNameW, username_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = SysMouseWImpl_BuildActionMap(&This->base.IDirectInputDevice8W_iface, &diafW, lpszUserNameW, dwFlags);
|
||||||
|
|
||||||
_copy_diactionformatWtoA(lpdiaf, &diafW);
|
_copy_diactionformatWtoA(lpdiaf, &diafW);
|
||||||
HeapFree(GetProcessHeap(), 0, diafW.rgoAction);
|
HeapFree(GetProcessHeap(), 0, diafW.rgoAction);
|
||||||
|
HeapFree(GetProcessHeap(), 0, lpszUserNameW);
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
@ -821,13 +831,23 @@ static HRESULT WINAPI SysMouseAImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface,
|
||||||
SysMouseImpl *This = impl_from_IDirectInputDevice8A(iface);
|
SysMouseImpl *This = impl_from_IDirectInputDevice8A(iface);
|
||||||
DIACTIONFORMATW diafW;
|
DIACTIONFORMATW diafW;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
WCHAR *lpszUserNameW = NULL;
|
||||||
|
int username_size;
|
||||||
|
|
||||||
diafW.rgoAction = HeapAlloc(GetProcessHeap(), 0, sizeof(DIACTIONW)*lpdiaf->dwNumActions);
|
diafW.rgoAction = HeapAlloc(GetProcessHeap(), 0, sizeof(DIACTIONW)*lpdiaf->dwNumActions);
|
||||||
_copy_diactionformatAtoW(&diafW, lpdiaf);
|
_copy_diactionformatAtoW(&diafW, lpdiaf);
|
||||||
|
|
||||||
hr = SysMouseWImpl_SetActionMap(&This->base.IDirectInputDevice8W_iface, &diafW, NULL, dwFlags);
|
if (lpszUserName != NULL)
|
||||||
|
{
|
||||||
|
username_size = MultiByteToWideChar(CP_ACP, 0, lpszUserName, -1, NULL, 0);
|
||||||
|
lpszUserNameW = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*username_size);
|
||||||
|
MultiByteToWideChar(CP_ACP, 0, lpszUserName, -1, lpszUserNameW, username_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = SysMouseWImpl_SetActionMap(&This->base.IDirectInputDevice8W_iface, &diafW, lpszUserNameW, dwFlags);
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, diafW.rgoAction);
|
HeapFree(GetProcessHeap(), 0, diafW.rgoAction);
|
||||||
|
HeapFree(GetProcessHeap(), 0, lpszUserNameW);
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue