From: Francois Gouget fgouget@free.fr
Signed-off-by: Francois Gouget fgouget@free.fr Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/winebus.sys/bus_udev.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index 6b4bf09a773..39573162afa 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -1773,7 +1773,7 @@ NTSTATUS udev_bus_init(void *args) goto error; }
-#if HAVE_SYS_INOTIFY_H +#ifdef HAVE_SYS_INOTIFY_H if (options.disable_udevd) monitor_fd = create_inotify(); if (monitor_fd < 0) options.disable_udevd = FALSE; #else @@ -1798,7 +1798,7 @@ NTSTATUS udev_bus_init(void *args) poll_count = 2;
if (!options.disable_udevd) build_initial_deviceset_udevd(); -#if HAVE_SYS_INOTIFY_H +#ifdef HAVE_SYS_INOTIFY_H else build_initial_deviceset_direct(); #endif
@@ -1841,7 +1841,7 @@ NTSTATUS udev_bus_wait(void *args) if (pfd[0].revents) { if (udev_monitor) process_monitor_event(udev_monitor); -#if HAVE_SYS_INOTIFY_H +#ifdef HAVE_SYS_INOTIFY_H else process_inotify_event(pfd[0].fd); #endif }
From: Zebediah Figura zfigura@codeweavers.com
This is dependent on timing, and currently fails occasionally both on Windows and Wine.
Signed-off-by: Zebediah Figura zfigura@codeweavers.com Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/tests/hid.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/dlls/dinput/tests/hid.c b/dlls/dinput/tests/hid.c index 4e107625064..aeafbd4dbc3 100644 --- a/dlls/dinput/tests/hid.c +++ b/dlls/dinput/tests/hid.c @@ -2343,12 +2343,11 @@ static void test_hidp( HANDLE file, HANDLE async_file, int report_id, BOOL polle ok( ret, "GetOverlappedResult failed, last error %lu\n", GetLastError() ); ok( value == (report_id ? 3 : 4), "GetOverlappedResult returned length %lu, expected %u\n", value, (report_id ? 3 : 4) ); - /* first report should be ready and the same */ + /* first report should be ready */ ret = GetOverlappedResult( async_file, &overlapped, &value, FALSE ); ok( ret, "GetOverlappedResult failed, last error %lu\n", GetLastError() ); ok( value == (report_id ? 3 : 4), "GetOverlappedResult returned length %lu, expected %u\n", value, (report_id ? 3 : 4) ); - ok( !memcmp( report, buffer, caps.InputReportByteLength ), "expected identical reports\n" );
send_hid_input( file, expect_small, sizeof(expect_small) );
From: Zebediah Figura zfigura@codeweavers.com
Fixes an intermittent test failure.
Signed-off-by: Zebediah Figura zfigura@codeweavers.com Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/tests/force_feedback.c | 2 +- dlls/dinput/tests/hotplug.c | 2 +- dlls/dinput/tests/joystick8.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/dinput/tests/force_feedback.c b/dlls/dinput/tests/force_feedback.c index d9dad38446c..7fadd043656 100644 --- a/dlls/dinput/tests/force_feedback.c +++ b/dlls/dinput/tests/force_feedback.c @@ -4437,8 +4437,8 @@ static HRESULT WINAPI controller_handler_Invoke( IEventHandler_RawGameController trace( "iface %p, sender %p, controller %p\n", iface, sender, controller );
ok( sender == NULL, "got sender %p\n", sender ); - SetEvent( impl->event ); impl->invoked = TRUE; + SetEvent( impl->event );
return S_OK; } diff --git a/dlls/dinput/tests/hotplug.c b/dlls/dinput/tests/hotplug.c index 2d000317c9f..97e9e69fa9f 100644 --- a/dlls/dinput/tests/hotplug.c +++ b/dlls/dinput/tests/hotplug.c @@ -526,8 +526,8 @@ static HRESULT WINAPI controller_handler_Invoke( IEventHandler_RawGameController trace( "iface %p, sender %p, controller %p\n", iface, sender, controller );
ok( sender == NULL, "got sender %p\n", sender ); - SetEvent( impl->event ); impl->invoked = TRUE; + SetEvent( impl->event );
return S_OK; } diff --git a/dlls/dinput/tests/joystick8.c b/dlls/dinput/tests/joystick8.c index 32d03a603c3..890209cd5e0 100644 --- a/dlls/dinput/tests/joystick8.c +++ b/dlls/dinput/tests/joystick8.c @@ -3845,8 +3845,8 @@ static HRESULT WINAPI controller_handler_Invoke( IEventHandler_RawGameController trace( "iface %p, sender %p, controller %p\n", iface, sender, controller );
ok( sender == NULL, "got sender %p\n", sender ); - SetEvent( impl->event ); impl->invoked = TRUE; + SetEvent( impl->event );
return S_OK; }
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=113992
Your paranoid android.
=== w1064_tsign (64 bit report) ===
dinput: hotplug.c:926: Test failed: 1: controller removed handler not invoked hotplug.c:926: Test failed: 1: controller removed handler not invoked
=== w8 (32 bit report) ===
dinput: joystick8.c:1267: Test failed: 0x500: Acquire returned: 0x80070005 joystick8.c:1269: Test failed: 0x500: SetCooperativeLevel returned: 0 joystick8.c:1271: Test failed: 0x500: Unacquire returned: 0x1
=== debian11 (32 bit French report) ===
dinput: force_feedback.c:5471: Test failed: WaitForSingleObject returned 0x102 force_feedback.c:5471: Test failed: GetOverlappedResult returned 996 force_feedback.c:5471: Test failed: IOCTL_WINETEST_HID_WAIT_EXPECT failed, last error 996 driver_bus.c:139: Test failed: hid.c:5471 expect[0]: missing (code 0xb000f id 6 len 2)
From: Rémi Bernon rbernon@codeweavers.com
It now consistently fails on w1064_tsign, and it's called concurrently with the handler invocation.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/tests/hotplug.c | 1 - 1 file changed, 1 deletion(-)
diff --git a/dlls/dinput/tests/hotplug.c b/dlls/dinput/tests/hotplug.c index 97e9e69fa9f..e68a6914684 100644 --- a/dlls/dinput/tests/hotplug.c +++ b/dlls/dinput/tests/hotplug.c @@ -923,7 +923,6 @@ static LRESULT CALLBACK windows_gaming_input_wndproc( HWND hwnd, UINT msg, WPARA { ok( wparam == DBT_DEVICEREMOVECOMPLETE, "got wparam %#Ix\n", wparam ); ok( controller_added.invoked, "controller added handler not invoked\n" ); - ok( controller_removed.invoked, "controller removed handler not invoked\n" ); } else {
From: Rémi Bernon rbernon@codeweavers.com
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/tests/force_feedback.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/dinput/tests/force_feedback.c b/dlls/dinput/tests/force_feedback.c index 7fadd043656..7128b89cea8 100644 --- a/dlls/dinput/tests/force_feedback.c +++ b/dlls/dinput/tests/force_feedback.c @@ -5468,7 +5468,7 @@ static void test_windows_gaming_input(void) ok( !bool_async_handler.invoked, "handler invoked\n" ); IAsyncInfo_Release( async_info );
- wait_hid_expect( file, 100 ); + wait_hid_expect( file, 500 ); ret = WaitForSingleObject( bool_async_handler.event, 100 ); ok( ret == 0, "WaitForSingleObject returned %#lx\n", ret ); CloseHandle( bool_async_handler.event );
From: Rémi Bernon rbernon@codeweavers.com
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- 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 7128b89cea8..eae93fa72ad 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 aeafbd4dbc3..7e2d9cf86cf 100644 --- a/dlls/dinput/tests/hid.c +++ b/dlls/dinput/tests/hid.c @@ -2854,6 +2854,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 = @@ -3062,6 +3063,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 = @@ -3571,6 +3573,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 = { @@ -3615,6 +3618,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 e68a6914684..3f4aae3afac 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 890209cd5e0..60a73769549 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 =
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=113995
Your paranoid android.
=== debian11 (64 bit WoW 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)
From: Rémi Bernon rbernon@codeweavers.com
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 eae93fa72ad..993fdfd41c2 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 60a73769549..acf417a0068 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:
From: Rémi Bernon rbernon@codeweavers.com
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 993fdfd41c2..e0f5ce4bca1 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=113997
Your paranoid android.
=== debian11 (32 bit report) ===
dinput: driver_bus.c:139: Test failed: hid.c:5452 expect[0]: missing (code 0xb000f id 6 len 2)
From: Rémi Bernon rbernon@codeweavers.com
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/tests/force_feedback.c | 224 ++++++++++++++++++++++++++++- 1 file changed, 223 insertions(+), 1 deletion(-)
diff --git a/dlls/dinput/tests/force_feedback.c b/dlls/dinput/tests/force_feedback.c index e0f5ce4bca1..f5b387f3566 100644 --- a/dlls/dinput/tests/force_feedback.c +++ b/dlls/dinput/tests/force_feedback.c @@ -39,6 +39,7 @@
#define WIDL_using_Windows_Foundation #define WIDL_using_Windows_Foundation_Collections +#define WIDL_using_Windows_Foundation_Numerics #include "windows.foundation.h" #define WIDL_using_Windows_Devices_Haptics #define WIDL_using_Windows_Gaming_Input @@ -4516,6 +4517,58 @@ static void check_bool_async_( int line, IAsyncOperation_boolean *async, UINT32 } }
+#define check_result_async( a, b, c, d, e ) check_result_async_( __LINE__, a, b, c, d, e ) +static void check_result_async_( int line, IAsyncOperation_ForceFeedbackLoadEffectResult *async, UINT32 expect_id, + AsyncStatus expect_status, HRESULT expect_hr, ForceFeedbackLoadEffectResult expect_result ) +{ + ForceFeedbackLoadEffectResult result; + AsyncStatus async_status; + IAsyncInfo *async_info; + HRESULT hr, async_hr; + UINT32 async_id; + + hr = IAsyncOperation_ForceFeedbackLoadEffectResult_QueryInterface( async, &IID_IAsyncInfo, (void **)&async_info ); + ok_(__FILE__, line)( hr == S_OK, "QueryInterface returned %#lx\n", hr ); + + async_id = 0xdeadbeef; + hr = IAsyncInfo_get_Id( async_info, &async_id ); + if (expect_status < 4) ok_(__FILE__, line)( hr == S_OK, "get_Id returned %#lx\n", hr ); + else ok_(__FILE__, line)( hr == E_ILLEGAL_METHOD_CALL, "get_Id returned %#lx\n", hr ); + ok_(__FILE__, line)( async_id == expect_id, "got id %u\n", async_id ); + + async_status = 0xdeadbeef; + hr = IAsyncInfo_get_Status( async_info, &async_status ); + if (expect_status < 4) ok_(__FILE__, line)( hr == S_OK, "get_Status returned %#lx\n", hr ); + else ok_(__FILE__, line)( hr == E_ILLEGAL_METHOD_CALL, "get_Status returned %#lx\n", hr ); + ok_(__FILE__, line)( async_status == expect_status, "got status %u\n", async_status ); + + async_hr = 0xdeadbeef; + hr = IAsyncInfo_get_ErrorCode( async_info, &async_hr ); + if (expect_status < 4) ok_(__FILE__, line)( hr == S_OK, "get_ErrorCode returned %#lx\n", hr ); + else ok_(__FILE__, line)( hr == E_ILLEGAL_METHOD_CALL, "get_ErrorCode returned %#lx\n", hr ); + if (expect_status < 4) todo_wine_if(FAILED(expect_hr)) ok_(__FILE__, line)( async_hr == expect_hr, "got error %#lx\n", async_hr ); + else ok_(__FILE__, line)( async_hr == E_ILLEGAL_METHOD_CALL, "got error %#lx\n", async_hr ); + + IAsyncInfo_Release( async_info ); + + result = !expect_result; + hr = IAsyncOperation_ForceFeedbackLoadEffectResult_GetResults( async, &result ); + switch (expect_status) + { + case Completed: + case Error: + todo_wine_if(FAILED(expect_hr)) + ok_(__FILE__, line)( hr == expect_hr, "GetResults returned %#lx\n", hr ); + ok_(__FILE__, line)( result == expect_result, "got result %u\n", result ); + break; + case Canceled: + case Started: + default: + ok_(__FILE__, line)( hr == E_ILLEGAL_METHOD_CALL, "GetResults returned %#lx\n", hr ); + break; + } +} + struct bool_async_handler { IAsyncOperationCompletedHandler_boolean IAsyncOperationCompletedHandler_boolean_iface; @@ -4582,7 +4635,75 @@ static IAsyncOperationCompletedHandler_booleanVtbl bool_async_handler_vtbl = bool_async_handler_Invoke, };
-struct bool_async_handler default_bool_async_handler = {{&bool_async_handler_vtbl}}; +static struct bool_async_handler default_bool_async_handler = {{&bool_async_handler_vtbl}}; + +struct result_async_handler +{ + IAsyncOperationCompletedHandler_ForceFeedbackLoadEffectResult IAsyncOperationCompletedHandler_ForceFeedbackLoadEffectResult_iface; + IAsyncOperation_ForceFeedbackLoadEffectResult *async; + AsyncStatus status; + BOOL invoked; + HANDLE event; +}; + +static inline struct result_async_handler *impl_from_IAsyncOperationCompletedHandler_ForceFeedbackLoadEffectResult( IAsyncOperationCompletedHandler_ForceFeedbackLoadEffectResult *iface ) +{ + return CONTAINING_RECORD( iface, struct result_async_handler, IAsyncOperationCompletedHandler_ForceFeedbackLoadEffectResult_iface ); +} + +static HRESULT WINAPI result_async_handler_QueryInterface( IAsyncOperationCompletedHandler_ForceFeedbackLoadEffectResult *iface, REFIID iid, void **out ) +{ + if (IsEqualGUID( iid, &IID_IUnknown ) || + IsEqualGUID( iid, &IID_IAgileObject ) || + IsEqualGUID( iid, &IID_IAsyncOperationCompletedHandler_ForceFeedbackLoadEffectResult )) + { + IUnknown_AddRef( iface ); + *out = iface; + return S_OK; + } + + trace( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid ) ); + *out = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI result_async_handler_AddRef( IAsyncOperationCompletedHandler_ForceFeedbackLoadEffectResult *iface ) +{ + return 2; +} + +static ULONG WINAPI result_async_handler_Release( IAsyncOperationCompletedHandler_ForceFeedbackLoadEffectResult *iface ) +{ + return 1; +} + +static HRESULT WINAPI result_async_handler_Invoke( IAsyncOperationCompletedHandler_ForceFeedbackLoadEffectResult *iface, + IAsyncOperation_ForceFeedbackLoadEffectResult *async, AsyncStatus status ) +{ + struct result_async_handler *impl = impl_from_IAsyncOperationCompletedHandler_ForceFeedbackLoadEffectResult( iface ); + + trace( "iface %p, async %p, status %u\n", iface, async, status ); + + ok( !impl->invoked, "invoked twice\n" ); + impl->invoked = TRUE; + impl->async = async; + impl->status = status; + if (impl->event) SetEvent( impl->event ); + + return S_OK; +} + +static IAsyncOperationCompletedHandler_ForceFeedbackLoadEffectResultVtbl result_async_handler_vtbl = +{ + /*** IUnknown methods ***/ + result_async_handler_QueryInterface, + result_async_handler_AddRef, + result_async_handler_Release, + /*** IAsyncOperationCompletedHandler<ForceFeedbackLoadEffectResult> methods ***/ + result_async_handler_Invoke, +}; + +static struct result_async_handler default_result_async_handler = {{&result_async_handler_vtbl}};
static void test_windows_gaming_input(void) { @@ -5158,6 +5279,7 @@ static void test_windows_gaming_input(void) .report_buf = {6, 0x7f}, }, }; + static const WCHAR *constant_effect_class_name = RuntimeClass_Windows_Gaming_Input_ForceFeedback_ConstantForceEffect; static const WCHAR *force_feedback_motor = RuntimeClass_Windows_Gaming_Input_ForceFeedback_ForceFeedbackMotor; static const WCHAR *controller_class_name = RuntimeClass_Windows_Gaming_Input_RawGameController;
@@ -5171,15 +5293,24 @@ static void test_windows_gaming_input(void) }, }; DIDEVICEINSTANCEW devinst = {.dwSize = sizeof(DIDEVICEINSTANCEW)}; + IAsyncOperation_ForceFeedbackLoadEffectResult *result_async; IAsyncOperationCompletedHandler_boolean *tmp_handler; + struct result_async_handler result_async_handler; IVectorView_RawGameController *controllers_view; IRawGameControllerStatics *controller_statics; EventRegistrationToken controller_added_token; struct bool_async_handler bool_async_handler; IVectorView_ForceFeedbackMotor *motors_view; ForceFeedbackEffectAxes supported_axes; + IActivationFactory *activation_factory; + IConstantForceEffect *constant_effect; IAsyncOperation_boolean *bool_async; IRawGameController *raw_controller; + ForceFeedbackEffectState state; + Vector3 vector3 = {1., 0., 0.}; + TimeSpan duration = {10000000}; + IInspectable *tmp_inspectable; + IForceFeedbackEffect *effect; IDirectInputDevice8W *device; IForceFeedbackMotor *motor; BOOLEAN paused, enabled; @@ -5190,6 +5321,7 @@ static void test_windows_gaming_input(void) UINT32 size; HRESULT hr; DWORD ret; + LONG ref;
if (!load_combase_functions()) return;
@@ -5478,6 +5610,96 @@ static void test_windows_gaming_input(void) IAsyncOperation_boolean_Release( bool_async );
+ hr = pWindowsCreateString( force_feedback_motor, wcslen( force_feedback_motor ), &str ); + ok( hr == S_OK, "WindowsCreateString returned %#lx\n", hr ); + hr = pRoGetActivationFactory( str, &IID_IInspectable, (void **)&tmp_inspectable ); + ok( hr == REGDB_E_CLASSNOTREG, "RoGetActivationFactory returned %#lx\n", hr ); + pWindowsDeleteString( str ); + + + hr = pWindowsCreateString( constant_effect_class_name, wcslen( constant_effect_class_name ), &str ); + ok( hr == S_OK, "WindowsCreateString returned %#lx\n", hr ); + hr = pRoGetActivationFactory( str, &IID_IActivationFactory, (void **)&activation_factory ); + todo_wine + ok( hr == S_OK, "RoGetActivationFactory returned %#lx\n", hr ); + pWindowsDeleteString( str ); + if (hr != S_OK) goto skip_tests; + + hr = IActivationFactory_ActivateInstance( activation_factory, &tmp_inspectable ); + todo_wine + ok( hr == S_OK, "QueryInterface returned %#lx\n", hr ); + IActivationFactory_Release( activation_factory ); + + hr = IInspectable_QueryInterface( tmp_inspectable, &IID_IForceFeedbackEffect, (void **)&effect ); + todo_wine + ok( hr == S_OK, "QueryInterface returned %#lx\n", hr ); + IInspectable_Release( tmp_inspectable ); + + hr = IForceFeedbackEffect_QueryInterface( effect, &IID_IConstantForceEffect, (void **)&constant_effect ); + ok( hr == S_OK, "QueryInterface returned %#lx\n", hr ); + + hr = IConstantForceEffect_SetParameters( constant_effect, vector3, duration ); + todo_wine + ok( hr == S_OK, "SetParameters returned %#lx\n", hr ); + hr = IConstantForceEffect_SetParametersWithEnvelope( constant_effect, vector3, 0.1, 0.2, 0.3, + duration, duration, duration, duration, 1 ); + todo_wine + ok( hr == S_OK, "SetParametersWithEnvelope returned %#lx\n", hr ); + IConstantForceEffect_Release( constant_effect ); + + gain = 12345.6; + hr = IForceFeedbackEffect_get_Gain( effect, &gain ); + todo_wine + ok( hr == S_OK, "get_Gain returned %#lx\n", hr ); + todo_wine + ok( gain == 1.0, "get_MasterGain returned %f\n", gain ); + hr = IForceFeedbackEffect_put_Gain( effect, 0.5 ); + todo_wine + ok( hr == S_FALSE, "put_Gain returned %#lx\n", hr ); + state = 0xdeadbeef; + hr = IForceFeedbackEffect_get_State( effect, &state ); + todo_wine + ok( hr == S_OK, "get_State returned %#lx\n", hr ); + todo_wine + ok( state == ForceFeedbackEffectState_Stopped, "get_State returned %#lx\n", hr ); + hr = IForceFeedbackEffect_Start( effect ); + todo_wine + ok( hr == 0x86854003, "Start returned %#lx\n", hr ); + hr = IForceFeedbackEffect_Stop( effect ); + todo_wine + ok( hr == 0x86854003, "Stop returned %#lx\n", hr ); + + hr = IForceFeedbackMotor_LoadEffectAsync( motor, effect, &result_async ); + todo_wine + ok( hr == S_OK, "LoadEffectAsync returned %#lx\n", hr ); + result_async_handler = default_result_async_handler; + result_async_handler.event = CreateEventW( NULL, FALSE, FALSE, NULL ); + ok( !!result_async_handler.event, "CreateEventW failed, error %lu\n", GetLastError() ); + hr = IAsyncOperation_ForceFeedbackLoadEffectResult_put_Completed( result_async, &result_async_handler.IAsyncOperationCompletedHandler_ForceFeedbackLoadEffectResult_iface ); + ok( hr == S_OK, "put_Completed returned %#lx\n", hr ); + ret = WaitForSingleObject( result_async_handler.event, 5000 ); + ok( !ret, "WaitForSingleObject returned %#lx\n", ret ); + ret = CloseHandle( result_async_handler.event ); + ok( ret, "CloseHandle failed, error %lu\n", GetLastError() ); + check_result_async( result_async, 1, Error, 0x86854008, ForceFeedbackLoadEffectResult_EffectNotSupported ); + ref = IAsyncOperation_ForceFeedbackLoadEffectResult_Release( result_async ); + ok( ref == 0, "Release returned %lu\n", ref ); + + hr = IForceFeedbackEffect_Start( effect ); + todo_wine + ok( hr == 0x86854003, "Start returned %#lx\n", hr ); + hr = IForceFeedbackEffect_Stop( effect ); + todo_wine + ok( hr == 0x86854003, "Stop returned %#lx\n", hr ); + hr = IForceFeedbackMotor_TryUnloadEffectAsync( motor, effect, &bool_async ); + todo_wine + ok( hr == 0x86854003, "TryUnloadEffectAsync returned %#lx\n", hr ); + + ref = IForceFeedbackEffect_Release( effect ); + ok( ref == 0, "Release returned %lu\n", ref ); + + +skip_tests: IForceFeedbackMotor_Release( motor );
IRawGameController_Release( raw_controller );