dinput: Convert keyboard buffer from internal data format to user data format.

This commit is contained in:
Vitaliy Margolen 2008-04-24 23:32:32 +03:00 committed by Alexandre Julliard
parent e66b15c204
commit e850b4f13d
2 changed files with 7 additions and 10 deletions

View File

@ -270,7 +270,7 @@ static HRESULT WINAPI SysKeyboardAImpl_GetDeviceState(
if (!This->base.acquired) return DIERR_NOTACQUIRED; if (!This->base.acquired) return DIERR_NOTACQUIRED;
if (len != WINE_DINPUT_KEYBOARD_MAX_KEYS) if (len != This->base.data_format.user_df->dwDataSize )
return DIERR_INVALIDPARAM; return DIERR_INVALIDPARAM;
EnterCriticalSection(&This->base.crit); EnterCriticalSection(&This->base.crit);
@ -282,8 +282,8 @@ static HRESULT WINAPI SysKeyboardAImpl_GetDeviceState(
TRACE(" - %02X: %02x\n", i, This->DInputKeyState[i]); TRACE(" - %02X: %02x\n", i, This->DInputKeyState[i]);
} }
} }
memcpy(ptr, This->DInputKeyState, WINE_DINPUT_KEYBOARD_MAX_KEYS); fill_DataFormat(ptr, This->DInputKeyState, &This->base.data_format);
LeaveCriticalSection(&This->base.crit); LeaveCriticalSection(&This->base.crit);
return DI_OK; return DI_OK;

View File

@ -116,13 +116,10 @@ static void acquire_tests(LPDIRECTINPUT pDI, HWND hwnd)
ok(SUCCEEDED(hr), "IDirectInputDevice_SetDataFormat() failed: %s\n", DXGetErrorString8(hr)); ok(SUCCEEDED(hr), "IDirectInputDevice_SetDataFormat() failed: %s\n", DXGetErrorString8(hr));
hr = IDirectInputDevice_Acquire(pKeyboard); hr = IDirectInputDevice_Acquire(pKeyboard);
ok(SUCCEEDED(hr), "IDirectInputDevice_Acquire() failed: %s\n", DXGetErrorString8(hr)); ok(SUCCEEDED(hr), "IDirectInputDevice_Acquire() failed: %s\n", DXGetErrorString8(hr));
todo_wine hr = IDirectInputDevice_GetDeviceState(pKeyboard, sizeof(custom_state), custom_state);
{ ok(SUCCEEDED(hr), "IDirectInputDevice_GetDeviceState(4,) failed: %s\n", DXGetErrorString8(hr));
hr = IDirectInputDevice_GetDeviceState(pKeyboard, sizeof(custom_state), custom_state); hr = IDirectInputDevice_GetDeviceState(pKeyboard, sizeof(kbd_state), kbd_state);
ok(SUCCEEDED(hr), "IDirectInputDevice_GetDeviceState(4,) failed: %s\n", DXGetErrorString8(hr)); ok(hr == DIERR_INVALIDPARAM, "IDirectInputDevice_GetDeviceState(256,) should have failed: %s\n", DXGetErrorString8(hr));
hr = IDirectInputDevice_GetDeviceState(pKeyboard, sizeof(kbd_state), kbd_state);
ok(hr == DIERR_INVALIDPARAM, "IDirectInputDevice_GetDeviceState(256,) should have failed: %s\n", DXGetErrorString8(hr));
}
if (pKeyboard) IUnknown_Release(pKeyboard); if (pKeyboard) IUnknown_Release(pKeyboard);
} }