Commit dcb84a45 authored by Florian Will's avatar Florian Will Committed by Alexandre Julliard

dinput: Fix EnumObjects callback return value handling.

This solves an issue in ZUSI 3 settings for DirectInput devices. Delphi defines the True value of the "C-compatible" LongBool type as -1, which wine interpreted to mean DIENUM_STOP because it is != DIENUM_CONTINUE. Change that logic so only an explicit DIENUM_STOP (= 0) return value stops the enumeration of objects.
parent c04319e5
......@@ -730,7 +730,9 @@ static BOOL enum_objects_callback( struct dinput_device *impl, UINT index, struc
struct enum_objects_params *params = data;
if (instance->wUsagePage == HID_USAGE_PAGE_PID && !(instance->dwType & DIDFT_NODATA))
return DIENUM_CONTINUE;
return params->callback( instance, params->context );
/* Applications may return non-zero values instead of DIENUM_CONTINUE. */
return params->callback( instance, params->context ) ? DIENUM_CONTINUE : DIENUM_STOP;
}
static HRESULT WINAPI dinput_device_EnumObjects( IDirectInputDevice8W *iface, LPDIENUMDEVICEOBJECTSCALLBACKW callback,
......
......@@ -1346,7 +1346,7 @@ static void test_sys_mouse( DWORD version )
res = 0;
hr = IDirectInputDevice8_EnumObjects( device, check_object_count_bad_retval, &res, DIDFT_AXIS );
ok( hr == DI_OK, "EnumObjects returned %#lx\n", hr );
todo_wine ok( res == 3, "got %lu expected 3\n", res );
ok( res == 3, "got %lu expected 3\n", res );
objinst.dwSize = sizeof(DIDEVICEOBJECTINSTANCEW);
res = MAKELONG( HID_USAGE_GENERIC_X, HID_USAGE_PAGE_GENERIC );
......
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