Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/device.c | 13 +++++++++++++ dlls/dinput/tests/joystick8.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/dinput/tests/joystick8.c b/dlls/dinput/tests/joystick8.c index bb83c8a0c93..492db1dfc9b 100644 --- a/dlls/dinput/tests/joystick8.c +++ b/dlls/dinput/tests/joystick8.c @@ -870,7 +870,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; @@ -880,7 +879,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) @@ -925,7 +923,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) @@ -972,7 +969,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 ); @@ -1003,7 +999,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) @@ -1042,7 +1037,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) @@ -1051,7 +1045,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) @@ -1622,11 +1615,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 );
@@ -1681,7 +1672,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 );
@@ -1689,7 +1679,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 ); @@ -1712,11 +1701,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 ); @@ -1736,7 +1723,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 );
@@ -1891,7 +1878,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 );