dinput: Return proper error status from HID joystick GetObjectInfo.
When no object matched the enumeration or when DIPH_DEVICE is used. Signed-off-by: Rémi Bernon <rbernon@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
1f8487e2f0
commit
e990e4b232
|
@ -682,6 +682,7 @@ static HRESULT WINAPI hid_joystick_GetObjectInfo( IDirectInputDevice8W *iface, D
|
|||
.dwHow = how,
|
||||
.dwObj = obj
|
||||
};
|
||||
BOOL ret;
|
||||
|
||||
TRACE( "iface %p, instance %p, obj %#x, how %#x.\n", iface, instance, obj, how );
|
||||
|
||||
|
@ -689,9 +690,11 @@ static HRESULT WINAPI hid_joystick_GetObjectInfo( IDirectInputDevice8W *iface, D
|
|||
if (instance->dwSize != sizeof(DIDEVICEOBJECTINSTANCE_DX3W) &&
|
||||
instance->dwSize != sizeof(DIDEVICEOBJECTINSTANCEW))
|
||||
return DIERR_INVALIDPARAM;
|
||||
if (how == DIPH_DEVICE) return DIERR_INVALIDPARAM;
|
||||
|
||||
enum_objects( impl, &filter, DIDFT_ALL, get_object_info, instance );
|
||||
return S_OK;
|
||||
ret = enum_objects( impl, &filter, DIDFT_ALL, get_object_info, instance );
|
||||
if (ret != DIENUM_CONTINUE) return DI_OK;
|
||||
return DIERR_NOTFOUND;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI hid_joystick_GetDeviceInfo( IDirectInputDevice8W *iface, DIDEVICEINSTANCEW *instance )
|
||||
|
|
|
@ -3959,12 +3959,10 @@ static void test_simple_joystick(void)
|
|||
ok( hr == DIERR_INVALIDPARAM, "IDirectInputDevice8_GetObjectInfo returned: %#x\n", hr );
|
||||
objinst.dwSize = sizeof(DIDEVICEOBJECTINSTANCEW);
|
||||
hr = IDirectInputDevice8_GetObjectInfo( device, &objinst, 0, DIPH_DEVICE );
|
||||
todo_wine
|
||||
ok( hr == DIERR_INVALIDPARAM, "IDirectInputDevice8_GetObjectInfo returned: %#x\n", hr );
|
||||
|
||||
res = MAKELONG( HID_USAGE_GENERIC_Z, HID_USAGE_PAGE_GENERIC );
|
||||
hr = IDirectInputDevice8_GetObjectInfo( device, &objinst, res, DIPH_BYUSAGE );
|
||||
todo_wine
|
||||
ok( hr == DIERR_NOTFOUND, "IDirectInputDevice8_GetObjectInfo returned: %#x\n", hr );
|
||||
res = MAKELONG( HID_USAGE_GENERIC_X, HID_USAGE_PAGE_GENERIC );
|
||||
hr = IDirectInputDevice8_GetObjectInfo( device, &objinst, res, DIPH_BYUSAGE );
|
||||
|
@ -3988,14 +3986,12 @@ static void test_simple_joystick(void)
|
|||
check_member( objinst, expect_objects[1], "%u", wReportId );
|
||||
|
||||
hr = IDirectInputDevice8_GetObjectInfo( device, &objinst, 0x14, DIPH_BYOFFSET );
|
||||
todo_wine
|
||||
ok( hr == DIERR_NOTFOUND, "IDirectInputDevice8_GetObjectInfo returned: %#x\n", hr );
|
||||
hr = IDirectInputDevice8_GetObjectInfo( device, &objinst, 0, DIPH_BYOFFSET );
|
||||
todo_wine
|
||||
ok( hr == DIERR_NOTFOUND, "IDirectInputDevice8_GetObjectInfo returned: %#x\n", hr );
|
||||
res = DIDFT_PSHBUTTON | DIDFT_MAKEINSTANCE( 3 );
|
||||
hr = IDirectInputDevice8_GetObjectInfo( device, &objinst, res, DIPH_BYID );
|
||||
todo_wine
|
||||
ok( hr == DIERR_NOTFOUND, "IDirectInputDevice8_GetObjectInfo returned: %#x\n", hr );
|
||||
res = DIDFT_PSHBUTTON | DIDFT_MAKEINSTANCE( 1 );
|
||||
hr = IDirectInputDevice8_GetObjectInfo( device, &objinst, res, DIPH_BYID );
|
||||
|
|
Loading…
Reference in New Issue