From eabf3955a82727f26c762c0ccf25c3737ed361e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9=20van=20Geldorp?= Date: Tue, 11 Jan 2005 23:11:18 +0000 Subject: [PATCH] Sync to Wine-20050111: Michael Stefaniuc - Do not check for non NULL pointer before HeapFree'ing it. It's redundant. Christian Costa - Handle device class in DX8 enumeration (found by Robert Reif). - Fixed remaining DX8 device types. - Factorized a bit GetCapabilities for keyboard and mouse. - Fixed enumeration of joysticks in DX8. - Fixed some traces. Francois Gouget - Assorted spelling fixes. Neil Olver - The flag for a mouse button down in the structure returned by GetDeviceState should be 0x80 (only the high bit set), not 0xff. svn path=/trunk/; revision=12937 --- reactos/lib/dinput/dinput_main.c | 4 +- reactos/lib/dinput/joystick_linux.c | 59 +++++++++------------ reactos/lib/dinput/joystick_linuxinput.c | 25 ++++++--- reactos/lib/dinput/keyboard.c | 55 ++++++++++---------- reactos/lib/dinput/mouse.c | 65 +++++++++++------------- 5 files changed, 100 insertions(+), 108 deletions(-) diff --git a/reactos/lib/dinput/dinput_main.c b/reactos/lib/dinput/dinput_main.c index 3bfcba05e70..900b7c820a3 100644 --- a/reactos/lib/dinput/dinput_main.c +++ b/reactos/lib/dinput/dinput_main.c @@ -744,13 +744,13 @@ HRESULT WINAPI DINPUT_DllCanUnloadNow(void) HRESULT WINAPI DINPUT_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) { - TRACE("(%p,%p,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv); + TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv); if ( IsEqualCLSID( &IID_IClassFactory, riid ) ) { *ppv = (LPVOID)&DINPUT_CF; IClassFactory_AddRef((IClassFactory*)*ppv); return S_OK; } - FIXME("(%p,%p,%p): no interface found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv); + FIXME("(%s,%s,%p): no interface found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv); return CLASS_E_CLASSNOTAVAILABLE; } diff --git a/reactos/lib/dinput/joystick_linux.c b/reactos/lib/dinput/joystick_linux.c index 8b75fb06288..101d900e953 100644 --- a/reactos/lib/dinput/joystick_linux.c +++ b/reactos/lib/dinput/joystick_linux.c @@ -157,7 +157,9 @@ static BOOL joydev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTAN return FALSE; } - if ((dwDevType==0) || (GET_DIDEVICE_TYPE(dwDevType)==DIDEVTYPE_JOYSTICK)) { + if ((dwDevType == 0) || + ((dwDevType == DIDEVTYPE_JOYSTICK) && (version < 8)) || + (((dwDevType == DI8DEVCLASS_GAMECTRL) || (dwDevType == DI8DEVTYPE_JOYSTICK)) && (version >= 8))) { /* check whether we have a joystick */ sprintf(dev, "%s%d", JOYDEV, id); if ((fd = open(dev,O_RDONLY)) < 0) { @@ -205,7 +207,9 @@ static BOOL joydev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTAN return FALSE; } - if ((dwDevType==0) || (GET_DIDEVICE_TYPE(dwDevType)==DIDEVTYPE_JOYSTICK)) { + if ((dwDevType == 0) || + ((dwDevType == DIDEVTYPE_JOYSTICK) && (version < 8)) || + (((dwDevType == DI8DEVCLASS_GAMECTRL) || (dwDevType == DI8DEVTYPE_JOYSTICK)) && (version >= 8))) { /* check whether we have a joystick */ sprintf(dev, "%s%d", JOYDEV, id); if ((fd = open(dev,O_RDONLY)) < 0) { @@ -552,7 +556,10 @@ static HRESULT alloc_device(REFGUID rguid, LPVOID jvt, IDirectInputImpl *dinput, newDevice->devcaps.dwSize = sizeof(newDevice->devcaps); newDevice->devcaps.dwFlags = DIDC_ATTACHED; - newDevice->devcaps.dwDevType = DIDEVTYPE_JOYSTICK; + if (newDevice->dinput->version >= 8) + newDevice->devcaps.dwDevType = DI8DEVTYPE_JOYSTICK | (DI8DEVTYPEJOYSTICK_STANDARD << 8); + else + newDevice->devcaps.dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_TRADITIONAL << 8); newDevice->devcaps.dwFFSamplePeriod = 0; newDevice->devcaps.dwFFMinTimeResolution = 0; newDevice->devcaps.dwFirmwareRevision = 0; @@ -573,18 +580,12 @@ static HRESULT alloc_device(REFGUID rguid, LPVOID jvt, IDirectInputImpl *dinput, FAILED: hr = DIERR_OUTOFMEMORY; FAILED1: - if (newDevice->axis_map) - HeapFree(GetProcessHeap(),0,newDevice->axis_map); - if (newDevice->name) - HeapFree(GetProcessHeap(),0,newDevice->name); - if (newDevice->props) - HeapFree(GetProcessHeap(),0,newDevice->props); - if (newDevice->user_df->rgodf) - HeapFree(GetProcessHeap(),0,newDevice->user_df->rgodf); - if (newDevice->user_df) - HeapFree(GetProcessHeap(),0,newDevice->user_df); - if (newDevice) - HeapFree(GetProcessHeap(),0,newDevice); + HeapFree(GetProcessHeap(),0,newDevice->axis_map); + HeapFree(GetProcessHeap(),0,newDevice->name); + HeapFree(GetProcessHeap(),0,newDevice->props); + HeapFree(GetProcessHeap(),0,newDevice->user_df->rgodf); + HeapFree(GetProcessHeap(),0,newDevice->user_df); + HeapFree(GetProcessHeap(),0,newDevice); *pdev = 0; return hr; @@ -671,16 +672,13 @@ static ULONG WINAPI JoystickAImpl_Release(LPDIRECTINPUTDEVICE8A iface) return ref; /* Free the device name */ - if (This->name) - HeapFree(GetProcessHeap(),0,This->name); + HeapFree(GetProcessHeap(),0,This->name); /* Free the axis map */ - if (This->axis_map) - HeapFree(GetProcessHeap(),0,This->axis_map); + HeapFree(GetProcessHeap(),0,This->axis_map); /* Free the data queue */ - if (This->data_queue != NULL) - HeapFree(GetProcessHeap(),0,This->data_queue); + HeapFree(GetProcessHeap(),0,This->data_queue); /* Free the DataFormat */ HeapFree(GetProcessHeap(), 0, This->user_df->rgodf); @@ -764,12 +762,9 @@ static HRESULT WINAPI JoystickAImpl_SetDataFormat( FAILED: WARN("out of memory\n"); - if (new_props) - HeapFree(GetProcessHeap(),0,new_props); - if (new_rgodf) - HeapFree(GetProcessHeap(),0,new_rgodf); - if (new_df) - HeapFree(GetProcessHeap(),0,new_df); + HeapFree(GetProcessHeap(),0,new_props); + HeapFree(GetProcessHeap(),0,new_rgodf); + HeapFree(GetProcessHeap(),0,new_df); return DIERR_OUTOFMEMORY; } @@ -1580,10 +1575,7 @@ HRESULT WINAPI JoystickAImpl_GetDeviceInfo( pdidi->guidInstance = GUID_Joystick; pdidi->guidProduct = DInput_Wine_Joystick_GUID; /* we only support traditional joysticks for now */ - if (This->dinput->version >= 8) - pdidi->dwDevType = DI8DEVTYPE_JOYSTICK | (DI8DEVTYPEJOYSTICK_STANDARD << 8); - else - pdidi->dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_TRADITIONAL << 8); + pdidi->dwDevType = This->devcaps.dwDevType; strcpy(pdidi->tszInstanceName, "Joystick"); strcpy(pdidi->tszProductName, This->name); if (pdidi->dwSize > sizeof(DIDEVICEINSTANCE_DX3A)) { @@ -1618,10 +1610,7 @@ HRESULT WINAPI JoystickWImpl_GetDeviceInfo( pdidi->guidInstance = GUID_Joystick; pdidi->guidProduct = DInput_Wine_Joystick_GUID; /* we only support traditional joysticks for now */ - if (This->dinput->version >= 8) - pdidi->dwDevType = DI8DEVTYPE_JOYSTICK | (DI8DEVTYPEJOYSTICK_STANDARD << 8); - else - pdidi->dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_TRADITIONAL << 8); + pdidi->dwDevType = This->devcaps.dwDevType; MultiByteToWideChar(CP_ACP, 0, "Joystick", -1, pdidi->tszInstanceName, MAX_PATH); MultiByteToWideChar(CP_ACP, 0, This->name, -1, pdidi->tszProductName, MAX_PATH); if (pdidi->dwSize > sizeof(DIDEVICEINSTANCE_DX3W)) { diff --git a/reactos/lib/dinput/joystick_linuxinput.c b/reactos/lib/dinput/joystick_linuxinput.c index 514715b578b..673cc3852fc 100644 --- a/reactos/lib/dinput/joystick_linuxinput.c +++ b/reactos/lib/dinput/joystick_linuxinput.c @@ -175,8 +175,10 @@ static BOOL joydev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTAN if (id != 0) return FALSE; - if ((dwDevType != 0) && (GET_DIDEVICE_TYPE(dwDevType) != DIDEVTYPE_JOYSTICK)) - return FALSE; + if (!((dwDevType == 0) || + ((dwDevType == DIDEVTYPE_JOYSTICK) && (version < 8)) || + (((dwDevType == DI8DEVCLASS_GAMECTRL) || (dwDevType == DI8DEVTYPE_JOYSTICK)) && (version >= 8)))) + return FALSE; if (dwFlags & DIEDFL_FORCEFEEDBACK) return FALSE; @@ -211,8 +213,10 @@ static BOOL joydev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTAN if (id != 0) return FALSE; - if ((dwDevType != 0) && (GET_DIDEVICE_TYPE(dwDevType) != DIDEVTYPE_JOYSTICK)) - return FALSE; + if (!((dwDevType == 0) || + ((dwDevType == DIDEVTYPE_JOYSTICK) && (version < 8)) || + (((dwDevType == DI8DEVCLASS_GAMECTRL) || (dwDevType == DI8DEVTYPE_JOYSTICK)) && (version >= 8)))) + return FALSE; if (dwFlags & DIEDFL_FORCEFEEDBACK) return FALSE; @@ -229,7 +233,10 @@ static BOOL joydev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTAN lpddi->guidProduct = DInput_Wine_Joystick_GUID; lpddi->guidFFDriver = GUID_NULL; - lpddi->dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_TRADITIONAL<<8); + if (version >= 8) + lpddi->dwDevType = DI8DEVTYPE_JOYSTICK | (DI8DEVTYPEJOYSTICK_STANDARD << 8); + else + lpddi->dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_TRADITIONAL << 8); MultiByteToWideChar(CP_ACP, 0, "Joystick", -1, lpddi->tszInstanceName, MAX_PATH); /* ioctl JSIOCGNAME(len) */ @@ -339,8 +346,7 @@ static ULONG WINAPI JoystickAImpl_Release(LPDIRECTINPUTDEVICE8A iface) return ref; /* Free the data queue */ - if (This->data_queue != NULL) - HeapFree(GetProcessHeap(),0,This->data_queue); + HeapFree(GetProcessHeap(),0,This->data_queue); /* Free the DataFormat */ HeapFree(GetProcessHeap(), 0, This->df); @@ -756,7 +762,10 @@ static HRESULT WINAPI JoystickAImpl_GetCapabilities( wasacquired = 0; } lpDIDevCaps->dwFlags = DIDC_ATTACHED; - lpDIDevCaps->dwDevType = DIDEVTYPE_JOYSTICK; + if (This->dinput->version >= 8) + lpDIDevCaps->dwDevType = DI8DEVTYPE_JOYSTICK | (DI8DEVTYPEJOYSTICK_STANDARD << 8); + else + lpDIDevCaps->dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_TRADITIONAL << 8); axes=0; for (i=0;iabsbits,i)) axes++; diff --git a/reactos/lib/dinput/keyboard.c b/reactos/lib/dinput/keyboard.c index 7110679d172..41630d0e8dc 100644 --- a/reactos/lib/dinput/keyboard.c +++ b/reactos/lib/dinput/keyboard.c @@ -266,7 +266,7 @@ static BOOL keyboarddev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEI if ((dwDevType == 0) || ((dwDevType == DIDEVTYPE_KEYBOARD) && (version < 8)) || - ((dwDevType == DI8DEVTYPE_KEYBOARD) && (version >= 8))) { + (((dwDevType == DI8DEVCLASS_KEYBOARD) || (dwDevType == DI8DEVTYPE_KEYBOARD)) && (version >= 8))) { TRACE("Enumerating the Keyboard device\n"); fill_keyboard_dideviceinstanceA(lpddi, version); @@ -284,7 +284,7 @@ static BOOL keyboarddev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEI if ((dwDevType == 0) || ((dwDevType == DIDEVTYPE_KEYBOARD) && (version < 8)) || - ((dwDevType == DI8DEVTYPE_KEYBOARD) && (version >= 8))) { + (((dwDevType == DI8DEVCLASS_KEYBOARD) || (dwDevType == DI8DEVTYPE_KEYBOARD)) && (version >= 8))) { TRACE("Enumerating the Keyboard device\n"); fill_keyboard_dideviceinstanceW(lpddi, version); @@ -387,8 +387,7 @@ static ULONG WINAPI SysKeyboardAImpl_Release(LPDIRECTINPUTDEVICE8A iface) #endif /* Free the data queue */ - if (This->buffer != NULL) - HeapFree(GetProcessHeap(),0,This->buffer); + HeapFree(GetProcessHeap(),0,This->buffer); DeleteCriticalSection(&(This->crit)); @@ -649,36 +648,34 @@ static HRESULT WINAPI SysKeyboardAImpl_GetCapabilities( LPDIRECTINPUTDEVICE8A iface, LPDIDEVCAPS lpDIDevCaps) { - SysKeyboardImpl *This = (SysKeyboardImpl *)iface; + SysKeyboardImpl *This = (SysKeyboardImpl *)iface; + DIDEVCAPS devcaps; - TRACE("(this=%p,%p)\n",This,lpDIDevCaps); + TRACE("(this=%p,%p)\n",This,lpDIDevCaps); - if (lpDIDevCaps->dwSize == sizeof(DIDEVCAPS)) { - lpDIDevCaps->dwFlags = DIDC_ATTACHED; + if ((lpDIDevCaps->dwSize != sizeof(DIDEVCAPS)) && (lpDIDevCaps->dwSize != sizeof(DIDEVCAPS_DX3))) { + WARN("invalid parameter\n"); + return DIERR_INVALIDPARAM; + } + + devcaps.dwSize = lpDIDevCaps->dwSize; + devcaps.dwFlags = DIDC_ATTACHED; if (This->dinput->version >= 8) - lpDIDevCaps->dwDevType = DI8DEVTYPE_KEYBOARD | (DI8DEVTYPEKEYBOARD_UNKNOWN << 8); + devcaps.dwDevType = DI8DEVTYPE_KEYBOARD | (DI8DEVTYPEKEYBOARD_UNKNOWN << 8); else - lpDIDevCaps->dwDevType = DIDEVTYPE_KEYBOARD | (DIDEVTYPEKEYBOARD_UNKNOWN << 8); - lpDIDevCaps->dwAxes = 0; - lpDIDevCaps->dwButtons = 256; - lpDIDevCaps->dwPOVs = 0; - lpDIDevCaps->dwFFSamplePeriod = 0; - lpDIDevCaps->dwFFMinTimeResolution = 0; - lpDIDevCaps->dwFirmwareRevision = 100; - lpDIDevCaps->dwHardwareRevision = 100; - lpDIDevCaps->dwFFDriverVersion = 0; - } else if (lpDIDevCaps->dwSize == sizeof(DIDEVCAPS_DX3)) { - lpDIDevCaps->dwFlags = DIDC_ATTACHED; - lpDIDevCaps->dwDevType = DIDEVTYPE_KEYBOARD | (DIDEVTYPEKEYBOARD_UNKNOWN << 8); - lpDIDevCaps->dwAxes = 0; - lpDIDevCaps->dwButtons = 256; - lpDIDevCaps->dwPOVs = 0; - } else { - WARN("invalid parameter\n"); - return DIERR_INVALIDPARAM; - } + devcaps.dwDevType = DIDEVTYPE_KEYBOARD | (DIDEVTYPEKEYBOARD_UNKNOWN << 8); + devcaps.dwAxes = 0; + devcaps.dwButtons = 256; + devcaps.dwPOVs = 0; + devcaps.dwFFSamplePeriod = 0; + devcaps.dwFFMinTimeResolution = 0; + devcaps.dwFirmwareRevision = 100; + devcaps.dwHardwareRevision = 100; + devcaps.dwFFDriverVersion = 0; - return DI_OK; + memcpy(lpDIDevCaps, &devcaps, lpDIDevCaps->dwSize); + + return DI_OK; } /****************************************************************************** diff --git a/reactos/lib/dinput/mouse.c b/reactos/lib/dinput/mouse.c index e0602f0a77a..96e849bf186 100644 --- a/reactos/lib/dinput/mouse.c +++ b/reactos/lib/dinput/mouse.c @@ -220,7 +220,7 @@ static BOOL mousedev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINST if ((dwDevType == 0) || ((dwDevType == DIDEVTYPE_MOUSE) && (version < 8)) || - ((dwDevType == DI8DEVTYPE_MOUSE) && (version >= 8))) { + (((dwDevType == DI8DEVCLASS_POINTER) || (dwDevType == DI8DEVTYPE_MOUSE)) && (version >= 8))) { TRACE("Enumerating the mouse device\n"); fill_mouse_dideviceinstanceA(lpddi, version); @@ -238,7 +238,7 @@ static BOOL mousedev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINST if ((dwDevType == 0) || ((dwDevType == DIDEVTYPE_MOUSE) && (version < 8)) || - ((dwDevType == DI8DEVTYPE_MOUSE) && (version >= 8))) { + (((dwDevType == DI8DEVCLASS_POINTER) || (dwDevType == DI8DEVTYPE_MOUSE)) && (version >= 8))) { TRACE("Enumerating the mouse device\n"); fill_mouse_dideviceinstanceW(lpddi, version); @@ -351,8 +351,7 @@ static ULONG WINAPI SysMouseAImpl_Release(LPDIRECTINPUTDEVICE8A iface) return ref; /* Free the data queue */ - if (This->data_queue != NULL) - HeapFree(GetProcessHeap(),0,This->data_queue); + HeapFree(GetProcessHeap(),0,This->data_queue); #ifndef __REACTOS__ if (This->hook) { @@ -458,7 +457,7 @@ static LRESULT CALLBACK dinput_mouse_hook( int code, WPARAM wparam, LPARAM lpara /* Only allow mouse events every 10 ms. * This is to allow the cursor to start acceleration before * the warps happen. But if it involves a mouse button event we - * allow it since we don't want to loose the clicks. + * allow it since we don't want to lose the clicks. */ if (((GetCurrentTime() - last_event) < 10) && wparam == WM_MOUSEMOVE) @@ -527,9 +526,9 @@ static LRESULT CALLBACK dinput_mouse_hook( int code, WPARAM wparam, LPARAM lpara switch(wparam) { case WM_LBUTTONDOWN: - GEN_EVENT(This->offset_array[WINE_MOUSE_L_POSITION], 0xFF, + GEN_EVENT(This->offset_array[WINE_MOUSE_L_POSITION], 0x80, hook->time, This->dinput->evsequence++); - This->m_state.rgbButtons[0] = 0xFF; + This->m_state.rgbButtons[0] = 0x80; break; case WM_LBUTTONUP: GEN_EVENT(This->offset_array[WINE_MOUSE_L_POSITION], 0x00, @@ -537,9 +536,9 @@ static LRESULT CALLBACK dinput_mouse_hook( int code, WPARAM wparam, LPARAM lpara This->m_state.rgbButtons[0] = 0x00; break; case WM_RBUTTONDOWN: - GEN_EVENT(This->offset_array[WINE_MOUSE_R_POSITION], 0xFF, + GEN_EVENT(This->offset_array[WINE_MOUSE_R_POSITION], 0x80, hook->time, This->dinput->evsequence++); - This->m_state.rgbButtons[1] = 0xFF; + This->m_state.rgbButtons[1] = 0x80; break; case WM_RBUTTONUP: GEN_EVENT(This->offset_array[WINE_MOUSE_R_POSITION], 0x00, @@ -547,9 +546,9 @@ static LRESULT CALLBACK dinput_mouse_hook( int code, WPARAM wparam, LPARAM lpara This->m_state.rgbButtons[1] = 0x00; break; case WM_MBUTTONDOWN: - GEN_EVENT(This->offset_array[WINE_MOUSE_M_POSITION], 0xFF, + GEN_EVENT(This->offset_array[WINE_MOUSE_M_POSITION], 0x80, hook->time, This->dinput->evsequence++); - This->m_state.rgbButtons[2] = 0xFF; + This->m_state.rgbButtons[2] = 0x80; break; case WM_MBUTTONUP: GEN_EVENT(This->offset_array[WINE_MOUSE_M_POSITION], 0x00, @@ -1115,33 +1114,31 @@ static HRESULT WINAPI SysMouseAImpl_GetCapabilities( LPDIDEVCAPS lpDIDevCaps) { SysMouseImpl *This = (SysMouseImpl *)iface; - + DIDEVCAPS devcaps; + TRACE("(this=%p,%p)\n",This,lpDIDevCaps); - - if (lpDIDevCaps->dwSize == sizeof(DIDEVCAPS)) { - lpDIDevCaps->dwFlags = DIDC_ATTACHED; - if (This->dinput->version >= 8) - lpDIDevCaps->dwDevType = DI8DEVTYPE_MOUSE | (DI8DEVTYPEMOUSE_TRADITIONAL << 8); - else - lpDIDevCaps->dwDevType = DIDEVTYPE_MOUSE | (DIDEVTYPEMOUSE_TRADITIONAL << 8); - lpDIDevCaps->dwAxes = 3; - lpDIDevCaps->dwButtons = 3; - lpDIDevCaps->dwPOVs = 0; - lpDIDevCaps->dwFFSamplePeriod = 0; - lpDIDevCaps->dwFFMinTimeResolution = 0; - lpDIDevCaps->dwFirmwareRevision = 100; - lpDIDevCaps->dwHardwareRevision = 100; - lpDIDevCaps->dwFFDriverVersion = 0; - } else if (lpDIDevCaps->dwSize == sizeof(DIDEVCAPS_DX3)) { - lpDIDevCaps->dwFlags = DIDC_ATTACHED; - lpDIDevCaps->dwDevType = DIDEVTYPE_MOUSE | (DIDEVTYPEMOUSE_TRADITIONAL << 8); - lpDIDevCaps->dwAxes = 3; - lpDIDevCaps->dwButtons = 3; - lpDIDevCaps->dwPOVs = 0; - } else { + + if ((lpDIDevCaps->dwSize != sizeof(DIDEVCAPS)) && (lpDIDevCaps->dwSize != sizeof(DIDEVCAPS_DX3))) { WARN("invalid parameter\n"); return DIERR_INVALIDPARAM; } + + devcaps.dwSize = lpDIDevCaps->dwSize; + devcaps.dwFlags = DIDC_ATTACHED; + if (This->dinput->version >= 8) + devcaps.dwDevType = DI8DEVTYPE_MOUSE | (DI8DEVTYPEMOUSE_TRADITIONAL << 8); + else + devcaps.dwDevType = DIDEVTYPE_MOUSE | (DIDEVTYPEMOUSE_TRADITIONAL << 8); + devcaps.dwAxes = 3; + devcaps.dwButtons = 3; + devcaps.dwPOVs = 0; + devcaps.dwFFSamplePeriod = 0; + devcaps.dwFFMinTimeResolution = 0; + devcaps.dwFirmwareRevision = 100; + devcaps.dwHardwareRevision = 100; + devcaps.dwFFDriverVersion = 0; + + memcpy(lpDIDevCaps, &devcaps, lpDIDevCaps->dwSize); return DI_OK; }