Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/device.c | 13 +++++++++++++ dlls/dinput8/tests/hid.c | 16 +--------------- 2 files changed, 14 insertions(+), 15 deletions(-)
diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c index 1dc3c311f2b..834b87f5fe0 100644 --- a/dlls/dinput/device.c +++ b/dlls/dinput/device.c @@ -907,6 +907,19 @@ static HRESULT enum_object_filter_init( struct dinput_device *impl, DIPROPHEADER
static HRESULT check_property( struct dinput_device *impl, const GUID *guid, const DIPROPHEADER *header, BOOL set ) { + switch (LOWORD( guid )) + { + case (DWORD_PTR)DIPROP_VIDPID: + case (DWORD_PTR)DIPROP_TYPENAME: + case (DWORD_PTR)DIPROP_USERNAME: + case (DWORD_PTR)DIPROP_KEYNAME: + case (DWORD_PTR)DIPROP_LOGICALRANGE: + case (DWORD_PTR)DIPROP_PHYSICALRANGE: + case (DWORD_PTR)DIPROP_APPDATA: + if (impl->dinput->dwVersion < 0x0800) return DIERR_UNSUPPORTED; + break; + } + switch (LOWORD( guid )) { case (DWORD_PTR)DIPROP_INSTANCENAME: diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index 17559c61a39..514dfaac9bb 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -4242,7 +4242,6 @@ static void test_simple_joystick( DWORD version ) hr = IDirectInputDevice8_GetProperty( device, DIPROP_VIDPID, NULL ); ok( hr == DIERR_INVALIDPARAM, "GetProperty returned %#x\n", hr ); hr = IDirectInputDevice8_GetProperty( device, DIPROP_VIDPID, &prop_string.diph ); - todo_wine_if( version < 0x0800 ) ok( hr == (version < 0x0800 ? DIERR_UNSUPPORTED : DIERR_INVALIDPARAM), "GetProperty DIPROP_VIDPID returned %#x\n", hr ); prop_dword.diph.dwHeaderSize = sizeof(DIPROPHEADER) - 1; @@ -4252,7 +4251,6 @@ static void test_simple_joystick( DWORD version )
prop_dword.dwData = 0xdeadbeef; hr = IDirectInputDevice8_GetProperty( device, DIPROP_VIDPID, &prop_dword.diph ); - todo_wine_if( version < 0x0800 ) ok( hr == (version < 0x0800 ? DIERR_UNSUPPORTED : DI_OK), "GetProperty DIPROP_VIDPID returned %#x\n", hr ); if (hr == DI_OK) @@ -4297,7 +4295,6 @@ static void test_simple_joystick( DWORD version ) ok( !wcscmp( prop_string.wsz, expect_vidpid_str ), "got type %s\n", debugstr_w(prop_string.wsz) ); } hr = IDirectInputDevice8_GetProperty( device, DIPROP_USERNAME, &prop_string.diph ); - todo_wine_if( version < 0x0800 ) ok( hr == (version < 0x0800 ? DIERR_UNSUPPORTED : DI_NOEFFECT), "GetProperty DIPROP_USERNAME returned %#x\n", hr ); if (hr == DI_NOEFFECT) @@ -4344,7 +4341,6 @@ static void test_simple_joystick( DWORD version ) hr = IDirectInputDevice8_GetProperty( device, DIPROP_RANGE, &prop_range.diph ); ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_RANGE returned %#x\n", hr ); hr = IDirectInputDevice8_GetProperty( device, DIPROP_KEYNAME, &prop_string.diph ); - todo_wine_if( version < 0x0800 ) ok( hr == (version < 0x0800 ? DIERR_UNSUPPORTED : DIERR_INVALIDPARAM), "GetProperty DIPROP_KEYNAME returned %#x\n", hr ); hr = IDirectInputDevice8_GetProperty( device, DIPROP_LOGICALRANGE, &prop_range.diph ); @@ -4374,7 +4370,6 @@ static void test_simple_joystick( DWORD version ) prop_string.diph.dwHow = DIPH_BYUSAGE; prop_string.diph.dwObj = MAKELONG( HID_USAGE_GENERIC_X, HID_USAGE_PAGE_GENERIC ); hr = IDirectInputDevice8_GetProperty( device, DIPROP_KEYNAME, &prop_string.diph ); - todo_wine_if( version < 0x0800 ) ok( hr == (version < 0x0800 ? DIERR_UNSUPPORTED : DI_OK), "GetProperty DIPROP_KEYNAME returned %#x\n", hr ); if (hr == DI_OK) @@ -4413,7 +4408,6 @@ static void test_simple_joystick( DWORD version ) ok( prop_range.lMin == 0, "got %d expected %d\n", prop_range.lMin, 0 ); ok( prop_range.lMax == 65535, "got %d expected %d\n", prop_range.lMax, 65535 ); hr = IDirectInputDevice8_GetProperty( device, DIPROP_LOGICALRANGE, &prop_range.diph ); - todo_wine_if( version < 0x0800 ) ok( hr == (version < 0x0800 ? DIERR_UNSUPPORTED : DI_OK), "GetProperty DIPROP_LOGICALRANGE returned %#x\n", hr ); if (hr == DI_OK) @@ -4422,7 +4416,6 @@ static void test_simple_joystick( DWORD version ) ok( prop_range.lMax == 56, "got %d expected %d\n", prop_range.lMax, 56 ); } hr = IDirectInputDevice8_GetProperty( device, DIPROP_PHYSICALRANGE, &prop_range.diph ); - todo_wine_if( version < 0x0800 ) ok( hr == (version < 0x0800 ? DIERR_UNSUPPORTED : DI_OK), "GetProperty DIPROP_PHYSICALRANGE returned %#x\n", hr ); if (hr == DI_OK) @@ -5002,11 +4995,9 @@ static void test_simple_joystick( DWORD version ) hr = IDirectInputDevice8_SetProperty( device, DIPROP_RANGE, &prop_range.diph ); ok( hr == DI_OK, "SetProperty DIPROP_RANGE returned %#x\n", hr ); hr = IDirectInputDevice8_SetProperty( device, DIPROP_LOGICALRANGE, &prop_range.diph ); - todo_wine_if( version < 0x0800 ) ok( hr == (version < 0x0800 ? DIERR_UNSUPPORTED : DIERR_ACQUIRED), "SetProperty DIPROP_LOGICALRANGE returned %#x\n", hr ); hr = IDirectInputDevice8_SetProperty( device, DIPROP_PHYSICALRANGE, &prop_range.diph ); - todo_wine_if( version < 0x0800 ) ok( hr == (version < 0x0800 ? DIERR_UNSUPPORTED : DIERR_ACQUIRED), "SetProperty DIPROP_PHYSICALRANGE returned %#x\n", hr );
@@ -5061,7 +5052,6 @@ static void test_simple_joystick( DWORD version ) hr = IDirectInputDevice8_SetProperty( device, DIPROP_VIDPID, NULL ); ok( hr == DIERR_INVALIDPARAM, "SetProperty returned %#x\n", hr ); hr = IDirectInputDevice8_SetProperty( device, DIPROP_VIDPID, &prop_string.diph ); - todo_wine_if( version < 0x0800 ) ok( hr == (version < 0x0800 ? DIERR_UNSUPPORTED : DIERR_INVALIDPARAM), "SetProperty DIPROP_VIDPID returned %#x\n", hr );
@@ -5069,7 +5059,6 @@ static void test_simple_joystick( DWORD version ) prop_dword.diph.dwObj = 0; prop_dword.dwData = 0xdeadbeef; hr = IDirectInputDevice8_SetProperty( device, DIPROP_VIDPID, &prop_dword.diph ); - todo_wine_if( version < 0x0800 ) ok( hr == (version < 0x0800 ? DIERR_UNSUPPORTED : DIERR_READONLY), "SetProperty DIPROP_VIDPID returned %#x\n", hr ); hr = IDirectInputDevice8_SetProperty( device, DIPROP_GUIDANDPATH, &prop_guid_path.diph ); @@ -5092,11 +5081,9 @@ static void test_simple_joystick( DWORD version ) debugstr_w(prop_string.wsz) );
hr = IDirectInputDevice8_SetProperty( device, DIPROP_TYPENAME, &prop_string.diph ); - todo_wine_if( version < 0x0800 ) ok( hr == (version < 0x0800 ? DIERR_UNSUPPORTED : DIERR_READONLY), "SetProperty DIPROP_TYPENAME returned %#x\n", hr ); hr = IDirectInputDevice8_SetProperty( device, DIPROP_USERNAME, &prop_string.diph ); - todo_wine_if( version < 0x0800 ) ok( hr == (version < 0x0800 ? DIERR_UNSUPPORTED : DIERR_READONLY), "SetProperty DIPROP_USERNAME returned %#x\n", hr ); hr = IDirectInputDevice8_SetProperty( device, DIPROP_FFLOAD, &prop_dword.diph ); @@ -5116,7 +5103,7 @@ static void test_simple_joystick( DWORD version ) prop_pointer.diph.dwHow = DIPH_BYUSAGE; prop_pointer.diph.dwObj = MAKELONG( HID_USAGE_GENERIC_X, HID_USAGE_PAGE_GENERIC ); hr = IDirectInputDevice8_SetProperty( device, DIPROP_APPDATA, &prop_pointer.diph ); - todo_wine + todo_wine_if( version >= 0x0800 ) ok( hr == (version < 0x0800 ? DIERR_UNSUPPORTED : DIERR_ACQUIRED), "SetProperty DIPROP_APPDATA returned %#x\n", hr );
@@ -5270,7 +5257,6 @@ static void test_simple_joystick( DWORD version ) prop_pointer.diph.dwObj = MAKELONG( HID_USAGE_GENERIC_X, HID_USAGE_PAGE_GENERIC ); prop_pointer.uData = 0xfeedcafe; hr = IDirectInputDevice8_SetProperty( device, DIPROP_APPDATA, &prop_pointer.diph ); - todo_wine_if( version < 0x0800 ) ok( hr == (version < 0x0800 ? DIERR_UNSUPPORTED : DI_OK), "SetProperty DIPROP_APPDATA returned %#x\n", hr );