Signed-off-by: Rémi Bernon rbernon@codeweavers.com ---
v2: Remove unnecessary length checks in PATCH 3 instead of borking them.
dlls/dinput/tests/driver_bus.c | 2 +- dlls/dinput/tests/driver_hid.h | 4 +++- dlls/dinput/tests/force_feedback.c | 11 +++++++---- dlls/dinput/tests/hid.c | 4 ++++ dlls/dinput/tests/hotplug.c | 1 + dlls/dinput/tests/joystick8.c | 21 ++++++++++++++++----- 6 files changed, 32 insertions(+), 11 deletions(-)
diff --git a/dlls/dinput/tests/driver_bus.c b/dlls/dinput/tests/driver_bus.c index 45a984b6c36..9ece4414a1a 100644 --- a/dlls/dinput/tests/driver_bus.c +++ b/dlls/dinput/tests/driver_bus.c @@ -458,7 +458,7 @@ struct phys_device
BOOL use_report_id; DWORD report_descriptor_len; - char report_descriptor_buf[1024]; + char report_descriptor_buf[MAX_HID_DESCRIPTOR_LEN];
HIDP_CAPS caps; HID_DEVICE_ATTRIBUTES attributes; diff --git a/dlls/dinput/tests/driver_hid.h b/dlls/dinput/tests/driver_hid.h index 1010499fc41..4711d391bfe 100644 --- a/dlls/dinput/tests/driver_hid.h +++ b/dlls/dinput/tests/driver_hid.h @@ -62,13 +62,15 @@ struct hid_expect };
/* create/remove device */ +#define MAX_HID_DESCRIPTOR_LEN 2048 + struct hid_device_desc { BOOL is_polled; BOOL use_report_id;
DWORD report_descriptor_len; - char report_descriptor_buf[1024]; + char report_descriptor_buf[MAX_HID_DESCRIPTOR_LEN];
HIDP_CAPS caps; HID_DEVICE_ATTRIBUTES attributes; diff --git a/dlls/dinput/tests/force_feedback.c b/dlls/dinput/tests/force_feedback.c index d9dad38446c..f6525657450 100644 --- a/dlls/dinput/tests/force_feedback.c +++ b/dlls/dinput/tests/force_feedback.c @@ -1672,7 +1672,8 @@ static void test_condition_effect( IDirectInputDevice8W *device, HANDLE file, DW static BOOL test_force_feedback_joystick( DWORD version ) { #include "psh_hid_macros.h" - const unsigned char report_descriptor[] = { + const unsigned char report_descriptor[] = + { USAGE_PAGE(1, HID_USAGE_PAGE_GENERIC), USAGE(1, HID_USAGE_GENERIC_JOYSTICK), COLLECTION(1, Application), @@ -2005,7 +2006,7 @@ static BOOL test_force_feedback_joystick( DWORD version ) END_COLLECTION, END_COLLECTION, }; -#undef REPORT_ID_OR_USAGE_PAGE + C_ASSERT(sizeof(report_descriptor) < MAX_HID_DESCRIPTOR_LEN); #include "pop_hid_macros.h"
struct hid_device_desc desc = @@ -3460,6 +3461,7 @@ static void test_device_managed_effect(void) END_COLLECTION, END_COLLECTION, }; + C_ASSERT(sizeof(report_descriptor) < MAX_HID_DESCRIPTOR_LEN); #include "pop_hid_macros.h"
struct hid_device_desc desc = @@ -4576,7 +4578,8 @@ struct bool_async_handler default_bool_async_handler = {{&bool_async_handler_vtb static void test_windows_gaming_input(void) { #include "psh_hid_macros.h" - const unsigned char report_desc[] = { + const unsigned char report_desc[] = + { USAGE_PAGE(1, HID_USAGE_PAGE_GENERIC), USAGE(1, HID_USAGE_GENERIC_JOYSTICK), COLLECTION(1, Application), @@ -4997,7 +5000,7 @@ static void test_windows_gaming_input(void) END_COLLECTION, END_COLLECTION, }; -#undef REPORT_ID_OR_USAGE_PAGE + C_ASSERT(sizeof(report_desc) < MAX_HID_DESCRIPTOR_LEN); #include "pop_hid_macros.h"
struct hid_device_desc desc = diff --git a/dlls/dinput/tests/hid.c b/dlls/dinput/tests/hid.c index 4e107625064..66019e766ad 100644 --- a/dlls/dinput/tests/hid.c +++ b/dlls/dinput/tests/hid.c @@ -2855,6 +2855,7 @@ static void test_hid_driver( DWORD report_id, DWORD polled ) END_COLLECTION, }; #undef REPORT_ID_OR_USAGE_PAGE + C_ASSERT(sizeof(report_desc) < MAX_HID_DESCRIPTOR_LEN); #include "pop_hid_macros.h"
const HIDP_CAPS caps = @@ -3063,6 +3064,7 @@ static void test_hidp_kdr(void) END_COLLECTION, END_COLLECTION, }; + C_ASSERT(sizeof(report_desc) < MAX_HID_DESCRIPTOR_LEN); #include "pop_hid_macros.h"
struct hid_device_desc desc = @@ -3572,6 +3574,7 @@ DWORD WINAPI dinput_test_device_thread( void *stop_event ) END_COLLECTION, END_COLLECTION, }; + C_ASSERT(sizeof(gamepad_desc) < MAX_HID_DESCRIPTOR_LEN); #include "pop_hid_macros.h" static const HID_DEVICE_ATTRIBUTES attributes = { @@ -3616,6 +3619,7 @@ static void test_bus_driver(void) INPUT(1, Data|Var|Abs), END_COLLECTION, }; + C_ASSERT(sizeof(report_desc) < MAX_HID_DESCRIPTOR_LEN); #include "pop_hid_macros.h"
static const HID_DEVICE_ATTRIBUTES attributes = diff --git a/dlls/dinput/tests/hotplug.c b/dlls/dinput/tests/hotplug.c index 2d000317c9f..fca04c36ef5 100644 --- a/dlls/dinput/tests/hotplug.c +++ b/dlls/dinput/tests/hotplug.c @@ -133,6 +133,7 @@ static BOOL test_input_lost( DWORD version ) END_COLLECTION, END_COLLECTION, }; + C_ASSERT(sizeof(report_desc) < MAX_HID_DESCRIPTOR_LEN); #include "pop_hid_macros.h"
struct hid_device_desc desc = diff --git a/dlls/dinput/tests/joystick8.c b/dlls/dinput/tests/joystick8.c index 32d03a603c3..eeb8b90d0c8 100644 --- a/dlls/dinput/tests/joystick8.c +++ b/dlls/dinput/tests/joystick8.c @@ -396,7 +396,7 @@ static void test_simple_joystick( DWORD version ) END_COLLECTION, END_COLLECTION, }; -#undef REPORT_ID_OR_USAGE_PAGE + C_ASSERT(sizeof(report_desc) < MAX_HID_DESCRIPTOR_LEN); #include "pop_hid_macros.h"
struct hid_device_desc desc = @@ -2110,6 +2110,7 @@ static BOOL test_device_types( DWORD version ) END_COLLECTION, END_COLLECTION, }; + C_ASSERT(sizeof(unknown_desc) < MAX_HID_DESCRIPTOR_LEN); static const unsigned char limited_desc[] = { USAGE_PAGE(1, HID_USAGE_PAGE_GENERIC), @@ -2140,6 +2141,7 @@ static BOOL test_device_types( DWORD version ) END_COLLECTION, END_COLLECTION, }; + C_ASSERT(sizeof(limited_desc) < MAX_HID_DESCRIPTOR_LEN); static const unsigned char gamepad_desc[] = { USAGE_PAGE(1, HID_USAGE_PAGE_GENERIC), @@ -2170,6 +2172,7 @@ static BOOL test_device_types( DWORD version ) END_COLLECTION, END_COLLECTION, }; + C_ASSERT(sizeof(gamepad_desc) < MAX_HID_DESCRIPTOR_LEN); static const unsigned char joystick_desc[] = { USAGE_PAGE(1, HID_USAGE_PAGE_GENERIC), @@ -2210,6 +2213,7 @@ static BOOL test_device_types( DWORD version ) END_COLLECTION, END_COLLECTION, }; + C_ASSERT(sizeof(joystick_desc) < MAX_HID_DESCRIPTOR_LEN); static const unsigned char wheel_steering_only_desc[] = { USAGE_PAGE(1, HID_USAGE_PAGE_GENERIC), @@ -2248,6 +2252,7 @@ static BOOL test_device_types( DWORD version ) END_COLLECTION, END_COLLECTION, }; + C_ASSERT(sizeof(wheel_steering_only_desc) < MAX_HID_DESCRIPTOR_LEN); static const unsigned char wheel_dualpedals_desc[] = { USAGE_PAGE(1, HID_USAGE_PAGE_GENERIC), @@ -2289,6 +2294,7 @@ static BOOL test_device_types( DWORD version ) END_COLLECTION, END_COLLECTION, }; + C_ASSERT(sizeof(wheel_dualpedals_desc) < MAX_HID_DESCRIPTOR_LEN); static const unsigned char wheel_threepedals_desc[] = { USAGE_PAGE(1, HID_USAGE_PAGE_GENERIC), @@ -2331,6 +2337,7 @@ static BOOL test_device_types( DWORD version ) END_COLLECTION, END_COLLECTION, }; + C_ASSERT(sizeof(wheel_threepedals_desc) < MAX_HID_DESCRIPTOR_LEN); #include "pop_hid_macros.h"
static struct device_desc device_desc[] = @@ -2690,7 +2697,7 @@ static void test_many_axes_joystick(void) END_COLLECTION, END_COLLECTION, }; -#undef REPORT_ID_OR_USAGE_PAGE + C_ASSERT(sizeof(report_desc) < MAX_HID_DESCRIPTOR_LEN); #include "pop_hid_macros.h"
struct hid_device_desc desc = @@ -3221,7 +3228,7 @@ static void test_driving_wheel_axes(void) END_COLLECTION, END_COLLECTION, }; -#undef REPORT_ID_OR_USAGE_PAGE + C_ASSERT(sizeof(report_desc) < MAX_HID_DESCRIPTOR_LEN); #include "pop_hid_macros.h"
struct hid_device_desc desc = @@ -3415,7 +3422,8 @@ done: static BOOL test_winmm_joystick(void) { #include "psh_hid_macros.h" - const unsigned char report_desc[] = { + const unsigned char report_desc[] = + { USAGE_PAGE(1, HID_USAGE_PAGE_GENERIC), USAGE(1, HID_USAGE_GENERIC_JOYSTICK), COLLECTION(1, Application), @@ -3461,6 +3469,7 @@ static BOOL test_winmm_joystick(void) END_COLLECTION, END_COLLECTION, }; + C_ASSERT(sizeof(report_desc) < MAX_HID_DESCRIPTOR_LEN); #include "pop_hid_macros.h"
struct hid_device_desc desc = @@ -3864,7 +3873,8 @@ static struct controller_handler controller_added = {{&controller_handler_vtbl}} static void test_windows_gaming_input(void) { #include "psh_hid_macros.h" - const unsigned char report_desc[] = { + const unsigned char report_desc[] = + { USAGE_PAGE(1, HID_USAGE_PAGE_GENERIC), USAGE(1, HID_USAGE_GENERIC_GAMEPAD), COLLECTION(1, Application), @@ -3906,6 +3916,7 @@ static void test_windows_gaming_input(void) END_COLLECTION, END_COLLECTION, }; + C_ASSERT(sizeof(report_desc) < MAX_HID_DESCRIPTOR_LEN); #include "pop_hid_macros.h"
struct hid_device_desc desc =
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/tests/force_feedback.c | 44 ++---------- dlls/dinput/tests/joystick8.c | 109 +++++++++++++++++++++++++++++ 2 files changed, 113 insertions(+), 40 deletions(-)
diff --git a/dlls/dinput/tests/force_feedback.c b/dlls/dinput/tests/force_feedback.c index f6525657450..c07cdf66b02 100644 --- a/dlls/dinput/tests/force_feedback.c +++ b/dlls/dinput/tests/force_feedback.c @@ -4587,17 +4587,15 @@ static void test_windows_gaming_input(void) COLLECTION(1, Physical), REPORT_ID(1, 1),
- USAGE(4, (HID_USAGE_PAGE_SIMULATION<<16)|HID_USAGE_SIMULATION_STEERING), - USAGE(4, (HID_USAGE_PAGE_SIMULATION<<16)|HID_USAGE_SIMULATION_ACCELERATOR), - USAGE(4, (HID_USAGE_PAGE_SIMULATION<<16)|HID_USAGE_SIMULATION_BRAKE), - USAGE(4, (HID_USAGE_PAGE_SIMULATION<<16)|HID_USAGE_SIMULATION_CLUTCH), USAGE(1, HID_USAGE_GENERIC_X), + USAGE(1, HID_USAGE_GENERIC_Y), + USAGE(1, HID_USAGE_GENERIC_Z), LOGICAL_MINIMUM(1, 0), LOGICAL_MAXIMUM(1, 127), PHYSICAL_MINIMUM(1, 0), PHYSICAL_MAXIMUM(1, 127), REPORT_SIZE(1, 8), - REPORT_COUNT(1, 5), + REPORT_COUNT(1, 3), INPUT(1, Data|Var|Abs),
USAGE(1, HID_USAGE_GENERIC_HATSWITCH), @@ -5006,7 +5004,7 @@ static void test_windows_gaming_input(void) struct hid_device_desc desc = { .use_report_id = TRUE, - .caps = { .InputReportByteLength = 8 }, + .caps = { .InputReportByteLength = 6 }, .attributes = default_attributes, }; struct hid_expect expect_init[] = @@ -5148,7 +5146,6 @@ static void test_windows_gaming_input(void) }; static const WCHAR *force_feedback_motor = RuntimeClass_Windows_Gaming_Input_ForceFeedback_ForceFeedbackMotor; static const WCHAR *controller_class_name = RuntimeClass_Windows_Gaming_Input_RawGameController; - static const WCHAR *racing_wheel_class_name = RuntimeClass_Windows_Gaming_Input_RacingWheel;
DIPROPGUIDANDPATH guid_path = { @@ -5166,16 +5163,11 @@ static void test_windows_gaming_input(void) EventRegistrationToken controller_added_token; struct bool_async_handler bool_async_handler; IVectorView_ForceFeedbackMotor *motors_view; - IVectorView_RacingWheel *racing_wheels_view; - IRacingWheelStatics2 *racing_wheel_statics2; - IRacingWheelStatics *racing_wheel_statics; ForceFeedbackEffectAxes supported_axes; IAsyncOperation_boolean *bool_async; IRawGameController *raw_controller; - IGameController *game_controller; IDirectInputDevice8W *device; IForceFeedbackMotor *motor; - IRacingWheel *racing_wheel; BOOLEAN paused, enabled; IAsyncInfo *async_info; DOUBLE gain; @@ -5244,34 +5236,6 @@ static void test_windows_gaming_input(void) ok( hr == S_OK, "GetAt returned %#lx\n", hr ); IVectorView_RawGameController_Release( controllers_view );
- hr = pWindowsCreateString( racing_wheel_class_name, wcslen( racing_wheel_class_name ), &str ); - ok( hr == S_OK, "WindowsCreateString returned %#lx\n", hr ); - hr = pRoGetActivationFactory( str, &IID_IRacingWheelStatics, (void **)&racing_wheel_statics ); - ok( hr == S_OK, "RoGetActivationFactory returned %#lx\n", hr ); - hr = pRoGetActivationFactory( str, &IID_IRacingWheelStatics2, (void **)&racing_wheel_statics2 ); - ok( hr == S_OK, "RoGetActivationFactory returned %#lx\n", hr ); - pWindowsDeleteString( str ); - - /* HID driving wheels aren't exposed as WGI gamepads on Windows */ - - hr = IRacingWheelStatics_get_RacingWheels( racing_wheel_statics, &racing_wheels_view ); - ok( hr == S_OK, "get_RacingWheels returned %#lx\n", hr ); - hr = IVectorView_RacingWheel_get_Size( racing_wheels_view, &size ); - ok( hr == S_OK, "get_Size returned %#lx\n", hr ); - todo_wine /* but Wine currently intentionally does */ - ok( size == 0, "got size %u\n", size ); - IVectorView_RacingWheel_Release( racing_wheels_view ); - IRacingWheelStatics_Release( racing_wheel_statics ); - - hr = IRawGameController_QueryInterface( raw_controller, &IID_IGameController, (void **)&game_controller ); - ok( hr == S_OK, "QueryInterface returned %#lx\n", hr ); - hr = IRacingWheelStatics2_FromGameController( racing_wheel_statics2, game_controller, &racing_wheel ); - ok( hr == S_OK, "FromGameController returned %#lx\n", hr ); - todo_wine - ok( racing_wheel == NULL, "got racing_wheel %p\n", racing_wheel ); - IGameController_Release( game_controller ); - IRacingWheelStatics2_Release( racing_wheel_statics2 ); - set_hid_expect( file, expect_acquire, sizeof(expect_acquire) ); hr = IRawGameController_get_ForceFeedbackMotors( raw_controller, &motors_view ); ok( hr == S_OK, "get_ForceFeedbackMotors returned %#lx\n", hr ); diff --git a/dlls/dinput/tests/joystick8.c b/dlls/dinput/tests/joystick8.c index eeb8b90d0c8..08a4e6b5597 100644 --- a/dlls/dinput/tests/joystick8.c +++ b/dlls/dinput/tests/joystick8.c @@ -3917,6 +3917,49 @@ static void test_windows_gaming_input(void) END_COLLECTION, }; C_ASSERT(sizeof(report_desc) < MAX_HID_DESCRIPTOR_LEN); + static const unsigned char wheel_threepedals_desc[] = + { + USAGE_PAGE(1, HID_USAGE_PAGE_GENERIC), + USAGE(1, HID_USAGE_GENERIC_JOYSTICK), + COLLECTION(1, Application), + USAGE(1, HID_USAGE_GENERIC_JOYSTICK), + COLLECTION(1, Physical), + USAGE(4, (HID_USAGE_PAGE_SIMULATION<<16)|HID_USAGE_SIMULATION_STEERING), + USAGE(4, (HID_USAGE_PAGE_SIMULATION<<16)|HID_USAGE_SIMULATION_ACCELERATOR), + USAGE(4, (HID_USAGE_PAGE_SIMULATION<<16)|HID_USAGE_SIMULATION_BRAKE), + USAGE(4, (HID_USAGE_PAGE_SIMULATION<<16)|HID_USAGE_SIMULATION_CLUTCH), + USAGE(1, HID_USAGE_GENERIC_Y), + LOGICAL_MINIMUM(1, 0), + LOGICAL_MAXIMUM(1, 127), + PHYSICAL_MINIMUM(1, 0), + PHYSICAL_MAXIMUM(1, 127), + REPORT_SIZE(1, 8), + REPORT_COUNT(1, 5), + INPUT(1, Data|Var|Abs), + + USAGE(1, HID_USAGE_GENERIC_HATSWITCH), + LOGICAL_MINIMUM(1, 1), + LOGICAL_MAXIMUM(1, 8), + PHYSICAL_MINIMUM(1, 0), + PHYSICAL_MAXIMUM(1, 8), + REPORT_SIZE(1, 8), + REPORT_COUNT(1, 1), + INPUT(1, Data|Var|Abs|Null), + + USAGE_PAGE(1, HID_USAGE_PAGE_BUTTON), + USAGE_MINIMUM(1, 1), + USAGE_MAXIMUM(1, 5), + LOGICAL_MINIMUM(1, 0), + LOGICAL_MAXIMUM(1, 1), + PHYSICAL_MINIMUM(1, 0), + PHYSICAL_MAXIMUM(1, 1), + REPORT_SIZE(1, 1), + REPORT_COUNT(1, 16), + INPUT(1, Data|Var|Abs), + END_COLLECTION, + END_COLLECTION, + }; + C_ASSERT(sizeof(wheel_threepedals_desc) < MAX_HID_DESCRIPTOR_LEN); #include "pop_hid_macros.h"
struct hid_device_desc desc = @@ -3926,15 +3969,20 @@ static void test_windows_gaming_input(void) .attributes = default_attributes, }; static const WCHAR *controller_class_name = RuntimeClass_Windows_Gaming_Input_RawGameController; + static const WCHAR *racing_wheel_class_name = RuntimeClass_Windows_Gaming_Input_RacingWheel; static const WCHAR *gamepad_class_name = RuntimeClass_Windows_Gaming_Input_Gamepad;
IRawGameController *raw_controller, *tmp_raw_controller; IVectorView_RawGameController *controllers_view; IRawGameControllerStatics *controller_statics; EventRegistrationToken controller_added_token; + IVectorView_RacingWheel *racing_wheels_view; + IRacingWheelStatics2 *racing_wheel_statics2; + IRacingWheelStatics *racing_wheel_statics; IVectorView_Gamepad *gamepads_view; IGamepadStatics *gamepad_statics; IGameController *game_controller; + IRacingWheel *racing_wheel; UINT32 size; HSTRING str; HRESULT hr; @@ -4044,6 +4092,67 @@ static void test_windows_gaming_input(void) hr = IRawGameControllerStatics_remove_RawGameControllerAdded( controller_statics, controller_added_token ); ok( hr == S_OK, "remove_RawGameControllerAdded returned %#lx\n", hr );
+ hid_device_stop( &desc ); + + + desc.report_descriptor_len = sizeof(wheel_threepedals_desc); + memcpy( desc.report_descriptor_buf, wheel_threepedals_desc, sizeof(wheel_threepedals_desc) ); + fill_context( __LINE__, desc.context, ARRAY_SIZE(desc.context) ); + + controller_added.event = CreateEventW( NULL, FALSE, FALSE, NULL ); + ok( !!controller_added.event, "CreateEventW failed, error %lu\n", GetLastError() ); + + hr = IRawGameControllerStatics_add_RawGameControllerAdded( controller_statics, &controller_added.IEventHandler_RawGameController_iface, + &controller_added_token ); + ok( hr == S_OK, "add_RawGameControllerAdded returned %#lx\n", hr ); + ok( controller_added_token.value, "got token %I64u\n", controller_added_token.value ); + + if (!hid_device_start( &desc )) goto done; + WaitForSingleObject( controller_added.event, INFINITE ); + CloseHandle( controller_added.event ); + + hr = IRawGameControllerStatics_get_RawGameControllers( controller_statics, &controllers_view ); + ok( hr == S_OK, "get_RawGameControllers returned %#lx\n", hr ); + hr = IVectorView_RawGameController_get_Size( controllers_view, &size ); + ok( hr == S_OK, "get_Size returned %#lx\n", hr ); + ok( size == 1, "got size %u\n", size ); + hr = IVectorView_RawGameController_GetAt( controllers_view, 0, &raw_controller ); + ok( hr == S_OK, "GetAt returned %#lx\n", hr ); + IVectorView_RawGameController_Release( controllers_view ); + + hr = IRawGameControllerStatics_remove_RawGameControllerAdded( controller_statics, controller_added_token ); + ok( hr == S_OK, "remove_RawGameControllerAdded returned %#lx\n", hr ); + + hr = pWindowsCreateString( racing_wheel_class_name, wcslen( racing_wheel_class_name ), &str ); + ok( hr == S_OK, "WindowsCreateString returned %#lx\n", hr ); + hr = pRoGetActivationFactory( str, &IID_IRacingWheelStatics, (void **)&racing_wheel_statics ); + ok( hr == S_OK, "RoGetActivationFactory returned %#lx\n", hr ); + hr = pRoGetActivationFactory( str, &IID_IRacingWheelStatics2, (void **)&racing_wheel_statics2 ); + ok( hr == S_OK, "RoGetActivationFactory returned %#lx\n", hr ); + pWindowsDeleteString( str ); + + /* HID driving wheels aren't exposed as WGI RacingWheel on Windows */ + + hr = IRacingWheelStatics_get_RacingWheels( racing_wheel_statics, &racing_wheels_view ); + ok( hr == S_OK, "get_RacingWheels returned %#lx\n", hr ); + hr = IVectorView_RacingWheel_get_Size( racing_wheels_view, &size ); + ok( hr == S_OK, "get_Size returned %#lx\n", hr ); + todo_wine /* but Wine currently intentionally does */ + ok( size == 0, "got size %u\n", size ); + IVectorView_RacingWheel_Release( racing_wheels_view ); + IRacingWheelStatics_Release( racing_wheel_statics ); + + hr = IRawGameController_QueryInterface( raw_controller, &IID_IGameController, (void **)&game_controller ); + ok( hr == S_OK, "QueryInterface returned %#lx\n", hr ); + hr = IRacingWheelStatics2_FromGameController( racing_wheel_statics2, game_controller, &racing_wheel ); + ok( hr == S_OK, "FromGameController returned %#lx\n", hr ); + todo_wine + ok( racing_wheel == NULL, "got racing_wheel %p\n", racing_wheel ); + if (racing_wheel) IRacingWheel_Release( racing_wheel ); + IGameController_Release( game_controller ); + IRacingWheelStatics2_Release( racing_wheel_statics2 ); + + IRawGameController_Release( raw_controller ); IRawGameControllerStatics_Release( controller_statics );
done:
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=113537
Your paranoid android.
=== w8 (32 bit report) ===
dinput: joystick8.c:1684: Test failed: 0x800: got lX -10830 joystick8.c:1685: Test failed: 0x800: got lY 16853
=== debian11 (64 bit WoW report) ===
dinput: force_feedback.c:5438: Test failed: WaitForSingleObject returned 0x102 force_feedback.c:5438: Test failed: GetOverlappedResult returned 996 force_feedback.c:5438: Test failed: IOCTL_WINETEST_HID_WAIT_EXPECT failed, last error 996 driver_bus.c:139: Test failed: hid.c:5438 expect[0]: missing (code 0xb000f id 6 len 2)
They are checked against the expected packet anyway, and they otherwise are enforced to match their specific individual report length, which we don't have any info about here.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/tests/driver_bus.c | 19 +++++-------------- dlls/dinput/tests/force_feedback.c | 20 +++++++++++++++++--- 2 files changed, 22 insertions(+), 17 deletions(-)
diff --git a/dlls/dinput/tests/driver_bus.c b/dlls/dinput/tests/driver_bus.c index 9ece4414a1a..6554d50c14b 100644 --- a/dlls/dinput/tests/driver_bus.c +++ b/dlls/dinput/tests/driver_bus.c @@ -1072,11 +1072,10 @@ static NTSTATUS WINAPI pdo_internal_ioctl( DEVICE_OBJECT *device, IRP *irp ) case IOCTL_HID_WRITE_REPORT: { HID_XFER_PACKET *packet = irp->UserBuffer; - ULONG expected_size = impl->caps.OutputReportByteLength - (impl->use_report_id ? 0 : 1);
ok( in_size == sizeof(*packet), "got input size %lu\n", in_size ); ok( !out_size, "got output size %lu\n", out_size ); - ok( packet->reportBufferLen >= expected_size, "got report size %lu\n", packet->reportBufferLen ); + ok( !!packet->reportBuffer, "got buffer %p\n", packet->reportBuffer );
expect_queue_next( &impl->expect_queue, code, packet, &index, &expect, TRUE, context, sizeof(context) ); winetest_push_context( "%s expect[%ld]", context, index ); @@ -1095,11 +1094,9 @@ static NTSTATUS WINAPI pdo_internal_ioctl( DEVICE_OBJECT *device, IRP *irp ) case IOCTL_HID_GET_INPUT_REPORT: { HID_XFER_PACKET *packet = irp->UserBuffer; - ULONG expected_size = impl->caps.InputReportByteLength - (impl->use_report_id ? 0 : 1); + ok( !in_size, "got input size %lu\n", in_size ); ok( out_size == sizeof(*packet), "got output size %lu\n", out_size ); - - ok( packet->reportBufferLen >= expected_size, "got len %lu\n", packet->reportBufferLen ); ok( !!packet->reportBuffer, "got buffer %p\n", packet->reportBuffer );
expect_queue_next( &impl->expect_queue, code, packet, &index, &expect, FALSE, context, sizeof(context) ); @@ -1119,11 +1116,9 @@ static NTSTATUS WINAPI pdo_internal_ioctl( DEVICE_OBJECT *device, IRP *irp ) case IOCTL_HID_SET_OUTPUT_REPORT: { HID_XFER_PACKET *packet = irp->UserBuffer; - ULONG expected_size = impl->caps.OutputReportByteLength - (impl->use_report_id ? 0 : 1); + ok( in_size == sizeof(*packet), "got input size %lu\n", in_size ); ok( !out_size, "got output size %lu\n", out_size ); - - ok( packet->reportBufferLen >= expected_size, "got len %lu\n", packet->reportBufferLen ); ok( !!packet->reportBuffer, "got buffer %p\n", packet->reportBuffer );
expect_queue_next( &impl->expect_queue, code, packet, &index, &expect, TRUE, context, sizeof(context) ); @@ -1143,11 +1138,9 @@ static NTSTATUS WINAPI pdo_internal_ioctl( DEVICE_OBJECT *device, IRP *irp ) case IOCTL_HID_GET_FEATURE: { HID_XFER_PACKET *packet = irp->UserBuffer; - ULONG expected_size = impl->caps.FeatureReportByteLength - (impl->use_report_id ? 0 : 1); + ok( !in_size, "got input size %lu\n", in_size ); ok( out_size == sizeof(*packet), "got output size %lu\n", out_size ); - - ok( packet->reportBufferLen >= expected_size, "got len %lu\n", packet->reportBufferLen ); ok( !!packet->reportBuffer, "got buffer %p\n", packet->reportBuffer );
expect_queue_next( &impl->expect_queue, code, packet, &index, &expect, FALSE, context, sizeof(context) ); @@ -1167,11 +1160,9 @@ static NTSTATUS WINAPI pdo_internal_ioctl( DEVICE_OBJECT *device, IRP *irp ) case IOCTL_HID_SET_FEATURE: { HID_XFER_PACKET *packet = irp->UserBuffer; - ULONG expected_size = impl->caps.FeatureReportByteLength - (impl->use_report_id ? 0 : 1); + ok( in_size == sizeof(*packet), "got input size %lu\n", in_size ); ok( !out_size, "got output size %lu\n", out_size ); - - ok( packet->reportBufferLen >= expected_size, "got len %lu\n", packet->reportBufferLen ); ok( !!packet->reportBuffer, "got buffer %p\n", packet->reportBuffer );
expect_queue_next( &impl->expect_queue, code, packet, &index, &expect, TRUE, context, sizeof(context) ); diff --git a/dlls/dinput/tests/force_feedback.c b/dlls/dinput/tests/force_feedback.c index c07cdf66b02..ed8c15ae55f 100644 --- a/dlls/dinput/tests/force_feedback.c +++ b/dlls/dinput/tests/force_feedback.c @@ -2012,7 +2012,11 @@ static BOOL test_force_feedback_joystick( DWORD version ) struct hid_device_desc desc = { .use_report_id = TRUE, - .caps = { .InputReportByteLength = 5 }, + .caps = + { + .InputReportByteLength = 5, + .OutputReportByteLength = 11, + }, .attributes = default_attributes, }; const DIDEVCAPS expect_caps = @@ -3467,7 +3471,12 @@ static void test_device_managed_effect(void) struct hid_device_desc desc = { .use_report_id = TRUE, - .caps = { .InputReportByteLength = 5 }, + .caps = + { + .InputReportByteLength = 5, + .OutputReportByteLength = 11, + .FeatureReportByteLength = 5, + }, .attributes = default_attributes, }; struct hid_expect expect_acquire[] = @@ -5004,7 +5013,12 @@ static void test_windows_gaming_input(void) struct hid_device_desc desc = { .use_report_id = TRUE, - .caps = { .InputReportByteLength = 6 }, + .caps = + { + .InputReportByteLength = 6, + .OutputReportByteLength = 11, + .FeatureReportByteLength = 5, + }, .attributes = default_attributes, }; struct hid_expect expect_init[] =
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=113538
Your paranoid android.
=== w7u_adm (32 bit report) ===
dinput: device8: Timeout
=== w1064_tsign (64 bit report) ===
dinput: hotplug.c:927: Test failed: 1: controller removed handler not invoked hotplug.c:927: Test failed: 1: controller removed handler not invoked
=== debian11 (32 bit Arabic:Morocco report) ===
dinput: force_feedback.c:5452: Test failed: WaitForSingleObject returned 0x102 force_feedback.c:5452: Test failed: GetOverlappedResult returned 996 force_feedback.c:5452: Test failed: IOCTL_WINETEST_HID_WAIT_EXPECT failed, last error 996 driver_bus.c:139: Test failed: hid.c:5452 expect[0]: missing (code 0xb000f id 6 len 2)
=== debian11 (32 bit Chinese:China report) ===
dinput: force_feedback.c:5407: Test failed: WaitForSingleObject returned 0x102 force_feedback.c:5407: Test failed: GetOverlappedResult returned 996 force_feedback.c:5407: Test failed: IOCTL_WINETEST_HID_WAIT_EXPECT failed, last error 996 force_feedback.c:5411: Test failed: got status 3 force_feedback.c:5411: Test failed: got error 0x8007001e force_feedback.c:5411: Test failed: GetResults returned 0x8007001e force_feedback.c:5411: Test failed: got result 0 force_feedback.c:5415: Test failed: got status 3 driver_bus.c:139: Test failed: hid.c:5407 expect[0]: missing (code 0xb000f id 6 len 2)
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=113536
Your paranoid android.
=== w7u_adm (32 bit report) ===
dinput: device8: Timeout
=== w1064_tsign (64 bit report) ===
dinput: hotplug.c:927: Test failed: 1: controller removed handler not invoked hotplug.c:927: Test failed: 1: controller removed handler not invoked
=== w1064_tsign (64 bit report) ===
dinput: joystick8: Timeout
=== debian11 (32 bit Arabic:Morocco report) ===
dinput: force_feedback.c:5474: Test failed: WaitForSingleObject returned 0x102 force_feedback.c:5474: Test failed: GetOverlappedResult returned 996 force_feedback.c:5474: Test failed: IOCTL_WINETEST_HID_WAIT_EXPECT failed, last error 996 driver_bus.c:139: Test failed: hid.c:5474 expect[0]: missing (code 0xb000f id 6 len 2) hid.c:2351: Test failed: id 1 poll: expected identical reports
On 4/27/22 13: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=113536
Your paranoid android.
=== w7u_adm (32 bit report) ===
dinput: device8: Timeout
=== w1064_tsign (64 bit report) ===
dinput: hotplug.c:927: Test failed: 1: controller removed handler not invoked hotplug.c:927: Test failed: 1: controller removed handler not invoked
I can repro this locally too sometimes, seems to be pre-existing somehow, I'll investigate.
=== w1064_tsign (64 bit report) ===
dinput: joystick8: Timeout
=== debian11 (32 bit Arabic:Morocco report) ===
dinput: force_feedback.c:5474: Test failed: WaitForSingleObject returned 0x102 force_feedback.c:5474: Test failed: GetOverlappedResult returned 996 force_feedback.c:5474: Test failed: IOCTL_WINETEST_HID_WAIT_EXPECT failed, last error 996 driver_bus.c:139: Test failed: hid.c:5474 expect[0]: missing (code 0xb000f id 6 len 2)
That's also a pre-existing race, or the timeout isn't big enough, I'll try to fix it in a later patch.