Reducing verbosity and fixing typos and potentially interleaved lines.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com ---
v2: Only send the first patches, reduce tests verbosity even more.
dlls/dinput8/tests/driver_hid.c | 16 +++++++++------- dlls/dinput8/tests/driver_hid.h | 11 +++++++++-- dlls/dinput8/tests/hid.c | 21 +++++++++------------ 3 files changed, 27 insertions(+), 21 deletions(-)
diff --git a/dlls/dinput8/tests/driver_hid.c b/dlls/dinput8/tests/driver_hid.c index 45c9f3e14ab..d6f085e4f30 100644 --- a/dlls/dinput8/tests/driver_hid.c +++ b/dlls/dinput8/tests/driver_hid.c @@ -479,7 +479,7 @@ static NTSTATUS WINAPI driver_internal_ioctl( DEVICE_OBJECT *device, IRP *irp )
expect_queue_next( &expect_queue, code, packet, &index, &expect, TRUE ); winetest_push_context( "%s expect[%d]", expect.context, index ); - ok( expect.code == code, "got %#x, expected %#x\n", expect.code, code ); + ok( code == expect.code, "got %#x, expected %#x\n", code, expect.code ); ok( packet->reportId == expect.report_id, "got id %u\n", packet->reportId ); ok( packet->reportBufferLen == expect.report_len, "got len %u\n", packet->reportBufferLen ); ok( RtlCompareMemory( packet->reportBuffer, expect.report_buf, expect.report_len ) == expect.report_len, @@ -503,7 +503,7 @@ static NTSTATUS WINAPI driver_internal_ioctl( DEVICE_OBJECT *device, IRP *irp )
expect_queue_next( &expect_queue, code, packet, &index, &expect, FALSE ); winetest_push_context( "%s expect[%d]", expect.context, index ); - ok( expect.code == code, "got %#x, expected %#x\n", expect.code, code ); + ok( code == expect.code, "got %#x, expected %#x\n", code, expect.code ); ok( packet->reportId == expect.report_id, "got id %u\n", packet->reportId ); ok( packet->reportBufferLen == expect.report_len, "got len %u\n", packet->reportBufferLen ); winetest_pop_context(); @@ -526,7 +526,7 @@ static NTSTATUS WINAPI driver_internal_ioctl( DEVICE_OBJECT *device, IRP *irp )
expect_queue_next( &expect_queue, code, packet, &index, &expect, TRUE ); winetest_push_context( "%s expect[%d]", expect.context, index ); - ok( expect.code == code, "got %#x, expected %#x\n", expect.code, code ); + ok( code == expect.code, "got %#x, expected %#x\n", code, expect.code ); ok( packet->reportId == expect.report_id, "got id %u\n", packet->reportId ); ok( packet->reportBufferLen == expect.report_len, "got len %u\n", packet->reportBufferLen ); ok( RtlCompareMemory( packet->reportBuffer, expect.report_buf, expect.report_len ) == expect.report_len, @@ -550,7 +550,7 @@ static NTSTATUS WINAPI driver_internal_ioctl( DEVICE_OBJECT *device, IRP *irp )
expect_queue_next( &expect_queue, code, packet, &index, &expect, FALSE ); winetest_push_context( "%s expect[%d]", expect.context, index ); - ok( expect.code == code, "got %#x, expected %#x\n", expect.code, code ); + ok( code == expect.code, "got %#x, expected %#x\n", code, expect.code ); ok( packet->reportId == expect.report_id, "got id %u\n", packet->reportId ); ok( packet->reportBufferLen == expect.report_len, "got len %u\n", packet->reportBufferLen ); winetest_pop_context(); @@ -573,7 +573,7 @@ static NTSTATUS WINAPI driver_internal_ioctl( DEVICE_OBJECT *device, IRP *irp )
expect_queue_next( &expect_queue, code, packet, &index, &expect, TRUE ); winetest_push_context( "%s expect[%d]", expect.context, index ); - ok( expect.code == code, "got %#x, expected %#x\n", expect.code, code ); + ok( code == expect.code, "got %#x, expected %#x\n", code, expect.code ); ok( packet->reportId == expect.report_id, "got id %u\n", packet->reportId ); ok( packet->reportBufferLen == expect.report_len, "got len %u\n", packet->reportBufferLen ); ok( RtlCompareMemory( packet->reportBuffer, expect.report_buf, expect.report_len ) == expect.report_len, @@ -586,12 +586,14 @@ static NTSTATUS WINAPI driver_internal_ioctl( DEVICE_OBJECT *device, IRP *irp ) }
case IOCTL_HID_GET_STRING: - todo_wine - ok( 0, "unexpected IOCTL_HID_GET_STRING\n" ); + { + static unsigned int once; + if (!once++) todo_wine ok( 0, "unexpected IOCTL_HID_GET_STRING\n" ); memcpy( irp->UserBuffer, L"Wine Test", sizeof(L"Wine Test") ); irp->IoStatus.Information = sizeof(L"Wine Test"); ret = STATUS_SUCCESS; break; + }
default: ok( 0, "unexpected ioctl %#x\n", code ); diff --git a/dlls/dinput8/tests/driver_hid.h b/dlls/dinput8/tests/driver_hid.h index 4fec0e99e47..6c355760171 100644 --- a/dlls/dinput8/tests/driver_hid.h +++ b/dlls/dinput8/tests/driver_hid.h @@ -147,8 +147,15 @@ static inline void kvprintf( const char *format, va_list ap ) { struct tls_data *data = get_tls_data(); IO_STATUS_BLOCK io; - int len = vsnprintf( data->strings, sizeof(data->strings), format, ap ); - ZwWriteFile( okfile, NULL, NULL, NULL, &io, data->strings, len, NULL, NULL ); + int len = vsnprintf( data->str_pos, sizeof(data->strings) - (data->str_pos - data->strings), format, ap ); + data->str_pos += len; + + if (len && data->str_pos[-1] == '\n') + { + ZwWriteFile( okfile, NULL, NULL, NULL, &io, data->strings, + strlen( data->strings ), NULL, NULL ); + data->str_pos = data->strings; + } }
static inline void WINAPIV kprintf( const char *format, ... ) __WINE_PRINTF_ATTR( 1, 2 ); diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index 66e8c7c0b0d..a4721b246eb 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -594,22 +594,19 @@ static BOOL pnp_driver_start( const WCHAR *resource ) return ret || GetLastError() == ERROR_SERVICE_ALREADY_RUNNING; }
-#define check_member_( file, line, val, exp, fmt, member ) \ - ok_( file, line )((val).member == (exp).member, "got " #member " " fmt ", expected " fmt "\n", \ - (val).member, (exp).member) -#define check_member( val, exp, fmt, member ) \ +#define check_member_( file, line, val, exp, fmt, member ) \ + ok_(file, line)( (val).member == (exp).member, "got " #member " " fmt "\n", (val).member ) +#define check_member( val, exp, fmt, member ) \ check_member_( __FILE__, __LINE__, val, exp, fmt, member )
-#define check_member_guid_( file, line, val, exp, member ) \ - ok_( file, line )(IsEqualGUID( &(val).member, &(exp).member ), "got " #member " %s, expected %s\n", \ - debugstr_guid( &(val).member ), debugstr_guid( &(exp).member )) -#define check_member_guid( val, exp, member ) \ +#define check_member_guid_( file, line, val, exp, member ) \ + ok_(file, line)( IsEqualGUID( &(val).member, &(exp).member ), "got " #member " %s\n", debugstr_guid(&(val).member) ) +#define check_member_guid( val, exp, member ) \ check_member_guid_( __FILE__, __LINE__, val, exp, member )
-#define check_member_wstr_( file, line, val, exp, member ) \ - ok_( file, line )(!wcscmp( (val).member, (exp).member ), "got " #member " %s, expected %s\n", \ - debugstr_w((val).member), debugstr_w((exp).member)) -#define check_member_wstr( val, exp, member ) \ +#define check_member_wstr_( file, line, val, exp, member ) \ + ok_(file, line)( !wcscmp( (val).member, (exp).member ), "got " #member " %s\n", debugstr_w((val).member) ) +#define check_member_wstr( val, exp, member ) \ check_member_wstr_( __FILE__, __LINE__, val, exp, member )
#define check_hidp_caps( a, b ) check_hidp_caps_( __LINE__, a, b )
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput8/tests/hid.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index a4721b246eb..8aeebc62ab7 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -5696,7 +5696,8 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file, DWO hr = IDirectInputDevice8_Unacquire( device ); ok( hr == DI_OK, "Unacquire returned: %#x\n", hr ); set_hid_expect( file, NULL, 0 ); - hr = IDirectInputEffect_SetParameters( effect, &expect_desc, DIEP_DURATION | DIEP_NODOWNLOAD ); + hr = IDirectInputEffect_SetParameters( effect, &expect_desc, DIEP_DURATION ); + todo_wine ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#x\n", hr ); set_hid_expect( file, &expect_dc_reset, sizeof(expect_dc_reset) ); hr = IDirectInputDevice8_Acquire( device ); @@ -6147,6 +6148,20 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file, DWO ok( ref == 0, "Release returned %d\n", ref ); winetest_pop_context(); } + + set_hid_expect( file, &expect_dc_reset, sizeof(expect_dc_reset) ); + hr = IDirectInputDevice8_Unacquire( device ); + ok( hr == DI_OK, "Acquire returned: %#x\n", hr ); + set_hid_expect( file, NULL, 0 ); + hr = IDirectInputDevice8_CreateEffect( device, &GUID_Sine, &expect_desc, &effect, NULL ); + todo_wine + ok( hr == DI_OK, "CreateEffect returned %#x\n", hr ); + ref = IDirectInputEffect_Release( effect ); + ok( ref == 0, "Release returned %d\n", ref ); + set_hid_expect( file, &expect_dc_reset, sizeof(expect_dc_reset) ); + hr = IDirectInputDevice8_Acquire( device ); + ok( hr == DI_OK, "Acquire returned: %#x\n", hr ); + set_hid_expect( file, NULL, 0 ); }
static void test_condition_effect( IDirectInputDevice8W *device, HANDLE file, DWORD version )
From: Ivo Ivanov logos128@gmail.com
When Download or Start failed because device is not acquired.
From: Ivo Ivanov logos128@gmail.com Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51922 Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/joystick_hid.c | 7 ++++--- dlls/dinput8/tests/hid.c | 1 - 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index a5fbfb81332..67a43924e19 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -2406,9 +2406,10 @@ static HRESULT WINAPI hid_joystick_effect_SetParameters( IDirectInputEffect *ifa impl->flags |= flags;
if (flags & DIEP_NODOWNLOAD) return DI_DOWNLOADSKIPPED; - if (flags & DIEP_START) return IDirectInputEffect_Start( iface, 1, 0 ); - if (FAILED(hr = IDirectInputEffect_Download( iface ))) return hr; - if (hr == DI_NOEFFECT) return DI_DOWNLOADSKIPPED; + if (flags & DIEP_START) hr = IDirectInputEffect_Start( iface, 1, 0 ); + else hr = IDirectInputEffect_Download( iface ); + if (hr == DIERR_NOTEXCLUSIVEACQUIRED) return DI_DOWNLOADSKIPPED; + if (FAILED(hr)) return hr; return DI_OK; }
diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index 8aeebc62ab7..9bbe5dbcbcc 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -5697,7 +5697,6 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file, DWO ok( hr == DI_OK, "Unacquire returned: %#x\n", hr ); set_hid_expect( file, NULL, 0 ); hr = IDirectInputEffect_SetParameters( effect, &expect_desc, DIEP_DURATION ); - todo_wine ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#x\n", hr ); set_hid_expect( file, &expect_dc_reset, sizeof(expect_dc_reset) ); hr = IDirectInputDevice8_Acquire( device );
From: Ivo Ivanov logos128@gmail.com
SetParameters returns DI_DOWNLOADSKIPPED if the device is not acquired exclusively.
This fixes Assetto Corsa Competizione and Assetto Corsa not having FFB due to calling CreateEffect before acquiring the device, which skips the effect download and returns DI_DOWNLOADSKIPPED.
In particular, ACC tries twice to create the effect, and each time they unacquire the device to turn off the autocenter, and then create the effect while still in unacquired state, which in turn returns DI_DOWNLOADSKIPPED, etc.
From: Ivo Ivanov logos128@gmail.com Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51922 Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/device.c | 2 +- dlls/dinput8/tests/hid.c | 1 - 2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c index b423337c9ce..c58ffc7ac73 100644 --- a/dlls/dinput/device.c +++ b/dlls/dinput/device.c @@ -1375,7 +1375,7 @@ static HRESULT WINAPI dinput_device_CreateEffect( IDirectInputDevice8W *iface, c if (!impl->acquired || !(impl->dwCoopLevel & DISCL_EXCLUSIVE)) flags |= DIEP_NODOWNLOAD; hr = IDirectInputEffect_SetParameters( *out, params, flags ); if (FAILED(hr)) goto failed; - return hr; + return DI_OK;
failed: IDirectInputEffect_Release( *out ); diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index 9bbe5dbcbcc..78c178086c9 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -6153,7 +6153,6 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file, DWO ok( hr == DI_OK, "Acquire returned: %#x\n", hr ); set_hid_expect( file, NULL, 0 ); hr = IDirectInputDevice8_CreateEffect( device, &GUID_Sine, &expect_desc, &effect, NULL ); - todo_wine ok( hr == DI_OK, "CreateEffect returned %#x\n", hr ); ref = IDirectInputEffect_Release( effect ); ok( ref == 0, "Release returned %d\n", ref );
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput8/tests/hid.c | 230 +++++++++++++++++---------------------- 1 file changed, 98 insertions(+), 132 deletions(-)
diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index 78c178086c9..6fe9b840554 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -3452,6 +3452,99 @@ static BOOL CALLBACK check_created_effect_objects( IDirectInputEffect *effect, v return DIENUM_CONTINUE; }
+static HRESULT create_dinput_device( DWORD version, DIDEVICEINSTANCEW *devinst, IDirectInputDevice8W **device ) +{ + DIPROPDWORD prop_dword = + { + .diph = + { + .dwSize = sizeof(DIPROPDWORD), + .dwHeaderSize = sizeof(DIPROPHEADER), + .dwHow = DIPH_DEVICE, + }, + }; + IDirectInput8W *di8; + IDirectInputW *di; + HRESULT hr; + ULONG ref; + + if (version >= 0x800) + { + hr = DirectInput8Create( instance, version, &IID_IDirectInput8W, (void **)&di8, NULL ); + if (FAILED(hr)) + { + win_skip( "DirectInput8Create returned %#x\n", hr ); + return hr; + } + + hr = IDirectInput8_EnumDevices( di8, DI8DEVCLASS_ALL, find_test_device, devinst, DIEDFL_ALLDEVICES ); + ok( hr == DI_OK, "EnumDevices returned: %#x\n", hr ); + if (!IsEqualGUID( &devinst->guidProduct, &expect_guid_product )) + { + win_skip( "device not found, skipping tests\n" ); + ref = IDirectInput8_Release( di8 ); + ok( ref == 0, "Release returned %d\n", ref ); + return DIERR_DEVICENOTREG; + } + + hr = IDirectInput8_CreateDevice( di8, &devinst->guidInstance, NULL, NULL ); + ok( hr == E_POINTER, "CreateDevice returned %#x\n", hr ); + hr = IDirectInput8_CreateDevice( di8, NULL, device, NULL ); + ok( hr == E_POINTER, "CreateDevice returned %#x\n", hr ); + hr = IDirectInput8_CreateDevice( di8, &GUID_NULL, device, NULL ); + ok( hr == DIERR_DEVICENOTREG, "CreateDevice returned %#x\n", hr ); + hr = IDirectInput8_CreateDevice( di8, &devinst->guidInstance, device, NULL ); + ok( hr == DI_OK, "CreateDevice returned %#x\n", hr ); + + prop_dword.dwData = 0xdeadbeef; + hr = IDirectInputDevice8_GetProperty( *device, DIPROP_VIDPID, &prop_dword.diph ); + ok( hr == DI_OK, "GetProperty DIPROP_VIDPID returned %#x\n", hr ); + /* Wine may get the wrong device here, because the test driver creates another instance of + hidclass.sys, and gets duplicate rawinput handles, which we use in the guidInstance */ + todo_wine_if( prop_dword.dwData != EXPECT_VIDPID ) + ok( prop_dword.dwData == EXPECT_VIDPID, "got %#x expected %#x\n", prop_dword.dwData, EXPECT_VIDPID ); + + ref = IDirectInputDevice8_Release( *device ); + ok( ref == 0, "Release returned %d\n", ref ); + + hr = IDirectInput8_CreateDevice( di8, &expect_guid_product, device, NULL ); + ok( hr == DI_OK, "CreateDevice returned %#x\n", hr ); + + ref = IDirectInput8_Release( di8 ); + todo_wine + ok( ref == 0, "Release returned %d\n", ref ); + } + else + { + hr = DirectInputCreateEx( instance, version, &IID_IDirectInput2W, (void **)&di, NULL ); + if (FAILED(hr)) + { + win_skip( "DirectInputCreateEx returned %#x\n", hr ); + return hr; + } + + hr = IDirectInput_EnumDevices( di, 0, find_test_device, devinst, DIEDFL_ALLDEVICES ); + ok( hr == DI_OK, "EnumDevices returned: %#x\n", hr ); + if (!IsEqualGUID( &devinst->guidProduct, &expect_guid_product )) + { + win_skip( "device not found, skipping tests\n" ); + + ref = IDirectInput_Release( di ); + ok( ref == 0, "Release returned %d\n", ref ); + return DIERR_DEVICENOTREG; + } + + hr = IDirectInput_CreateDevice( di, &expect_guid_product, (IDirectInputDeviceW **)device, NULL ); + ok( hr == DI_OK, "CreateDevice returned %#x\n", hr ); + + ref = IDirectInput_Release( di ); + todo_wine + ok( ref == 0, "Release returned %d\n", ref ); + } + + return DI_OK; +} + static void test_simple_joystick(void) { #include "psh_hid_macros.h" @@ -3793,7 +3886,6 @@ static void test_simple_joystick(void) IDirectInputEffect *effect; DIEFFESCAPE escape = {0}; DIDEVCAPS caps = {0}; - IDirectInput8W *di; HANDLE event, file; char buffer[1024]; DIJOYSTATE2 state; @@ -3809,56 +3901,7 @@ static void test_simple_joystick(void)
cleanup_registry_keys(); if (!dinput_driver_start( report_desc, sizeof(report_desc), &hid_caps )) goto done; - - hr = DirectInput8Create( instance, DIRECTINPUT_VERSION, &IID_IDirectInput8W, (void **)&di, NULL ); - if (FAILED(hr)) - { - win_skip( "DirectInput8Create returned %#x\n", hr ); - goto done; - } - - hr = IDirectInput8_EnumDevices( di, DI8DEVCLASS_ALL, find_test_device, &devinst, DIEDFL_ALLDEVICES ); - ok( hr == DI_OK, "EnumDevices returned: %#x\n", hr ); - if (!IsEqualGUID( &devinst.guidProduct, &expect_guid_product )) - { - win_skip( "device not found, skipping tests\n" ); - IDirectInput8_Release( di ); - goto done; - } - - check_member( devinst, expect_devinst, "%d", dwSize ); - check_member_guid( devinst, expect_devinst, guidProduct ); - check_member( devinst, expect_devinst, "%#x", dwDevType ); - todo_wine - check_member_wstr( devinst, expect_devinst, tszInstanceName ); - todo_wine - check_member_wstr( devinst, expect_devinst, tszProductName ); - check_member_guid( devinst, expect_devinst, guidFFDriver ); - check_member( devinst, expect_devinst, "%04x", wUsagePage ); - check_member( devinst, expect_devinst, "%04x", wUsage ); - - hr = IDirectInput8_CreateDevice( di, &devinst.guidInstance, NULL, NULL ); - ok( hr == E_POINTER, "CreateDevice returned %#x\n", hr ); - hr = IDirectInput8_CreateDevice( di, NULL, &device, NULL ); - ok( hr == E_POINTER, "CreateDevice returned %#x\n", hr ); - hr = IDirectInput8_CreateDevice( di, &GUID_NULL, &device, NULL ); - ok( hr == DIERR_DEVICENOTREG, "CreateDevice returned %#x\n", hr ); - hr = IDirectInput8_CreateDevice( di, &devinst.guidInstance, &device, NULL ); - ok( hr == DI_OK, "CreateDevice returned %#x\n", hr ); - - prop_dword.dwData = 0xdeadbeef; - hr = IDirectInputDevice8_GetProperty( device, DIPROP_VIDPID, &prop_dword.diph ); - ok( hr == DI_OK, "GetProperty DIPROP_VIDPID returned %#x\n", hr ); - /* Wine may get the wrong device here, because the test driver creates another instance of - hidclass.sys, and gets duplicate rawinput handles, which we use in the guidInstance */ - todo_wine_if( prop_dword.dwData != EXPECT_VIDPID ) - ok( prop_dword.dwData == EXPECT_VIDPID, "got %#x expected %#x\n", prop_dword.dwData, EXPECT_VIDPID ); - - ref = IDirectInputDevice8_Release( device ); - ok( ref == 0, "Release returned %d\n", ref ); - - hr = IDirectInput8_CreateDevice( di, &expect_guid_product, &device, NULL ); - ok( hr == DI_OK, "CreateDevice returned %#x\n", hr ); + if (FAILED(hr = create_dinput_device( DIRECTINPUT_VERSION, &devinst, &device ))) goto done;
hr = IDirectInputDevice8_Initialize( device, instance, 0x0700, &GUID_NULL ); todo_wine @@ -4978,9 +5021,6 @@ static void test_simple_joystick(void) CloseHandle( event ); CloseHandle( file );
- ref = IDirectInput8_Release( di ); - ok( ref == 0, "Release returned %d\n", ref ); - done: pnp_driver_stop(); cleanup_registry_keys(); @@ -5239,7 +5279,6 @@ static BOOL test_device_types(void) WCHAR cwd[MAX_PATH], tempdir[MAX_PATH]; IDirectInputDevice8W *device; BOOL success = TRUE; - IDirectInput8W *di; ULONG i, ref; HRESULT hr;
@@ -5258,27 +5297,12 @@ static BOOL test_device_types(void) goto done; }
- hr = DirectInput8Create( instance, DIRECTINPUT_VERSION, &IID_IDirectInput8W, (void **)&di, NULL ); - if (FAILED(hr)) + if (FAILED(hr = create_dinput_device( DIRECTINPUT_VERSION, &devinst, &device ))) { - win_skip( "DirectInput8Create returned %#x\n", hr ); success = FALSE; goto done; }
- hr = IDirectInput8_EnumDevices( di, DI8DEVCLASS_ALL, find_test_device, &devinst, DIEDFL_ALLDEVICES ); - ok( hr == DI_OK, "EnumDevices returned: %#x\n", hr ); - if (!IsEqualGUID( &devinst.guidProduct, &expect_guid_product )) - { - win_skip( "device not found, skipping tests\n" ); - IDirectInput8_Release( di ); - success = FALSE; - goto done; - } - - hr = IDirectInput8_CreateDevice( di, &expect_guid_product, &device, NULL ); - ok( hr == DI_OK, "CreateDevice returned %#x\n", hr ); - hr = IDirectInputDevice8_GetDeviceInfo( device, &devinst ); ok( hr == DI_OK, "GetDeviceInfo returned %#x\n", hr ); check_member( devinst, expect_devinst[i], "%d", dwSize ); @@ -5311,9 +5335,6 @@ static BOOL test_device_types(void) ref = IDirectInputDevice8_Release( device ); ok( ref == 0, "Release returned %d\n", ref );
- ref = IDirectInput8_Release( di ); - ok( ref == 0, "Release returned %d\n", ref ); - done: pnp_driver_stop(); cleanup_registry_keys(); @@ -7474,17 +7495,15 @@ static void test_force_feedback_joystick( DWORD version ) .dwHow = DIPH_DEVICE, }, }; + DIDEVICEINSTANCEW devinst = {.dwSize = sizeof(DIDEVICEINSTANCEW)}; WCHAR cwd[MAX_PATH], tempdir[MAX_PATH]; DIDEVICEOBJECTDATA objdata = {0}; - DIDEVICEINSTANCEW devinst = {0}; DIEFFECTINFOW effectinfo = {0}; IDirectInputDevice8W *device; DIEFFESCAPE escape = {0}; DIDEVCAPS caps = {0}; - IDirectInput8W *di8; - IDirectInputW *di; - ULONG res, ref; char buffer[1024]; + ULONG res, ref; HANDLE file; HRESULT hr; HWND hwnd; @@ -7497,60 +7516,7 @@ static void test_force_feedback_joystick( DWORD version )
cleanup_registry_keys(); if (!dinput_driver_start( report_descriptor, sizeof(report_descriptor), &hid_caps )) goto done; - - if (version >= 0x800) - { - hr = DirectInput8Create( instance, version, &IID_IDirectInput8W, (void **)&di8, NULL ); - if (FAILED(hr)) - { - win_skip( "DirectInput8Create returned %#x\n", hr ); - goto done; - } - - hr = IDirectInput8_EnumDevices( di8, DI8DEVCLASS_ALL, find_test_device, &devinst, DIEDFL_ALLDEVICES ); - ok( hr == DI_OK, "EnumDevices returned: %#x\n", hr ); - if (!IsEqualGUID( &devinst.guidProduct, &expect_guid_product )) - { - win_skip( "device not found, skipping tests\n" ); - ref = IDirectInput8_Release( di8 ); - ok( ref == 0, "Release returned %d\n", ref ); - goto done; - } - - hr = IDirectInput8_CreateDevice( di8, &expect_guid_product, &device, NULL ); - ok( hr == DI_OK, "CreateDevice returned %#x\n", hr ); - - ref = IDirectInput8_Release( di8 ); - todo_wine - ok( ref == 0, "Release returned %d\n", ref ); - } - else - { - hr = DirectInputCreateEx( instance, version, &IID_IDirectInput2W, (void **)&di, NULL ); - if (FAILED(hr)) - { - win_skip( "DirectInputCreateEx returned %#x\n", hr ); - goto done; - } - - hr = IDirectInput_EnumDevices( di, 0, find_test_device, &devinst, DIEDFL_ALLDEVICES ); - ok( hr == DI_OK, "EnumDevices returned: %#x\n", hr ); - if (!IsEqualGUID( &devinst.guidProduct, &expect_guid_product )) - { - win_skip( "device not found, skipping tests\n" ); - - ref = IDirectInput_Release( di ); - ok( ref == 0, "Release returned %d\n", ref ); - goto done; - } - - hr = IDirectInput_CreateDevice( di, &expect_guid_product, (IDirectInputDeviceW **)&device, NULL ); - ok( hr == DI_OK, "CreateDevice returned %#x\n", hr ); - - ref = IDirectInput_Release( di ); - todo_wine - ok( ref == 0, "Release returned %d\n", ref ); - } + if (FAILED(hr = create_dinput_device( version, &devinst, &device ))) goto done;
hr = IDirectInputDevice8_GetDeviceInfo( device, &devinst ); ok( hr == DI_OK, "GetDeviceInfo returned %#x\n", hr );
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=101900
Your paranoid android.
=== w8 (32 bit report) ===
dinput8: hid.c:2201: Test failed: id 0 poll: expected identical reports
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput8/tests/hid.c | 41 ++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-)
diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index 6fe9b840554..007f81688cc 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -5034,7 +5034,7 @@ struct device_desc HIDP_CAPS hid_caps; };
-static BOOL test_device_types(void) +static BOOL test_device_types( DWORD version ) { #include "psh_hid_macros.h" static const unsigned char unknown_desc[] = @@ -5194,32 +5194,36 @@ static BOOL test_device_types(void) }, }, }; - static const DIDEVCAPS expect_caps[] = + const DIDEVCAPS expect_caps[] = { { .dwSize = sizeof(DIDEVCAPS), .dwFlags = DIDC_ATTACHED|DIDC_EMULATED, - .dwDevType = DIDEVTYPE_HID|(DI8DEVTYPESUPPLEMENTAL_UNKNOWN << 8)|DI8DEVTYPE_SUPPLEMENTAL, + .dwDevType = version >= 0x800 ? DIDEVTYPE_HID|(DI8DEVTYPESUPPLEMENTAL_UNKNOWN << 8)|DI8DEVTYPE_SUPPLEMENTAL + : DIDEVTYPE_HID|(DIDEVTYPEJOYSTICK_UNKNOWN << 8)|DIDEVTYPE_JOYSTICK, .dwButtons = 6, }, { .dwSize = sizeof(DIDEVCAPS), .dwFlags = DIDC_ATTACHED|DIDC_EMULATED, - .dwDevType = DIDEVTYPE_HID|(DI8DEVTYPEJOYSTICK_LIMITED << 8)|DI8DEVTYPE_JOYSTICK, + .dwDevType = version >= 0x800 ? DIDEVTYPE_HID|(DI8DEVTYPEJOYSTICK_LIMITED << 8)|DI8DEVTYPE_JOYSTICK + : DIDEVTYPE_HID|(DIDEVTYPEJOYSTICK_UNKNOWN << 8)|DIDEVTYPE_JOYSTICK, .dwAxes = 2, .dwButtons = 6, }, { .dwSize = sizeof(DIDEVCAPS), .dwFlags = DIDC_ATTACHED|DIDC_EMULATED, - .dwDevType = DIDEVTYPE_HID|(DI8DEVTYPEGAMEPAD_STANDARD << 8)|DI8DEVTYPE_GAMEPAD, + .dwDevType = version >= 0x800 ? DIDEVTYPE_HID|(DI8DEVTYPEGAMEPAD_STANDARD << 8)|DI8DEVTYPE_GAMEPAD + : DIDEVTYPE_HID|(DIDEVTYPEJOYSTICK_GAMEPAD << 8)|DIDEVTYPE_JOYSTICK, .dwAxes = 2, .dwButtons = 6, }, { .dwSize = sizeof(DIDEVCAPS), .dwFlags = DIDC_ATTACHED|DIDC_EMULATED, - .dwDevType = DIDEVTYPE_HID|(DI8DEVTYPEJOYSTICK_STANDARD << 8)|DI8DEVTYPE_JOYSTICK, + .dwDevType = version >= 0x800 ? DIDEVTYPE_HID|(DI8DEVTYPEJOYSTICK_STANDARD << 8)|DI8DEVTYPE_JOYSTICK + : DIDEVTYPE_HID|(DIDEVTYPEJOYSTICK_UNKNOWN << 8)|DIDEVTYPE_JOYSTICK, .dwAxes = 3, .dwPOVs = 1, .dwButtons = 5, @@ -5232,7 +5236,8 @@ static BOOL test_device_types(void) .dwSize = sizeof(DIDEVICEINSTANCEW), .guidInstance = expect_guid_product, .guidProduct = expect_guid_product, - .dwDevType = DIDEVTYPE_HID|(DI8DEVTYPESUPPLEMENTAL_UNKNOWN << 8)|DI8DEVTYPE_SUPPLEMENTAL, + .dwDevType = version >= 0x800 ? DIDEVTYPE_HID|(DI8DEVTYPESUPPLEMENTAL_UNKNOWN << 8)|DI8DEVTYPE_SUPPLEMENTAL + : DIDEVTYPE_HID|(DIDEVTYPEJOYSTICK_UNKNOWN << 8)|DIDEVTYPE_JOYSTICK, .tszInstanceName = L"Wine test root driver", .tszProductName = L"Wine test root driver", .guidFFDriver = GUID_NULL, @@ -5243,7 +5248,8 @@ static BOOL test_device_types(void) .dwSize = sizeof(DIDEVICEINSTANCEW), .guidInstance = expect_guid_product, .guidProduct = expect_guid_product, - .dwDevType = DIDEVTYPE_HID|(DI8DEVTYPEJOYSTICK_LIMITED << 8)|DI8DEVTYPE_JOYSTICK, + .dwDevType = version >= 0x800 ? DIDEVTYPE_HID|(DI8DEVTYPEJOYSTICK_LIMITED << 8)|DI8DEVTYPE_JOYSTICK + : DIDEVTYPE_HID|(DIDEVTYPEJOYSTICK_UNKNOWN << 8)|DIDEVTYPE_JOYSTICK, .tszInstanceName = L"Wine test root driver", .tszProductName = L"Wine test root driver", .guidFFDriver = GUID_NULL, @@ -5254,7 +5260,8 @@ static BOOL test_device_types(void) .dwSize = sizeof(DIDEVICEINSTANCEW), .guidInstance = expect_guid_product, .guidProduct = expect_guid_product, - .dwDevType = DIDEVTYPE_HID|(DI8DEVTYPEGAMEPAD_STANDARD << 8)|DI8DEVTYPE_GAMEPAD, + .dwDevType = version >= 0x800 ? DIDEVTYPE_HID|(DI8DEVTYPEGAMEPAD_STANDARD << 8)|DI8DEVTYPE_GAMEPAD + : DIDEVTYPE_HID|(DIDEVTYPEJOYSTICK_GAMEPAD << 8)|DIDEVTYPE_JOYSTICK, .tszInstanceName = L"Wine test root driver", .tszProductName = L"Wine test root driver", .guidFFDriver = GUID_NULL, @@ -5265,7 +5272,8 @@ static BOOL test_device_types(void) .dwSize = sizeof(DIDEVICEINSTANCEW), .guidInstance = expect_guid_product, .guidProduct = expect_guid_product, - .dwDevType = DIDEVTYPE_HID|(DI8DEVTYPEJOYSTICK_STANDARD << 8)|DI8DEVTYPE_JOYSTICK, + .dwDevType = version >= 0x800 ? DIDEVTYPE_HID|(DI8DEVTYPEJOYSTICK_STANDARD << 8)|DI8DEVTYPE_JOYSTICK + : DIDEVTYPE_HID|(DIDEVTYPEJOYSTICK_UNKNOWN << 8)|DIDEVTYPE_JOYSTICK, .tszInstanceName = L"Wine test root driver", .tszProductName = L"Wine test root driver", .guidFFDriver = GUID_NULL, @@ -5282,6 +5290,8 @@ static BOOL test_device_types(void) ULONG i, ref; HRESULT hr;
+ winetest_push_context( "version %#x", version ); + for (i = 0; i < ARRAY_SIZE(device_desc) && success; ++i) { winetest_push_context( "desc[%d]", i ); @@ -5297,7 +5307,7 @@ static BOOL test_device_types(void) goto done; }
- if (FAILED(hr = create_dinput_device( DIRECTINPUT_VERSION, &devinst, &device ))) + if (FAILED(hr = create_dinput_device( version, &devinst, &device ))) { success = FALSE; goto done; @@ -5309,6 +5319,7 @@ static BOOL test_device_types(void) todo_wine check_member_guid( devinst, expect_devinst[i], guidInstance ); check_member_guid( devinst, expect_devinst[i], guidProduct ); + todo_wine_if( version <= 0x700 && i == 3 ) check_member( devinst, expect_devinst[i], "%#x", dwDevType ); todo_wine check_member_wstr( devinst, expect_devinst[i], tszInstanceName ); @@ -5322,6 +5333,7 @@ static BOOL test_device_types(void) ok( hr == DI_OK, "GetCapabilities returned %#x\n", hr ); check_member( caps, expect_caps[i], "%d", dwSize ); check_member( caps, expect_caps[i], "%#x", dwFlags ); + todo_wine_if( version <= 0x700 && i == 3 ) check_member( caps, expect_caps[i], "%#x", dwDevType ); check_member( caps, expect_caps[i], "%d", dwAxes ); check_member( caps, expect_caps[i], "%d", dwButtons ); @@ -5342,6 +5354,8 @@ static BOOL test_device_types(void) winetest_pop_context(); }
+ winetest_pop_context(); + return success; }
@@ -7750,8 +7764,11 @@ START_TEST( hid ) test_hid_driver( 1, TRUE );
CoInitialize( NULL ); - if (test_device_types()) + if (test_device_types( 0x800 )) { + test_device_types( 0x500 ); + test_device_types( 0x700 ); + test_simple_joystick(); test_force_feedback_joystick( 0x500 ); test_force_feedback_joystick( 0x700 );
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=101901
Your paranoid android.
=== w8 (32 bit report) ===
dinput8: hid.c:4812: Test failed: state[0]: WaitForSingleObject succeeded
On 11/15/21 12:03, Marvin wrote:
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=101901
Your paranoid android.
=== w8 (32 bit report) ===
dinput8: hid.c:4812: Test failed: state[0]: WaitForSingleObject succeeded
I don't think this (and the other w8 failure on PATCH 5) are related to these changes, as for instance it passed fine there:
https://testbot.winehq.org/JobDetails.pl?Key=101889