dinput: Return DIERR_NOTFOUND when DIPROP_RANGE object isn't found.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Rémi Bernon 2021-09-28 09:30:08 +02:00 committed by Alexandre Julliard
parent 5f6edba5bb
commit 50c1f45441
2 changed files with 4 additions and 6 deletions

View File

@ -515,7 +515,7 @@ static BOOL get_property_prop_range( struct hid_joystick *impl, struct hid_caps
DIPROPRANGE *value = data; DIPROPRANGE *value = data;
value->lMin = value_caps->PhysicalMin; value->lMin = value_caps->PhysicalMin;
value->lMax = value_caps->PhysicalMax; value->lMax = value_caps->PhysicalMax;
return DIENUM_CONTINUE; return DIENUM_STOP;
} }
static HRESULT WINAPI hid_joystick_GetProperty( IDirectInputDevice8W *iface, const GUID *guid, static HRESULT WINAPI hid_joystick_GetProperty( IDirectInputDevice8W *iface, const GUID *guid,
@ -533,8 +533,9 @@ static HRESULT WINAPI hid_joystick_GetProperty( IDirectInputDevice8W *iface, con
{ {
case (DWORD_PTR)DIPROP_RANGE: case (DWORD_PTR)DIPROP_RANGE:
if (header->dwSize != sizeof(DIPROPRANGE)) return DIERR_INVALIDPARAM; if (header->dwSize != sizeof(DIPROPRANGE)) return DIERR_INVALIDPARAM;
enum_objects( impl, header, DIDFT_AXIS, get_property_prop_range, header ); if (enum_objects( impl, header, DIDFT_AXIS, get_property_prop_range, header ) == DIENUM_STOP)
return DI_OK; return DI_OK;
return DIERR_NOTFOUND;
case (DWORD_PTR)DIPROP_PRODUCTNAME: case (DWORD_PTR)DIPROP_PRODUCTNAME:
{ {
DIPROPSTRING *value = (DIPROPSTRING *)header; DIPROPSTRING *value = (DIPROPSTRING *)header;

View File

@ -3908,15 +3908,12 @@ static void test_simple_joystick(void)
prop_range.lMin = 0xdeadbeef; prop_range.lMin = 0xdeadbeef;
prop_range.lMax = 0xdeadbeef; prop_range.lMax = 0xdeadbeef;
hr = IDirectInputDevice8_GetProperty( device, DIPROP_RANGE, &prop_range.diph ); hr = IDirectInputDevice8_GetProperty( device, DIPROP_RANGE, &prop_range.diph );
todo_wine
ok( hr == DIERR_NOTFOUND, "IDirectInputDevice8_GetProperty DIPROP_RANGE returned %#x\n", hr ); ok( hr == DIERR_NOTFOUND, "IDirectInputDevice8_GetProperty DIPROP_RANGE returned %#x\n", hr );
prop_range.diph.dwObj = MAKELONG( 0, HID_USAGE_PAGE_GENERIC ); prop_range.diph.dwObj = MAKELONG( 0, HID_USAGE_PAGE_GENERIC );
hr = IDirectInputDevice8_GetProperty( device, DIPROP_RANGE, &prop_range.diph ); hr = IDirectInputDevice8_GetProperty( device, DIPROP_RANGE, &prop_range.diph );
todo_wine
ok( hr == DIERR_NOTFOUND, "IDirectInputDevice8_GetProperty DIPROP_RANGE returned %#x\n", hr ); ok( hr == DIERR_NOTFOUND, "IDirectInputDevice8_GetProperty DIPROP_RANGE returned %#x\n", hr );
prop_range.diph.dwObj = MAKELONG( HID_USAGE_PAGE_GENERIC, HID_USAGE_GENERIC_X ); prop_range.diph.dwObj = MAKELONG( HID_USAGE_PAGE_GENERIC, HID_USAGE_GENERIC_X );
hr = IDirectInputDevice8_GetProperty( device, DIPROP_RANGE, &prop_range.diph ); hr = IDirectInputDevice8_GetProperty( device, DIPROP_RANGE, &prop_range.diph );
todo_wine
ok( hr == DIERR_NOTFOUND, "IDirectInputDevice8_GetProperty DIPROP_RANGE returned %#x\n", hr ); ok( hr == DIERR_NOTFOUND, "IDirectInputDevice8_GetProperty DIPROP_RANGE returned %#x\n", hr );
prop_range.diph.dwObj = MAKELONG( HID_USAGE_GENERIC_X, HID_USAGE_PAGE_GENERIC ); prop_range.diph.dwObj = MAKELONG( HID_USAGE_GENERIC_X, HID_USAGE_PAGE_GENERIC );
prop_range.lMin = 0xdeadbeef; prop_range.lMin = 0xdeadbeef;