dinput: Don't report SysMouse/Keyboard devices as supporting Force Feedback.

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alistair Leslie-Hughes 2019-04-26 01:09:56 +00:00 committed by Alexandre Julliard
parent ec8bc65b30
commit b3c5062f36
3 changed files with 55 additions and 0 deletions

View File

@ -215,6 +215,9 @@ static HRESULT keyboarddev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVI
if (id != 0) if (id != 0)
return E_FAIL; return E_FAIL;
if (dwFlags & DIEDFL_FORCEFEEDBACK)
return S_FALSE;
if ((dwDevType == 0) || if ((dwDevType == 0) ||
((dwDevType == DIDEVTYPE_KEYBOARD) && (version < 0x0800)) || ((dwDevType == DIDEVTYPE_KEYBOARD) && (version < 0x0800)) ||
(((dwDevType == DI8DEVCLASS_KEYBOARD) || (dwDevType == DI8DEVTYPE_KEYBOARD)) && (version >= 0x0800))) { (((dwDevType == DI8DEVCLASS_KEYBOARD) || (dwDevType == DI8DEVTYPE_KEYBOARD)) && (version >= 0x0800))) {
@ -233,6 +236,9 @@ static HRESULT keyboarddev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVI
if (id != 0) if (id != 0)
return E_FAIL; return E_FAIL;
if (dwFlags & DIEDFL_FORCEFEEDBACK)
return S_FALSE;
if ((dwDevType == 0) || if ((dwDevType == 0) ||
((dwDevType == DIDEVTYPE_KEYBOARD) && (version < 0x0800)) || ((dwDevType == DIDEVTYPE_KEYBOARD) && (version < 0x0800)) ||
(((dwDevType == DI8DEVCLASS_KEYBOARD) || (dwDevType == DI8DEVTYPE_KEYBOARD)) && (version >= 0x0800))) { (((dwDevType == DI8DEVCLASS_KEYBOARD) || (dwDevType == DI8DEVTYPE_KEYBOARD)) && (version >= 0x0800))) {

View File

@ -158,6 +158,9 @@ static HRESULT mousedev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEI
if (id != 0) if (id != 0)
return E_FAIL; return E_FAIL;
if (dwFlags & DIEDFL_FORCEFEEDBACK)
return S_FALSE;
if ((dwDevType == 0) || if ((dwDevType == 0) ||
((dwDevType == DIDEVTYPE_MOUSE) && (version < 0x0800)) || ((dwDevType == DIDEVTYPE_MOUSE) && (version < 0x0800)) ||
(((dwDevType == DI8DEVCLASS_POINTER) || (dwDevType == DI8DEVTYPE_MOUSE)) && (version >= 0x0800))) { (((dwDevType == DI8DEVCLASS_POINTER) || (dwDevType == DI8DEVTYPE_MOUSE)) && (version >= 0x0800))) {
@ -176,6 +179,9 @@ static HRESULT mousedev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEI
if (id != 0) if (id != 0)
return E_FAIL; return E_FAIL;
if (dwFlags & DIEDFL_FORCEFEEDBACK)
return S_FALSE;
if ((dwDevType == 0) || if ((dwDevType == 0) ||
((dwDevType == DIDEVTYPE_MOUSE) && (version < 0x0800)) || ((dwDevType == DIDEVTYPE_MOUSE) && (version < 0x0800)) ||
(((dwDevType == DI8DEVCLASS_POINTER) || (dwDevType == DI8DEVTYPE_MOUSE)) && (version >= 0x0800))) { (((dwDevType == DI8DEVCLASS_POINTER) || (dwDevType == DI8DEVTYPE_MOUSE)) && (version >= 0x0800))) {

View File

@ -270,6 +270,29 @@ static const HRESULT SetCoop_real_window[16] = {
E_INVALIDARG, S_OK, S_OK, E_INVALIDARG, E_INVALIDARG, S_OK, S_OK, E_INVALIDARG,
E_INVALIDARG, E_INVALIDARG, E_INVALIDARG, E_INVALIDARG}; E_INVALIDARG, E_INVALIDARG, E_INVALIDARG, E_INVALIDARG};
static BOOL CALLBACK EnumAllFeedback(const DIDEVICEINSTANCEA *lpddi, void *pvRef)
{
trace("---- Device Information ----\n"
"Product Name : %s\n"
"Instance Name : %s\n"
"devType : 0x%08x\n"
"GUID Product : %s\n"
"GUID Instance : %s\n"
"HID Page : 0x%04x\n"
"HID Usage : 0x%04x\n",
lpddi->tszProductName,
lpddi->tszInstanceName,
lpddi->dwDevType,
wine_dbgstr_guid(&lpddi->guidProduct),
wine_dbgstr_guid(&lpddi->guidInstance),
lpddi->wUsagePage,
lpddi->wUsage);
ok(!(IsEqualGUID(&GUID_SysMouse, &lpddi->guidProduct) || IsEqualGUID(&GUID_SysKeyboard, &lpddi->guidProduct)), "Invalid device returned.\n");
return DIENUM_CONTINUE;
}
static BOOL CALLBACK EnumJoysticks(const DIDEVICEINSTANCEA *lpddi, void *pvRef) static BOOL CALLBACK EnumJoysticks(const DIDEVICEINSTANCEA *lpddi, void *pvRef)
{ {
HRESULT hr; HRESULT hr;
@ -870,6 +893,24 @@ static void joystick_tests(DWORD version)
trace(" Version Not Supported\n"); trace(" Version Not Supported\n");
} }
static void test_enum_feedback(void)
{
HRESULT hr;
IDirectInputA *pDI;
ULONG ref;
HINSTANCE hInstance = GetModuleHandleW(NULL);
hr = DirectInputCreateA(hInstance, 0x0700, &pDI, NULL);
ok(hr==DI_OK||hr==DIERR_OLDDIRECTINPUTVERSION, "DirectInputCreateA() failed: %08x\n", hr);
if (hr==DI_OK && pDI!=0) {
hr = IDirectInput_EnumDevices(pDI, 0, EnumAllFeedback, NULL, DIEDFL_ATTACHEDONLY | DIEDFL_FORCEFEEDBACK);
ok(hr==DI_OK,"IDirectInput_EnumDevices() failed: %08x\n", hr);
ref = IDirectInput_Release(pDI);
ok(ref==0,"IDirectInput_Release() reference count = %d\n", ref);
} else if (hr==DIERR_OLDDIRECTINPUTVERSION)
trace(" Version Not Supported\n");
}
START_TEST(joystick) START_TEST(joystick)
{ {
CoInitialize(NULL); CoInitialize(NULL);
@ -878,5 +919,7 @@ START_TEST(joystick)
joystick_tests(0x0500); joystick_tests(0x0500);
joystick_tests(0x0300); joystick_tests(0x0300);
test_enum_feedback();
CoUninitialize(); CoUninitialize();
} }