Commit aa43d24c authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

dinput: Return correct errors from HID joystick IDirectInputDevice8_GetDeviceState.

parent 78f04ca0
......@@ -638,12 +638,17 @@ static HRESULT WINAPI hid_joystick_Unacquire( IDirectInputDevice8W *iface )
static HRESULT WINAPI hid_joystick_GetDeviceState( IDirectInputDevice8W *iface, DWORD len, void *ptr )
{
struct hid_joystick *impl = impl_from_IDirectInputDevice8W( iface );
HRESULT hr = DI_OK;
if (!ptr) return DIERR_INVALIDPARAM;
if (len != impl->base.data_format.user_df->dwDataSize) return DIERR_INVALIDPARAM;
fill_DataFormat( ptr, len, &impl->state, &impl->base.data_format );
EnterCriticalSection( &impl->base.crit );
if (!impl->base.acquired) hr = DIERR_NOTACQUIRED;
else fill_DataFormat( ptr, len, &impl->state, &impl->base.data_format );
LeaveCriticalSection( &impl->base.crit );
return DI_OK;
return hr;
}
static BOOL get_object_info( struct hid_joystick *impl, struct hid_caps *caps,
......
......@@ -4093,7 +4093,6 @@ static void test_simple_joystick(void)
ok( hr == DI_OK, "IDirectInputDevice8_SetCooperativeLevel returned: %#x\n", hr );
hr = IDirectInputDevice8_GetDeviceState( device, sizeof(DIJOYSTATE2), &state );
todo_wine
ok( hr == DIERR_NOTACQUIRED, "IDirectInputDevice8_GetDeviceState returned: %#x\n", hr );
hr = IDirectInputDevice8_Poll( device );
......@@ -4107,7 +4106,6 @@ static void test_simple_joystick(void)
ok( hr == DI_NOEFFECT, "IDirectInputDevice8_Poll returned: %#x\n", hr );
hr = IDirectInputDevice8_GetDeviceState( device, sizeof(DIJOYSTATE2) + 1, &state );
todo_wine
ok( hr == DIERR_INVALIDPARAM, "IDirectInputDevice8_GetDeviceState returned: %#x\n", hr );
for (i = 0; i < ARRAY_SIZE(injected_input); ++i)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment