dinput: Return correct errors from HID joystick IDirectInputDevice8_GetDeviceState.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
78f04ca082
commit
aa43d24cd8
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue