From: Arkadiusz Hiler ahiler@codeweavers.com
Signed-off-by: Arkadiusz Hiler ahiler@codeweavers.com Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/tests/joystick8.c | 212 +++++++++++++++++++++++++++++++++- 1 file changed, 210 insertions(+), 2 deletions(-)
diff --git a/dlls/dinput/tests/joystick8.c b/dlls/dinput/tests/joystick8.c index dd06b1b5185..7de4ab80d6d 100644 --- a/dlls/dinput/tests/joystick8.c +++ b/dlls/dinput/tests/joystick8.c @@ -2173,6 +2173,127 @@ static BOOL test_device_types( DWORD version ) 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, 8), + INPUT(1, Data|Var|Abs), + END_COLLECTION, + END_COLLECTION, + }; + static const unsigned char wheel_steering_only_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), + LOGICAL_MINIMUM(1, 0), + LOGICAL_MAXIMUM(1, 127), + PHYSICAL_MINIMUM(1, 0), + PHYSICAL_MAXIMUM(1, 127), + REPORT_SIZE(1, 8), + REPORT_COUNT(1, 1), + 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, 8), + INPUT(1, Data|Var|Abs), + END_COLLECTION, + END_COLLECTION, + }; + static const unsigned char wheel_dualpedals_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(1, HID_USAGE_GENERIC_X), + LOGICAL_MINIMUM(1, 0), + LOGICAL_MAXIMUM(1, 127), + PHYSICAL_MINIMUM(1, 0), + PHYSICAL_MAXIMUM(1, 127), + REPORT_SIZE(1, 8), + REPORT_COUNT(1, 4), + 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, 8), + INPUT(1, Data|Var|Abs), + END_COLLECTION, + END_COLLECTION, + }; + 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), @@ -2222,6 +2343,30 @@ static BOOL test_device_types( DWORD version ) .InputReportByteLength = 5, }, }, + { + .report_desc_buf = wheel_steering_only_desc, + .report_desc_len = sizeof(wheel_steering_only_desc), + .hid_caps = + { + .InputReportByteLength = 3, + }, + }, + { + .report_desc_buf = wheel_dualpedals_desc, + .report_desc_len = sizeof(wheel_dualpedals_desc), + .hid_caps = + { + .InputReportByteLength = 6, + }, + }, + { + .report_desc_buf = wheel_threepedals_desc, + .report_desc_len = sizeof(wheel_threepedals_desc), + .hid_caps = + { + .InputReportByteLength = 7, + }, + }, }; const DIDEVCAPS expect_caps[] = { @@ -2257,6 +2402,33 @@ static BOOL test_device_types( DWORD version ) .dwPOVs = 1, .dwButtons = 5, }, + { + .dwSize = sizeof(DIDEVCAPS), + .dwFlags = DIDC_ATTACHED|DIDC_EMULATED, + .dwDevType = version >= 0x800 ? DIDEVTYPE_HID|(DI8DEVTYPEDRIVING_LIMITED << 8)|DI8DEVTYPE_DRIVING + : DIDEVTYPE_HID|(DIDEVTYPEJOYSTICK_WHEEL << 8)|DIDEVTYPE_JOYSTICK, + .dwAxes = 1, + .dwPOVs = 1, + .dwButtons = 5, + }, + { + .dwSize = sizeof(DIDEVCAPS), + .dwFlags = DIDC_ATTACHED|DIDC_EMULATED, + .dwDevType = version >= 0x800 ? DIDEVTYPE_HID|(DI8DEVTYPEDRIVING_DUALPEDALS << 8)|DI8DEVTYPE_DRIVING + : DIDEVTYPE_HID|(DIDEVTYPEJOYSTICK_WHEEL << 8)|DIDEVTYPE_JOYSTICK, + .dwAxes = 4, + .dwPOVs = 1, + .dwButtons = 5, + }, + { + .dwSize = sizeof(DIDEVCAPS), + .dwFlags = DIDC_ATTACHED|DIDC_EMULATED, + .dwDevType = version >= 0x800 ? DIDEVTYPE_HID|(DI8DEVTYPEDRIVING_THREEPEDALS << 8)|DI8DEVTYPE_DRIVING + : DIDEVTYPE_HID|(DIDEVTYPEJOYSTICK_WHEEL << 8)|DIDEVTYPE_JOYSTICK, + .dwAxes = 5, + .dwPOVs = 1, + .dwButtons = 5, + }, };
const DIDEVICEINSTANCEW expect_devinst[] = @@ -2309,6 +2481,42 @@ static BOOL test_device_types( DWORD version ) .wUsagePage = HID_USAGE_PAGE_GENERIC, .wUsage = HID_USAGE_GENERIC_JOYSTICK, }, + { + .dwSize = sizeof(DIDEVICEINSTANCEW), + .guidInstance = expect_guid_product, + .guidProduct = expect_guid_product, + .dwDevType = version >= 0x800 ? DIDEVTYPE_HID|(DI8DEVTYPEDRIVING_LIMITED << 8)|DI8DEVTYPE_DRIVING + : DIDEVTYPE_HID|(DIDEVTYPEJOYSTICK_WHEEL << 8)|DIDEVTYPE_JOYSTICK, + .tszInstanceName = L"Wine test root driver", + .tszProductName = L"Wine test root driver", + .guidFFDriver = GUID_NULL, + .wUsagePage = HID_USAGE_PAGE_GENERIC, + .wUsage = HID_USAGE_GENERIC_JOYSTICK, + }, + { + .dwSize = sizeof(DIDEVICEINSTANCEW), + .guidInstance = expect_guid_product, + .guidProduct = expect_guid_product, + .dwDevType = version >= 0x800 ? DIDEVTYPE_HID|(DI8DEVTYPEDRIVING_DUALPEDALS << 8)|DI8DEVTYPE_DRIVING + : DIDEVTYPE_HID|(DIDEVTYPEJOYSTICK_WHEEL << 8)|DIDEVTYPE_JOYSTICK, + .tszInstanceName = L"Wine test root driver", + .tszProductName = L"Wine test root driver", + .guidFFDriver = GUID_NULL, + .wUsagePage = HID_USAGE_PAGE_GENERIC, + .wUsage = HID_USAGE_GENERIC_JOYSTICK, + }, + { + .dwSize = sizeof(DIDEVICEINSTANCEW), + .guidInstance = expect_guid_product, + .guidProduct = expect_guid_product, + .dwDevType = version >= 0x800 ? DIDEVTYPE_HID|(DI8DEVTYPEDRIVING_THREEPEDALS << 8)|DI8DEVTYPE_DRIVING + : DIDEVTYPE_HID|(DIDEVTYPEJOYSTICK_WHEEL << 8)|DIDEVTYPE_JOYSTICK, + .tszInstanceName = L"Wine test root driver", + .tszProductName = L"Wine test root driver", + .guidFFDriver = GUID_NULL, + .wUsagePage = HID_USAGE_PAGE_GENERIC, + .wUsage = HID_USAGE_GENERIC_JOYSTICK, + }, };
C_ASSERT(ARRAY_SIZE(expect_caps) == ARRAY_SIZE(device_desc)); @@ -2349,7 +2557,7 @@ static BOOL test_device_types( DWORD version ) ok( hr == DI_OK, "GetDeviceInfo returned %#x\n", hr ); check_member( devinst, expect_devinst[i], "%d", dwSize ); check_member_guid( devinst, expect_devinst[i], guidProduct ); - todo_wine_if( version <= 0x700 && i == 3 ) + todo_wine_if( (version <= 0x700 && i == 3) || i > 3 ) check_member( devinst, expect_devinst[i], "%#x", dwDevType ); check_member_guid( devinst, expect_devinst[i], guidFFDriver ); check_member( devinst, expect_devinst[i], "%04x", wUsagePage ); @@ -2359,7 +2567,7 @@ static BOOL test_device_types( DWORD version ) 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 ) + todo_wine_if( (version <= 0x700 && i == 3) || 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 );
From: Arkadiusz Hiler ahiler@codeweavers.com
Signed-off-by: Arkadiusz Hiler ahiler@codeweavers.com Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/joystick_hid.c | 31 +++++++++++++++++++++++++++++++ dlls/dinput/tests/joystick8.c | 4 ++-- 2 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index 29d1de8b98e..ccf205e275b 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -1400,6 +1400,7 @@ static BOOL hid_joystick_device_try_open( UINT32 handle, const WCHAR *path, HAND PHIDP_PREPARSED_DATA *preparsed, HIDD_ATTRIBUTES *attrs, HIDP_CAPS *caps, DIDEVICEINSTANCEW *instance, DWORD version ) { + BOOL has_accelerator, has_brake, has_clutch; PHIDP_PREPARSED_DATA preparsed_data = NULL; DWORD type = 0, button_count = 0; HIDP_BUTTON_CAPS buttons[10]; @@ -1486,6 +1487,36 @@ static BOOL hid_joystick_device_try_open( UINT32 handle, const WCHAR *path, HAND if (status != HIDP_STATUS_SUCCESS || !count) type = DI8DEVTYPE_SUPPLEMENTAL | (DI8DEVTYPESUPPLEMENTAL_UNKNOWN << 8) | DIDEVTYPE_HID;
+ count = 1; + status = HidP_GetSpecificValueCaps( HidP_Input, HID_USAGE_PAGE_SIMULATION, 0, HID_USAGE_SIMULATION_STEERING, + &value, &count, preparsed_data ); + if (status == HIDP_STATUS_SUCCESS && count) + { + type = DI8DEVTYPE_DRIVING | DIDEVTYPE_HID; + + count = 1; + status = HidP_GetSpecificValueCaps( HidP_Input, HID_USAGE_PAGE_SIMULATION, 0, HID_USAGE_SIMULATION_ACCELERATOR, + &value, &count, preparsed_data ); + has_accelerator = (status == HIDP_STATUS_SUCCESS && count); + + count = 1; + status = HidP_GetSpecificValueCaps( HidP_Input, HID_USAGE_PAGE_SIMULATION, 0, HID_USAGE_SIMULATION_BRAKE, + &value, &count, preparsed_data ); + has_brake = (status == HIDP_STATUS_SUCCESS && count); + + count = 1; + status = HidP_GetSpecificValueCaps( HidP_Input, HID_USAGE_PAGE_SIMULATION, 0, HID_USAGE_SIMULATION_CLUTCH, + &value, &count, preparsed_data ); + has_clutch = (status == HIDP_STATUS_SUCCESS && count); + + if (has_accelerator && has_brake && has_clutch) + type |= (DI8DEVTYPEDRIVING_THREEPEDALS << 8); + else if (has_accelerator && has_brake) + type |= (DI8DEVTYPEDRIVING_DUALPEDALS << 8); + else + type |= (DI8DEVTYPEDRIVING_LIMITED << 8); + } + instance->dwDevType = device_type_for_version( type, version );
*device = device_file; diff --git a/dlls/dinput/tests/joystick8.c b/dlls/dinput/tests/joystick8.c index 7de4ab80d6d..42fbcf808d5 100644 --- a/dlls/dinput/tests/joystick8.c +++ b/dlls/dinput/tests/joystick8.c @@ -2557,7 +2557,7 @@ static BOOL test_device_types( DWORD version ) ok( hr == DI_OK, "GetDeviceInfo returned %#x\n", hr ); check_member( devinst, expect_devinst[i], "%d", dwSize ); check_member_guid( devinst, expect_devinst[i], guidProduct ); - todo_wine_if( (version <= 0x700 && i == 3) || i > 3 ) + todo_wine_if( version <= 0x700 && i == 3 ) check_member( devinst, expect_devinst[i], "%#x", dwDevType ); check_member_guid( devinst, expect_devinst[i], guidFFDriver ); check_member( devinst, expect_devinst[i], "%04x", wUsagePage ); @@ -2567,7 +2567,7 @@ static BOOL test_device_types( DWORD version ) 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) || i > 3 ) + 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 );
So that it shares hidclass.sys with other device drivers. This won't make all the tests to pass if there's some physical devices, but it'll avoid a few spurious failures.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/tests/hid.c | 2 +- dlls/dinput/tests/joystick8.c | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-)
diff --git a/dlls/dinput/tests/hid.c b/dlls/dinput/tests/hid.c index a0fd2f6c660..0e94ce63aab 100644 --- a/dlls/dinput/tests/hid.c +++ b/dlls/dinput/tests/hid.c @@ -339,7 +339,7 @@ static const char inf_text[] = "ServiceType=1\n" "StartType=3\n" "ErrorControl=1\n" - "LoadOrderGroup=Extended Base\n" + "LoadOrderGroup=WinePlugPlay\n" "DisplayName="winetest bus driver"\n" "; they don't sleep anymore, on the beach\n";
diff --git a/dlls/dinput/tests/joystick8.c b/dlls/dinput/tests/joystick8.c index 42fbcf808d5..208edf3bc0c 100644 --- a/dlls/dinput/tests/joystick8.c +++ b/dlls/dinput/tests/joystick8.c @@ -248,9 +248,6 @@ static void check_dinput_devices( DWORD version, DIDEVICEINSTANCEW *devinst ) 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 );
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/tests/joystick8.c | 126 ++++++++++++++++++++++++++++++++++ 1 file changed, 126 insertions(+)
diff --git a/dlls/dinput/tests/joystick8.c b/dlls/dinput/tests/joystick8.c index 208edf3bc0c..9c7200d3202 100644 --- a/dlls/dinput/tests/joystick8.c +++ b/dlls/dinput/tests/joystick8.c @@ -20,6 +20,7 @@
#include <stdarg.h> #include <stddef.h> +#include <limits.h>
#include "ntstatus.h" #define WIN32_NO_STATUS @@ -2949,6 +2950,127 @@ done: return device != NULL; }
+static void test_input_lost( DWORD version ) +{ +#include "psh_hid_macros.h" + static const unsigned char report_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_PAGE(1, HID_USAGE_PAGE_BUTTON), + USAGE_MINIMUM(1, 1), + USAGE_MAXIMUM(1, 6), + LOGICAL_MINIMUM(1, 0), + LOGICAL_MAXIMUM(1, 1), + PHYSICAL_MINIMUM(1, 0), + PHYSICAL_MAXIMUM(1, 1), + REPORT_SIZE(1, 1), + REPORT_COUNT(1, 8), + INPUT(1, Data|Var|Abs), + END_COLLECTION, + END_COLLECTION, + }; +#include "pop_hid_macros.h" + + static const HIDP_CAPS hid_caps = + { + .InputReportByteLength = 1, + }; + static const DIPROPDWORD buffer_size = + { + .diph = + { + .dwHeaderSize = sizeof(DIPROPHEADER), + .dwSize = sizeof(DIPROPDWORD), + .dwHow = DIPH_DEVICE, + .dwObj = 0, + }, + .dwData = UINT_MAX, + }; + + DIDEVICEINSTANCEW devinst = {.dwSize = sizeof(DIDEVICEINSTANCEW)}; + DIDEVICEOBJECTDATA objdata[32] = {{0}}; + WCHAR cwd[MAX_PATH], tempdir[MAX_PATH]; + IDirectInputDevice8W *device = NULL; + ULONG ref, count, size; + DIJOYSTATE2 state; + HRESULT hr; + + winetest_push_context( "%#x", version ); + + GetCurrentDirectoryW( ARRAY_SIZE(cwd), cwd ); + GetTempPathW( ARRAY_SIZE(tempdir), tempdir ); + SetCurrentDirectoryW( tempdir ); + + cleanup_registry_keys(); + if (!dinput_driver_start( report_desc, sizeof(report_desc), &hid_caps, NULL, 0 )) goto done; + if (FAILED(hr = dinput_test_create_device( version, &devinst, &device ))) goto done; + + hr = IDirectInputDevice8_SetDataFormat( device, &c_dfDIJoystick2 ); + ok( hr == DI_OK, "SetDataFormat returned %#x\n", hr ); + hr = IDirectInputDevice8_SetCooperativeLevel( device, 0, DISCL_NONEXCLUSIVE | DISCL_BACKGROUND ); + ok( hr == DI_OK, "SetCooperativeLevel returned %#x\n", hr ); + hr = IDirectInputDevice8_SetProperty( device, DIPROP_BUFFERSIZE, &buffer_size.diph ); + ok( hr == DI_OK, "SetProperty returned %#x\n", hr ); + + hr = IDirectInputDevice8_Acquire( device ); + ok( hr == DI_OK, "Acquire returned %#x\n", hr ); + hr = IDirectInputDevice8_GetDeviceState( device, sizeof(state), &state ); + ok( hr == DI_OK, "GetDeviceState returned %#x\n", hr ); + size = version < 0x0800 ? sizeof(DIDEVICEOBJECTDATA_DX3) : sizeof(DIDEVICEOBJECTDATA); + count = 1; + hr = IDirectInputDevice8_GetDeviceData( device, size, objdata, &count, DIGDD_PEEK ); + ok( hr == DI_OK, "GetDeviceData returned %#x\n", hr ); + ok( count == 0, "got %u expected %u\n", count, 0 ); + + pnp_driver_stop(); + + hr = IDirectInputDevice8_GetDeviceState( device, sizeof(state), &state ); + todo_wine + ok( hr == DIERR_INPUTLOST, "GetDeviceState returned %#x\n", hr ); + hr = IDirectInputDevice8_GetDeviceState( device, sizeof(state), &state ); + todo_wine + ok( hr == DIERR_INPUTLOST, "GetDeviceState returned %#x\n", hr ); + hr = IDirectInputDevice8_GetDeviceData( device, size, objdata, &count, DIGDD_PEEK ); + todo_wine + ok( hr == DIERR_INPUTLOST, "GetDeviceData returned %#x\n", hr ); + hr = IDirectInputDevice8_Poll( device ); + todo_wine + ok( hr == DIERR_INPUTLOST, "Poll returned: %#x\n", hr ); + + hr = IDirectInputDevice8_Acquire( device ); + todo_wine + ok( hr == DIERR_UNPLUGGED, "Acquire returned %#x\n", hr ); + hr = IDirectInputDevice8_GetDeviceState( device, sizeof(state), &state ); + ok( hr == DIERR_NOTACQUIRED, "GetDeviceState returned %#x\n", hr ); + hr = IDirectInputDevice8_GetDeviceData( device, size, objdata, &count, DIGDD_PEEK ); + ok( hr == DIERR_NOTACQUIRED, "GetDeviceData returned %#x\n", hr ); + hr = IDirectInputDevice8_Unacquire( device ); + ok( hr == DI_NOEFFECT, "Unacquire returned: %#x\n", hr ); + + dinput_driver_start( report_desc, sizeof(report_desc), &hid_caps, NULL, 0 ); + + hr = IDirectInputDevice8_Acquire( device ); + todo_wine + ok( hr == DIERR_UNPLUGGED, "Acquire returned %#x\n", hr ); + hr = IDirectInputDevice8_GetDeviceState( device, sizeof(state), &state ); + todo_wine + ok( hr == DIERR_NOTACQUIRED, "GetDeviceState returned %#x\n", hr ); + + ref = IDirectInputDevice8_Release( device ); + ok( ref == 0, "Release returned %d\n", ref ); + +done: + pnp_driver_stop(); + cleanup_registry_keys(); + SetCurrentDirectoryW( cwd ); + + winetest_pop_context(); +} + START_TEST( joystick8 ) { if (!dinput_test_init()) return; @@ -2966,6 +3088,10 @@ START_TEST( joystick8 ) test_simple_joystick( 0x500 ); test_simple_joystick( 0x700 ); test_simple_joystick( 0x800 ); + + test_input_lost( 0x500 ); + test_input_lost( 0x700 ); + test_input_lost( 0x800 ); } CoUninitialize();
Looks like this patch may be causing some timeouts on w1064_tsign, although the run for the last patch didn't. It's maybe just a matter of too many driver start/stop and it taking too long but I'll have a better look.
First three patches should be okay.
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=105464
Your paranoid android.
=== w8 (32 bit report) ===
dinput: hid.c:581: Test failed: 0x800: desc[4]: unexpected error 1058
=== w1064_tsign (64 bit report) ===
dinput: joystick8: Timeout
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/device.c | 19 +++++++++++-------- dlls/dinput/joystick_hid.c | 17 +++++++++++------ 2 files changed, 22 insertions(+), 14 deletions(-)
diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c index a4c85351648..5f8227acd0c 100644 --- a/dlls/dinput/device.c +++ b/dlls/dinput/device.c @@ -82,6 +82,11 @@ static inline const char *debugstr_diobjectdataformat( const DIOBJECTDATAFORMAT debugstr_guid( data->pguid ), data->dwOfs, data->dwType, data->dwFlags ); }
+static inline BOOL is_exclusively_acquired( struct dinput_device *device ) +{ + return device->acquired && (device->dwCoopLevel & DISCL_EXCLUSIVE); +} + /****************************************************************************** * Various debugging tools */ @@ -1073,7 +1078,7 @@ static HRESULT check_property( struct dinput_device *impl, const GUID *guid, con
case (DWORD_PTR)DIPROP_FFLOAD: if (!(impl->caps.dwFlags & DIDC_FORCEFEEDBACK)) return DIERR_UNSUPPORTED; - if (!impl->acquired || !(impl->dwCoopLevel & DISCL_EXCLUSIVE)) return DIERR_NOTEXCLUSIVEACQUIRED; + if (!is_exclusively_acquired( impl )) return DIERR_NOTEXCLUSIVEACQUIRED; /* fallthrough */ case (DWORD_PTR)DIPROP_PRODUCTNAME: case (DWORD_PTR)DIPROP_INSTANCENAME: @@ -1399,7 +1404,7 @@ static HRESULT WINAPI dinput_device_set_property( IDirectInputDevice8W *iface, c const DIPROPDWORD *value = (const DIPROPDWORD *)header; if (!impl->vtbl->send_device_gain) return DIERR_UNSUPPORTED; impl->device_gain = value->dwData; - if (!impl->acquired || !(impl->dwCoopLevel & DISCL_EXCLUSIVE)) return DI_OK; + if (!is_exclusively_acquired( impl )) return DI_OK; return impl->vtbl->send_device_gain( iface, impl->device_gain ); } case (DWORD_PTR)DIPROP_AXISMODE: @@ -1679,7 +1684,7 @@ static HRESULT WINAPI dinput_device_CreateEffect( IDirectInputDevice8W *iface, c if (!params) return DI_OK;
flags = params->dwSize == sizeof(DIEFFECT_DX6) ? DIEP_ALLPARAMS : DIEP_ALLPARAMS_DX5; - if (!impl->acquired || !(impl->dwCoopLevel & DISCL_EXCLUSIVE)) flags |= DIEP_NODOWNLOAD; + if (!is_exclusively_acquired( impl )) flags |= DIEP_NODOWNLOAD; hr = IDirectInputEffect_SetParameters( *out, params, flags ); if (FAILED(hr)) goto failed; return DI_OK; @@ -1788,10 +1793,8 @@ static HRESULT WINAPI dinput_device_GetForceFeedbackState( IDirectInputDevice8W if (!(impl->caps.dwFlags & DIDC_FORCEFEEDBACK)) return DIERR_UNSUPPORTED;
EnterCriticalSection( &impl->crit ); - if (!impl->acquired || !(impl->dwCoopLevel & DISCL_EXCLUSIVE)) - hr = DIERR_NOTEXCLUSIVEACQUIRED; - else - *out = impl->force_feedback_state; + if (!is_exclusively_acquired( impl )) hr = DIERR_NOTEXCLUSIVEACQUIRED; + else *out = impl->force_feedback_state; LeaveCriticalSection( &impl->crit );
return hr; @@ -1819,7 +1822,7 @@ static HRESULT WINAPI dinput_device_SendForceFeedbackCommand( IDirectInputDevice if (!impl->vtbl->send_force_feedback_command) return DIERR_UNSUPPORTED;
EnterCriticalSection( &impl->crit ); - if (!impl->acquired || !(impl->dwCoopLevel & DISCL_EXCLUSIVE)) hr = DIERR_NOTEXCLUSIVEACQUIRED; + if (!is_exclusively_acquired( impl )) hr = DIERR_NOTEXCLUSIVEACQUIRED; else hr = impl->vtbl->send_force_feedback_command( iface, command, FALSE ); LeaveCriticalSection( &impl->crit );
diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index ccf205e275b..7a365137271 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -241,6 +241,11 @@ static inline struct hid_joystick_effect *impl_from_IDirectInputEffect( IDirectI return CONTAINING_RECORD( iface, struct hid_joystick_effect, IDirectInputEffect_iface ); }
+static inline BOOL is_exclusively_acquired( struct hid_joystick *joystick ) +{ + return joystick->base.acquired && (joystick->base.dwCoopLevel & DISCL_EXCLUSIVE); +} + static const GUID *object_usage_to_guid( USAGE usage_page, USAGE usage ) { switch (usage_page) @@ -827,7 +832,7 @@ static HRESULT hid_joystick_get_property( IDirectInputDevice8W *iface, DWORD pro { DIPROPDWORD *value = (DIPROPDWORD *)header; if (!(impl->base.caps.dwFlags & DIDC_FORCEFEEDBACK)) return DIERR_UNSUPPORTED; - if (!impl->base.acquired || !(impl->base.dwCoopLevel & DISCL_EXCLUSIVE)) return DIERR_NOTEXCLUSIVEACQUIRED; + if (!is_exclusively_acquired( impl )) return DIERR_NOTEXCLUSIVEACQUIRED; value->dwData = 0; return DI_OK; } @@ -898,7 +903,7 @@ static HRESULT hid_joystick_unacquire( IDirectInputDevice8W *iface ) else WaitForSingleObject( impl->base.read_event, INFINITE );
if (!(impl->base.caps.dwFlags & DIDC_FORCEFEEDBACK)) return DI_OK; - if (!impl->base.acquired || !(impl->base.dwCoopLevel & DISCL_EXCLUSIVE)) return DI_OK; + if (!is_exclusively_acquired( impl )) return DI_OK; hid_joystick_send_force_feedback_command( iface, DISFFC_RESET, TRUE ); return DI_OK; } @@ -2682,7 +2687,7 @@ static HRESULT WINAPI hid_joystick_effect_Start( IDirectInputEffect *iface, DWOR else control = PID_USAGE_OP_EFFECT_START;
EnterCriticalSection( &impl->joystick->base.crit ); - if (!impl->joystick->base.acquired || !(impl->joystick->base.dwCoopLevel & DISCL_EXCLUSIVE)) + if (!is_exclusively_acquired( impl->joystick )) hr = DIERR_NOTEXCLUSIVEACQUIRED; else if ((flags & DIES_NODOWNLOAD) && !impl->index) hr = DIERR_NOTDOWNLOADED; @@ -2730,7 +2735,7 @@ static HRESULT WINAPI hid_joystick_effect_Stop( IDirectInputEffect *iface ) TRACE( "iface %p.\n", iface );
EnterCriticalSection( &impl->joystick->base.crit ); - if (!impl->joystick->base.acquired || !(impl->joystick->base.dwCoopLevel & DISCL_EXCLUSIVE)) + if (!is_exclusively_acquired( impl->joystick )) hr = DIERR_NOTEXCLUSIVEACQUIRED; else if (!impl->index) hr = DIERR_NOTDOWNLOADED; @@ -2775,7 +2780,7 @@ static HRESULT WINAPI hid_joystick_effect_GetEffectStatus( IDirectInputEffect *i *status = 0;
EnterCriticalSection( &impl->joystick->base.crit ); - if (!impl->joystick->base.acquired || !(impl->joystick->base.dwCoopLevel & DISCL_EXCLUSIVE)) + if (!is_exclusively_acquired( impl->joystick )) hr = DIERR_NOTEXCLUSIVEACQUIRED; else if (!impl->index) hr = DIERR_NOTDOWNLOADED; @@ -2850,7 +2855,7 @@ static HRESULT WINAPI hid_joystick_effect_Download( IDirectInputEffect *iface ) if (impl->modified) hr = DI_OK; else hr = DI_NOEFFECT;
- if (!impl->joystick->base.acquired || !(impl->joystick->base.dwCoopLevel & DISCL_EXCLUSIVE)) + if (!is_exclusively_acquired( impl->joystick )) hr = DIERR_NOTEXCLUSIVEACQUIRED; else if ((impl->flags & complete_mask) != complete_mask) hr = DIERR_INCOMPLETEEFFECT;
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/device.c | 26 +++++++++++++------------- dlls/dinput/device_private.h | 8 +++++++- dlls/dinput/dinput_main.c | 4 ++-- dlls/dinput/joystick_hid.c | 2 +- 4 files changed, 23 insertions(+), 17 deletions(-)
diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c index 5f8227acd0c..47cf4d72dc3 100644 --- a/dlls/dinput/device.c +++ b/dlls/dinput/device.c @@ -84,7 +84,7 @@ static inline const char *debugstr_diobjectdataformat( const DIOBJECTDATAFORMAT
static inline BOOL is_exclusively_acquired( struct dinput_device *device ) { - return device->acquired && (device->dwCoopLevel & DISCL_EXCLUSIVE); + return device->status == STATUS_ACQUIRED && (device->dwCoopLevel & DISCL_EXCLUSIVE); }
/****************************************************************************** @@ -582,7 +582,7 @@ static HRESULT WINAPI dinput_device_Acquire( IDirectInputDevice8W *iface ) TRACE( "iface %p.\n", iface );
EnterCriticalSection( &impl->crit ); - if (impl->acquired) + if (impl->status == STATUS_ACQUIRED) hr = DI_NOEFFECT; else if (!impl->user_format) hr = DIERR_INVALIDPARAM; @@ -590,8 +590,8 @@ static HRESULT WINAPI dinput_device_Acquire( IDirectInputDevice8W *iface ) hr = DIERR_OTHERAPPHASPRIO; else { - impl->acquired = TRUE; - if (FAILED(hr = impl->vtbl->acquire( iface ))) impl->acquired = FALSE; + impl->status = STATUS_ACQUIRED; + if (FAILED(hr = impl->vtbl->acquire( iface ))) impl->status = STATUS_UNACQUIRED; } LeaveCriticalSection( &impl->crit ); if (hr != DI_OK) return hr; @@ -614,9 +614,9 @@ static HRESULT WINAPI dinput_device_Unacquire( IDirectInputDevice8W *iface ) TRACE( "iface %p.\n", iface );
EnterCriticalSection( &impl->crit ); - if (!impl->acquired) hr = DI_NOEFFECT; + if (impl->status != STATUS_ACQUIRED) hr = DI_NOEFFECT; else hr = impl->vtbl->unacquire( iface ); - impl->acquired = FALSE; + impl->status = STATUS_UNACQUIRED; LeaveCriticalSection( &impl->crit ); if (hr != DI_OK) return hr;
@@ -647,7 +647,7 @@ static HRESULT WINAPI dinput_device_SetDataFormat( IDirectInputDevice8W *iface,
if (format->dwSize != sizeof(DIDATAFORMAT)) return DIERR_INVALIDPARAM; if (format->dwObjSize != sizeof(DIOBJECTDATAFORMAT)) return DIERR_INVALIDPARAM; - if (This->acquired) return DIERR_ACQUIRED; + if (This->status == STATUS_ACQUIRED) return DIERR_ACQUIRED;
EnterCriticalSection(&This->crit);
@@ -696,7 +696,7 @@ static HRESULT WINAPI dinput_device_SetCooperativeLevel( IDirectInputDevice8W *i
/* Store the window which asks for the mouse */ EnterCriticalSection(&This->crit); - if (This->acquired) hr = DIERR_ACQUIRED; + if (This->status == STATUS_ACQUIRED) hr = DIERR_ACQUIRED; else { This->win = hwnd; @@ -1014,7 +1014,7 @@ static HRESULT check_property( struct dinput_device *impl, const GUID *guid, con case (DWORD_PTR)DIPROP_BUFFERSIZE: case (DWORD_PTR)DIPROP_PHYSICALRANGE: case (DWORD_PTR)DIPROP_LOGICALRANGE: - if (impl->acquired) return DIERR_ACQUIRED; + if (impl->status == STATUS_ACQUIRED) return DIERR_ACQUIRED; break; case (DWORD_PTR)DIPROP_FFLOAD: case (DWORD_PTR)DIPROP_GRANULARITY: @@ -1553,7 +1553,7 @@ static HRESULT WINAPI dinput_device_GetDeviceState( IDirectInputDevice8W *iface, IDirectInputDevice2_Poll( iface );
EnterCriticalSection( &impl->crit ); - if (!impl->acquired) + if (impl->status != STATUS_ACQUIRED) hr = DIERR_NOTACQUIRED; else if (!(user_format = impl->user_format)) hr = DIERR_INVALIDPARAM; @@ -1605,7 +1605,7 @@ static HRESULT WINAPI dinput_device_GetDeviceData( IDirectInputDevice8W *iface, if (This->dinput->dwVersion == 0x0800 || size == sizeof(DIDEVICEOBJECTDATA_DX3)) { if (!This->queue_len) return DIERR_NOTBUFFERED; - if (!This->acquired) return DIERR_NOTACQUIRED; + if (This->status != STATUS_ACQUIRED) return DIERR_NOTACQUIRED; }
if (!This->queue_len) @@ -1857,7 +1857,7 @@ static HRESULT WINAPI dinput_device_Poll( IDirectInputDevice8W *iface ) HRESULT hr = DI_NOEFFECT;
EnterCriticalSection( &impl->crit ); - if (!impl->acquired) hr = DIERR_NOTACQUIRED; + if (impl->status != STATUS_ACQUIRED) hr = DIERR_NOTACQUIRED; LeaveCriticalSection( &impl->crit ); if (FAILED(hr)) return hr;
@@ -2012,7 +2012,7 @@ static HRESULT WINAPI dinput_device_SetActionMap( IDirectInputDevice8W *iface, D break; }
- if (impl->acquired) return DIERR_ACQUIRED; + if (impl->status == STATUS_ACQUIRED) return DIERR_ACQUIRED;
data_format.dwSize = sizeof(data_format); data_format.dwObjSize = sizeof(DIOBJECTDATAFORMAT); diff --git a/dlls/dinput/device_private.h b/dlls/dinput/device_private.h index 00a80b16590..7865c3a15a9 100644 --- a/dlls/dinput/device_private.h +++ b/dlls/dinput/device_private.h @@ -69,6 +69,12 @@ struct object_properties DWORD calibration_mode; };
+enum device_status +{ + STATUS_UNACQUIRED, + STATUS_ACQUIRED, +}; + /* Device implementation */ struct dinput_device { @@ -84,7 +90,7 @@ struct dinput_device DIDEVCAPS caps; DWORD dwCoopLevel; HWND win; - int acquired; + enum device_status status;
BOOL use_raw_input; /* use raw input instead of low-level messages */ RAWINPUTDEVICE raw_device; /* raw device to (un)register */ diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c index 8347e3aa586..664311b7a31 100644 --- a/dlls/dinput/dinput_main.c +++ b/dlls/dinput/dinput_main.c @@ -128,10 +128,10 @@ static void dinput_device_internal_unacquire( IDirectInputDevice8W *iface ) TRACE( "iface %p.\n", iface );
EnterCriticalSection( &impl->crit ); - if (impl->acquired) + if (impl->status == STATUS_ACQUIRED) { impl->vtbl->unacquire( iface ); - impl->acquired = FALSE; + impl->status = STATUS_UNACQUIRED; list_remove( &impl->entry ); } LeaveCriticalSection( &impl->crit ); diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index 7a365137271..4caaf01affe 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -243,7 +243,7 @@ static inline struct hid_joystick_effect *impl_from_IDirectInputEffect( IDirectI
static inline BOOL is_exclusively_acquired( struct hid_joystick *joystick ) { - return joystick->base.acquired && (joystick->base.dwCoopLevel & DISCL_EXCLUSIVE); + return joystick->base.status == STATUS_ACQUIRED && (joystick->base.dwCoopLevel & DISCL_EXCLUSIVE); }
static const GUID *object_usage_to_guid( USAGE usage_page, USAGE usage )
This fixes hotplug with DS4 and other DInput-compatible controllers in Tekken 7.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/device.c | 8 ++++++-- dlls/dinput/device_private.h | 1 + dlls/dinput/dinput_main.c | 8 +++++--- dlls/dinput/joystick_hid.c | 4 ++-- dlls/dinput/tests/joystick8.c | 5 ----- 5 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c index 47cf4d72dc3..ff8e2252a40 100644 --- a/dlls/dinput/device.c +++ b/dlls/dinput/device.c @@ -1553,7 +1553,9 @@ static HRESULT WINAPI dinput_device_GetDeviceState( IDirectInputDevice8W *iface, IDirectInputDevice2_Poll( iface );
EnterCriticalSection( &impl->crit ); - if (impl->status != STATUS_ACQUIRED) + if (impl->status == STATUS_UNPLUGGED) + hr = DIERR_INPUTLOST; + else if (impl->status != STATUS_ACQUIRED) hr = DIERR_NOTACQUIRED; else if (!(user_format = impl->user_format)) hr = DIERR_INVALIDPARAM; @@ -1605,6 +1607,7 @@ static HRESULT WINAPI dinput_device_GetDeviceData( IDirectInputDevice8W *iface, if (This->dinput->dwVersion == 0x0800 || size == sizeof(DIDEVICEOBJECTDATA_DX3)) { if (!This->queue_len) return DIERR_NOTBUFFERED; + if (This->status == STATUS_UNPLUGGED) return DIERR_INPUTLOST; if (This->status != STATUS_ACQUIRED) return DIERR_NOTACQUIRED; }
@@ -1857,7 +1860,8 @@ static HRESULT WINAPI dinput_device_Poll( IDirectInputDevice8W *iface ) HRESULT hr = DI_NOEFFECT;
EnterCriticalSection( &impl->crit ); - if (impl->status != STATUS_ACQUIRED) hr = DIERR_NOTACQUIRED; + if (impl->status == STATUS_UNPLUGGED) hr = DIERR_INPUTLOST; + else if (impl->status != STATUS_ACQUIRED) hr = DIERR_NOTACQUIRED; LeaveCriticalSection( &impl->crit ); if (FAILED(hr)) return hr;
diff --git a/dlls/dinput/device_private.h b/dlls/dinput/device_private.h index 7865c3a15a9..15a8a6f83b5 100644 --- a/dlls/dinput/device_private.h +++ b/dlls/dinput/device_private.h @@ -73,6 +73,7 @@ enum device_status { STATUS_UNACQUIRED, STATUS_ACQUIRED, + STATUS_UNPLUGGED, };
/* Device implementation */ diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c index 664311b7a31..dbb727c3c43 100644 --- a/dlls/dinput/dinput_main.c +++ b/dlls/dinput/dinput_main.c @@ -1261,7 +1261,6 @@ static DWORD WINAPI dinput_thread_proc( void *params ) struct dinput_device *impl, *next; SIZE_T events_count = 0; HANDLE finished_event; - HRESULT hr; DWORD ret; MSG msg;
@@ -1282,8 +1281,11 @@ static DWORD WINAPI dinput_thread_proc( void *params ) { if (impl->read_event == events[ret]) { - hr = impl->vtbl->read( &impl->IDirectInputDevice8W_iface ); - if (FAILED( hr )) dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface ); + if (FAILED( impl->vtbl->read( &impl->IDirectInputDevice8W_iface ) )) + { + dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface ); + impl->status = STATUS_UNPLUGGED; + } break; } } diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index 4caaf01affe..597a3da4ef8 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -872,7 +872,7 @@ static HRESULT hid_joystick_acquire( IDirectInputDevice8W *iface ) { impl->device = CreateFileW( impl->device_path, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED | FILE_FLAG_NO_BUFFERING, 0 ); - if (impl->device == INVALID_HANDLE_VALUE) return DIERR_INVALIDPARAM; + if (impl->device == INVALID_HANDLE_VALUE) return DIERR_UNPLUGGED; }
memset( &impl->read_ovl, 0, sizeof(impl->read_ovl) ); @@ -882,7 +882,7 @@ static HRESULT hid_joystick_acquire( IDirectInputDevice8W *iface ) { CloseHandle( impl->device ); impl->device = INVALID_HANDLE_VALUE; - return DIERR_INVALIDPARAM; + return DIERR_UNPLUGGED; }
IDirectInputDevice8_SendForceFeedbackCommand( iface, DISFFC_RESET ); diff --git a/dlls/dinput/tests/joystick8.c b/dlls/dinput/tests/joystick8.c index 9c7200d3202..81c3b2069ba 100644 --- a/dlls/dinput/tests/joystick8.c +++ b/dlls/dinput/tests/joystick8.c @@ -3029,20 +3029,15 @@ static void test_input_lost( DWORD version ) pnp_driver_stop();
hr = IDirectInputDevice8_GetDeviceState( device, sizeof(state), &state ); - todo_wine ok( hr == DIERR_INPUTLOST, "GetDeviceState returned %#x\n", hr ); hr = IDirectInputDevice8_GetDeviceState( device, sizeof(state), &state ); - todo_wine ok( hr == DIERR_INPUTLOST, "GetDeviceState returned %#x\n", hr ); hr = IDirectInputDevice8_GetDeviceData( device, size, objdata, &count, DIGDD_PEEK ); - todo_wine ok( hr == DIERR_INPUTLOST, "GetDeviceData returned %#x\n", hr ); hr = IDirectInputDevice8_Poll( device ); - todo_wine ok( hr == DIERR_INPUTLOST, "Poll returned: %#x\n", hr );
hr = IDirectInputDevice8_Acquire( device ); - todo_wine ok( hr == DIERR_UNPLUGGED, "Acquire returned %#x\n", hr ); hr = IDirectInputDevice8_GetDeviceState( device, sizeof(state), &state ); ok( hr == DIERR_NOTACQUIRED, "GetDeviceState returned %#x\n", hr );