Rémi Bernon : dinput: Return proper error status from HID joystick GetObjectInfo.
Alexandre Julliard
julliard at winehq.org
Mon Sep 27 15:21:43 CDT 2021
Module: wine
Branch: master
Commit: e990e4b232585e9f4b155ddcba898ad5c33d913e
URL: https://source.winehq.org/git/wine.git/?a=commit;h=e990e4b232585e9f4b155ddcba898ad5c33d913e
Author: Rémi Bernon <rbernon at codeweavers.com>
Date: Mon Sep 27 09:43:05 2021 +0200
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 at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/dinput/joystick_hid.c | 7 +++++--
dlls/dinput8/tests/hid.c | 4 ----
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c
index 1b5fe6fd044..ade58166e27 100644
--- a/dlls/dinput/joystick_hid.c
+++ b/dlls/dinput/joystick_hid.c
@@ -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 )
diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c
index d73d4dabfff..c7f5b82c187 100644
--- a/dlls/dinput8/tests/hid.c
+++ b/dlls/dinput8/tests/hid.c
@@ -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 );
More information about the wine-cvs
mailing list