Re: [DINPUT] Some more dinput stuff

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Le Lundi 09 Juin 2003 15:38, Christian Costa a écrit :
> Hi,
>
> This patch makes dinput8 behaviour more correct for mouse and keyboard.
> Now, controls work in the Incoming Forces demo.
> I suppose the game is playable. I didn't play too much since it's slow
> with my P2-400 / TNT2.

good news ;)

> At the very least, this will give some material for Raphael and Jason.

well now we have to look it ;))

> Bye,
> Christian
>
> Changelog :
> Make dinput8 behaviour more correct for mouse and keyboard.
> Fix small bug when keyboard buffer overflows.
> Use DI_OK instead of 0 for returned values.

As your patch is a little malformed and conflicts with mine (a big one)
i send my patch merged with yours, can you look if all is correct.

Changelog addin:
- - DInput WideChar classes support try 2: with this unreal tournament 2003 is 
playable and unreal2 can launch. This time all dinput versions have widechar 
classes.

Sorry about this huge patch Alexandre :(

Regards,
Raphael
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE+5MXMp7NA3AmQTU4RAgQAAJ9f1/EDWNZ0AAE1yM94uCV+93lxtgCfSJNR
OYyJXFmkp9Hp9pSGT962cQg=
=S9OR
-----END PGP SIGNATURE-----
Index: include/dinput.h
===================================================================
RCS file: /home/wine/wine/include/dinput.h,v
retrieving revision 1.34
diff -u -r1.34 dinput.h
--- include/dinput.h	11 Apr 2003 00:31:04 -0000	1.34
+++ include/dinput.h	9 Jun 2003 17:29:28 -0000
@@ -191,6 +191,25 @@
 #define DIDEVTYPE_JOYSTICK              4
 #define DIDEVTYPE_HID                   0x00010000
 
+#define DI8DEVCLASS_ALL             0
+#define DI8DEVCLASS_DEVICE          1
+#define DI8DEVCLASS_POINTER         2
+#define DI8DEVCLASS_KEYBOARD        3
+#define DI8DEVCLASS_GAMECTRL        4
+
+#define DI8DEVTYPE_DEVICE           0x11
+#define DI8DEVTYPE_MOUSE            0x12
+#define DI8DEVTYPE_KEYBOARD         0x13
+#define DI8DEVTYPE_JOYSTICK         0x14
+#define DI8DEVTYPE_GAMEPAD          0x15
+#define DI8DEVTYPE_DRIVING          0x16
+#define DI8DEVTYPE_FLIGHT           0x17
+#define DI8DEVTYPE_1STPERSON        0x18
+#define DI8DEVTYPE_DEVICECTRL       0x19
+#define DI8DEVTYPE_SCREENPOINTER    0x1A
+#define DI8DEVTYPE_REMOTE           0x1B
+#define DI8DEVTYPE_SUPPLEMENTAL     0x1C
+
 #define DIDEVTYPEMOUSE_UNKNOWN          1
 #define DIDEVTYPEMOUSE_TRADITIONAL      2
 #define DIDEVTYPEMOUSE_FINGERSTICK      3
@@ -219,6 +238,76 @@
 #define DIDEVTYPEJOYSTICK_WHEEL         6
 #define DIDEVTYPEJOYSTICK_HEADTRACKER   7
 
+#define DI8DEVTYPEMOUSE_UNKNOWN                     1
+#define DI8DEVTYPEMOUSE_TRADITIONAL                 2
+#define DI8DEVTYPEMOUSE_FINGERSTICK                 3
+#define DI8DEVTYPEMOUSE_TOUCHPAD                    4
+#define DI8DEVTYPEMOUSE_TRACKBALL                   5
+#define DI8DEVTYPEMOUSE_ABSOLUTE                    6
+
+#define DI8DEVTYPEKEYBOARD_UNKNOWN                  0
+#define DI8DEVTYPEKEYBOARD_PCXT                     1
+#define DI8DEVTYPEKEYBOARD_OLIVETTI                 2
+#define DI8DEVTYPEKEYBOARD_PCAT                     3
+#define DI8DEVTYPEKEYBOARD_PCENH                    4
+#define DI8DEVTYPEKEYBOARD_NOKIA1050                5
+#define DI8DEVTYPEKEYBOARD_NOKIA9140                6
+#define DI8DEVTYPEKEYBOARD_NEC98                    7
+#define DI8DEVTYPEKEYBOARD_NEC98LAPTOP              8
+#define DI8DEVTYPEKEYBOARD_NEC98106                 9
+#define DI8DEVTYPEKEYBOARD_JAPAN106                10
+#define DI8DEVTYPEKEYBOARD_JAPANAX                 11
+#define DI8DEVTYPEKEYBOARD_J3100                   12
+
+#define DI8DEVTYPE_LIMITEDGAMESUBTYPE               1
+
+#define DI8DEVTYPEJOYSTICK_LIMITED                  DI8DEVTYPE_LIMITEDGAMESUBTYPE
+#define DI8DEVTYPEJOYSTICK_STANDARD                 2
+
+#define DI8DEVTYPEGAMEPAD_LIMITED                   DI8DEVTYPE_LIMITEDGAMESUBTYPE
+#define DI8DEVTYPEGAMEPAD_STANDARD                  2
+#define DI8DEVTYPEGAMEPAD_TILT                      3
+
+#define DI8DEVTYPEDRIVING_LIMITED                   DI8DEVTYPE_LIMITEDGAMESUBTYPE
+#define DI8DEVTYPEDRIVING_COMBINEDPEDALS            2
+#define DI8DEVTYPEDRIVING_DUALPEDALS                3
+#define DI8DEVTYPEDRIVING_THREEPEDALS               4
+#define DI8DEVTYPEDRIVING_HANDHELD                  5
+
+#define DI8DEVTYPEFLIGHT_LIMITED                    DI8DEVTYPE_LIMITEDGAMESUBTYPE
+#define DI8DEVTYPEFLIGHT_STICK                      2
+#define DI8DEVTYPEFLIGHT_YOKE                       3
+#define DI8DEVTYPEFLIGHT_RC                         4
+
+#define DI8DEVTYPE1STPERSON_LIMITED                 DI8DEVTYPE_LIMITEDGAMESUBTYPE
+#define DI8DEVTYPE1STPERSON_UNKNOWN                 2
+#define DI8DEVTYPE1STPERSON_SIXDOF                  3
+#define DI8DEVTYPE1STPERSON_SHOOTER                 4
+
+#define DI8DEVTYPESCREENPTR_UNKNOWN                 2
+#define DI8DEVTYPESCREENPTR_LIGHTGUN                3
+#define DI8DEVTYPESCREENPTR_LIGHTPEN                4
+#define DI8DEVTYPESCREENPTR_TOUCH                   5
+
+#define DI8DEVTYPEREMOTE_UNKNOWN                    2
+
+#define DI8DEVTYPEDEVICECTRL_UNKNOWN                2
+#define DI8DEVTYPEDEVICECTRL_COMMSSELECTION         3
+#define DI8DEVTYPEDEVICECTRL_COMMSSELECTION_HARDWIRED 4
+
+#define DI8DEVTYPESUPPLEMENTAL_UNKNOWN              2
+#define DI8DEVTYPESUPPLEMENTAL_2NDHANDCONTROLLER    3
+#define DI8DEVTYPESUPPLEMENTAL_HEADTRACKER          4
+#define DI8DEVTYPESUPPLEMENTAL_HANDTRACKER          5
+#define DI8DEVTYPESUPPLEMENTAL_SHIFTSTICKGATE       6
+#define DI8DEVTYPESUPPLEMENTAL_SHIFTER              7
+#define DI8DEVTYPESUPPLEMENTAL_THROTTLE             8
+#define DI8DEVTYPESUPPLEMENTAL_SPLITTHROTTLE        9
+#define DI8DEVTYPESUPPLEMENTAL_COMBINEDPEDALS      10
+#define DI8DEVTYPESUPPLEMENTAL_DUALPEDALS          11
+#define DI8DEVTYPESUPPLEMENTAL_THREEPEDALS         12
+#define DI8DEVTYPESUPPLEMENTAL_RUDDERPEDALS        13
+
 #define GET_DIDEVICE_TYPE(dwDevType)     LOBYTE(dwDevType)
 #define GET_DIDEVICE_SUBTYPE(dwDevType)  HIBYTE(dwDevType)
 
@@ -1107,6 +1196,30 @@
 ICOM_DEFINE(IDirectInputDeviceA,IUnknown)
 #undef INTERFACE
 
+/*****************************************************************************
+ * IDirectInputDeviceW interface
+ */
+#define INTERFACE IDirectInputDeviceW
+#define IDirectInputDeviceW_METHODS \
+    IUnknown_METHODS \
+    STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS lpDIDevCaps) PURE; \
+    STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback, LPVOID pvRef, DWORD dwFlags) PURE; \
+    STDMETHOD(GetProperty)(THIS_ REFGUID rguidProp, LPDIPROPHEADER pdiph) PURE; \
+    STDMETHOD(SetProperty)(THIS_ REFGUID rguidProp, LPCDIPROPHEADER pdiph) PURE; \
+    STDMETHOD(Acquire)(THIS) PURE; \
+    STDMETHOD(Unacquire)(THIS) PURE; \
+    STDMETHOD(GetDeviceState)(THIS_ DWORD cbData, LPVOID lpvData) PURE; \
+    STDMETHOD(GetDeviceData)(THIS_ DWORD cbObjectData, LPDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD dwFlags) PURE; \
+    STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT lpdf) PURE; \
+    STDMETHOD(SetEventNotification)(THIS_ HANDLE hEvent) PURE; \
+    STDMETHOD(SetCooperativeLevel)(THIS_ HWND hwnd, DWORD dwFlags) PURE; \
+    STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEW pdidoi, DWORD dwObj, DWORD dwHow) PURE; \
+    STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEW pdidi) PURE; \
+    STDMETHOD(RunControlPanel)(THIS_ HWND hwndOwner, DWORD dwFlags) PURE; \
+    STDMETHOD(Initialize)(THIS_ HINSTANCE hinst, DWORD dwVersion, REFGUID rguid) PURE;
+ICOM_DEFINE(IDirectInputDeviceW,IUnknown)
+#undef INTERFACE
+
 #ifdef COBJMACROS
     /*** IUnknown methods ***/
 #define IDirectInputDevice_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
@@ -1149,6 +1262,24 @@
 ICOM_DEFINE(IDirectInputDevice2A,IDirectInputDeviceA)
 #undef INTERFACE
 
+/*****************************************************************************
+ * IDirectInputDevice2W interface
+ */
+#define INTERFACE IDirectInputDevice2W
+#define IDirectInputDevice2W_METHODS \
+    IDirectInputDeviceW_METHODS \
+    STDMETHOD(CreateEffect)(THIS_ REFGUID rguid, LPCDIEFFECT lpeff, LPDIRECTINPUTEFFECT *ppdeff, LPUNKNOWN punkOuter) PURE; \
+    STDMETHOD(EnumEffects)(THIS_ LPDIENUMEFFECTSCALLBACKW lpCallback, LPVOID pvRef, DWORD dwEffType) PURE; \
+    STDMETHOD(GetEffectInfo)(THIS_ LPDIEFFECTINFOW pdei, REFGUID rguid) PURE; \
+    STDMETHOD(GetForceFeedbackState)(THIS_ LPDWORD pdwOut) PURE; \
+    STDMETHOD(SendForceFeedbackCommand)(THIS_ DWORD dwFlags) PURE; \
+    STDMETHOD(EnumCreatedEffectObjects)(THIS_ LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback, LPVOID pvRef, DWORD fl) PURE; \
+    STDMETHOD(Escape)(THIS_ LPDIEFFESCAPE pesc) PURE; \
+    STDMETHOD(Poll)(THIS) PURE; \
+    STDMETHOD(SendDeviceData)(THIS_ DWORD cbObjectData, LPCDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD fl) PURE;
+ICOM_DEFINE(IDirectInputDevice2W,IDirectInputDeviceW)
+#undef INTERFACE
+
 #ifdef COBJMACROS
 /*** IUnknown methods ***/
 #define IDirectInputDevice2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
@@ -1194,6 +1325,17 @@
 ICOM_DEFINE(IDirectInputDevice7A,IDirectInputDevice2A)
 #undef INTERFACE
 
+/*****************************************************************************
+ * IDirectInputDevice7W interface
+ */
+#define INTERFACE IDirectInputDevice7W
+#define IDirectInputDevice7W_METHODS \
+    IDirectInputDevice2W_METHODS \
+    STDMETHOD(EnumEffectsInFile)(THIS_ LPCWSTR lpszFileName,LPDIENUMEFFECTSINFILECALLBACK pec,LPVOID pvRef,DWORD dwFlags) PURE; \
+    STDMETHOD(WriteEffectToFile)(THIS_ LPCWSTR lpszFileName,DWORD dwEntries,LPDIFILEEFFECT rgDiFileEft,DWORD dwFlags) PURE;
+ICOM_DEFINE(IDirectInputDevice7W,IDirectInputDevice2W)
+#undef INTERFACE
+
 #ifdef COBJMACROS
 /*** IUnknown methods ***/
 #define IDirectInputDevice7_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
@@ -1245,6 +1387,18 @@
 ICOM_DEFINE(IDirectInputDevice8A,IDirectInputDevice7A)
 #undef INTERFACE
 
+/*****************************************************************************
+ * IDirectInputDevice8W interface
+ */
+#define INTERFACE IDirectInputDevice8W
+#define IDirectInputDevice8W_METHODS \
+    IDirectInputDevice7W_METHODS \
+    STDMETHOD(BuildActionMap)(THIS_ LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags) PURE; \
+    STDMETHOD(SetActionMap)(THIS_ LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags) PURE; \
+    STDMETHOD(GetImageInfo)(THIS_ LPDIDEVICEIMAGEINFOHEADERW lpdiDevImageInfoHeader) PURE;
+ICOM_DEFINE(IDirectInputDevice8W,IDirectInputDevice7W)
+#undef INTERFACE
+
 #ifdef COBJMACROS
 /*** IUnknown methods ***/
 #define IDirectInputDevice8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
@@ -1351,6 +1505,33 @@
 #endif
 
 /*****************************************************************************
+ * IDirectInputW interface
+ */
+#define INTERFACE IDirectInputW
+#define IDirectInputW_METHODS \
+    IUnknown_METHODS \
+    STDMETHOD(CreateDevice)(THIS_ REFGUID rguid, LPDIRECTINPUTDEVICEW *lplpDirectInputDevice, LPUNKNOWN pUnkOuter) PURE; \
+    STDMETHOD(EnumDevices)(THIS_ DWORD dwDevType, LPDIENUMDEVICESCALLBACKW lpCallback, LPVOID pvRef, DWORD dwFlags) PURE; \
+    STDMETHOD(GetDeviceStatus)(THIS_ REFGUID rguidInstance) PURE; \
+    STDMETHOD(RunControlPanel)(THIS_ HWND hwndOwner, DWORD dwFlags) PURE; \
+    STDMETHOD(Initialize)(THIS_ HINSTANCE hinst, DWORD dwVersion) PURE;
+ICOM_DEFINE(IDirectInputW,IUnknown)
+#undef INTERFACE
+
+#ifdef COBJMACROS
+/*** IUnknown methods ***/
+#define IDirectInputW_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
+#define IDirectInputW_AddRef(p)             (p)->lpVtbl->AddRef(p)
+#define IDirectInputW_Release(p)            (p)->lpVtbl->Release(p)
+	/*** IDirectInputW methods ***/
+#define IDirectInputW_CreateDevice(p,a,b,c)  (p)->lpVtbl->CreateDevice(p,a,b,c)
+#define IDirectInputW_EnumDevices(p,a,b,c,d) (p)->lpVtbl->EnumDevices(p,a,b,c,d)
+#define IDirectInputW_GetDeviceStatus(p,a)   (p)->lpVtbl->GetDeviceStatus(p,a)
+#define IDirectInputW_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b)
+#define IDirectInputW_Initialize(p,a,b)      (p)->lpVtbl->Initialize(p,a,b)
+#endif
+
+/*****************************************************************************
  * IDirectInput2A interface
  */
 #define INTERFACE IDirectInput2A
@@ -1375,6 +1556,31 @@
 #define IDirectInput2A_FindDevice(p,a,b,c)    (p)->lpVtbl->FindDevice(p,a,b,c)
 #endif
 
+/*****************************************************************************
+ * IDirectInput2W interface
+ */
+#define INTERFACE IDirectInput2W
+#define IDirectInput2W_METHODS \
+    IDirectInputW_METHODS \
+    STDMETHOD(FindDevice)(THIS_ REFGUID rguid, LPCWSTR pszName, LPGUID pguidInstance) PURE;
+ICOM_DEFINE(IDirectInput2W,IDirectInputW)
+#undef INTERFACE
+
+#ifdef COBJMACROS
+/*** IUnknown methods ***/
+#define IDirectInput2W_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
+#define IDirectInput2W_AddRef(p)             (p)->lpVtbl->AddRef(p)
+#define IDirectInput2W_Release(p)            (p)->lpVtbl->Release(p)
+	/*** IDirectInputW methods ***/
+#define IDirectInput2W_CreateDevice(p,a,b,c)  (p)->lpVtbl->CreateDevice(p,a,b,c)
+#define IDirectInput2W_EnumDevices(p,a,b,c,d) (p)->lpVtbl->EnumDevices(p,a,b,c,d)
+#define IDirectInput2W_GetDeviceStatus(p,a)   (p)->lpVtbl->GetDeviceStatus(p,a)
+#define IDirectInput2W_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b)
+#define IDirectInput2W_Initialize(p,a,b)      (p)->lpVtbl->Initialize(p,a,b)
+	/*** IDirectInput2W methods ***/
+#define IDirectInput2W_FindDevice(p,a,b,c)    (p)->lpVtbl->FindDevice(p,a,b,c)
+#endif
+
 #if DIRECTINPUT_VERSION >= 0x0700
 /*****************************************************************************
  * IDirectInput7A interface
@@ -1403,6 +1609,33 @@
 #define IDirectInput7A_CreateDeviceEx(p,a,b,c,d) (p)->lpVtbl->CreateDeviceEx(p,a,b,c,d)
 #endif
 
+/*****************************************************************************
+ * IDirectInput7W interface
+ */
+#define INTERFACE IDirectInput7W
+#define IDirectInput7W_METHODS \
+    IDirectInput2W_METHODS \
+    STDMETHOD(CreateDeviceEx)(THIS_ REFGUID rguid, REFIID riid, LPVOID *pvOut, LPUNKNOWN lpUnknownOuter) PURE;
+ICOM_DEFINE(IDirectInput7W,IDirectInput2W)
+#undef INTERFACE
+
+#ifdef COBJMACROS
+/*** IUnknown methods ***/
+#define IDirectInput7W_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
+#define IDirectInput7W_AddRef(p)             (p)->lpVtbl->AddRef(p)
+#define IDirectInput7W_Release(p)            (p)->lpVtbl->Release(p)
+	/*** IDirectInputW methods ***/
+#define IDirectInput7W_CreateDevice(p,a,b,c)  (p)->lpVtbl->CreateDevice(p,a,b,c)
+#define IDirectInput7W_EnumDevices(p,a,b,c,d) (p)->lpVtbl->EnumDevices(p,a,b,c,d)
+#define IDirectInput7W_GetDeviceStatus(p,a)   (p)->lpVtbl->GetDeviceStatus(p,a)
+#define IDirectInput7W_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b)
+#define IDirectInput7W_Initialize(p,a,b)      (p)->lpVtbl->Initialize(p,a,b)
+	/*** IDirectInput2W methods ***/
+#define IDirectInput7W_FindDevice(p,a,b,c)    (p)->lpVtbl->FindDevice(p,a,b,c)
+	/*** IDirectInput7W methods ***/
+#define IDirectInput7W_CreateDeviceEx(p,a,b,c,d) (p)->lpVtbl->CreateDeviceEx(p,a,b,c,d)
+#endif
+
 #endif /* DI7 */
 
 #if DIRECTINPUT_VERSION >= 0x0800
@@ -1439,6 +1672,39 @@
 #define IDirectInput8A_ConfigureDevices(p,a,b,c,d) (p)->lpVtbl->ConfigureDevices(p,a,b,c,d)
 #endif
 
+/*****************************************************************************
+ * IDirectInput8W interface
+ */
+#define INTERFACE IDirectInput8W
+#define IDirectInput8W_METHODS \
+    IUnknown_METHODS \
+    STDMETHOD(CreateDevice)(THIS_ REFGUID rguid, LPDIRECTINPUTDEVICE8W *lplpDirectInputDevice, LPUNKNOWN pUnkOuter) PURE; \
+    STDMETHOD(EnumDevices)(THIS_ DWORD dwDevType, LPDIENUMDEVICESCALLBACKW lpCallback, LPVOID pvRef, DWORD dwFlags) PURE; \
+    STDMETHOD(GetDeviceStatus)(THIS_ REFGUID rguidInstance) PURE; \
+    STDMETHOD(RunControlPanel)(THIS_ HWND hwndOwner, DWORD dwFlags) PURE; \
+    STDMETHOD(Initialize)(THIS_ HINSTANCE hinst, DWORD dwVersion) PURE; \
+    STDMETHOD(FindDevice)(THIS_ REFGUID rguid, LPCWSTR pszName, LPGUID pguidInstance) PURE; \
+    STDMETHOD(EnumDevicesBySemantics)(THIS_ LPCWSTR ptszUserName, LPDIACTIONFORMATW lpdiActionFormat, LPDIENUMDEVICESBYSEMANTICSCBW lpCallback, LPVOID pvRef, DWORD dwFlags) PURE; \
+    STDMETHOD(ConfigureDevices)(THIS_ LPDICONFIGUREDEVICESCALLBACK lpdiCallback, LPDICONFIGUREDEVICESPARAMSW lpdiCDParams, DWORD dwFlags, LPVOID pvRefData) PURE;
+ICOM_DEFINE(IDirectInput8W,IUnknown)
+#undef INTERFACE
+
+#ifdef COBJMACROS
+/*** IUnknown methods ***/
+#define IDirectInput8W_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
+#define IDirectInput8W_AddRef(p)             (p)->lpVtbl->AddRef(p)
+#define IDirectInput8W_Release(p)            (p)->lpVtbl->Release(p)
+      /*** IDirectInput8W methods ***/
+#define IDirectInput8W_CreateDevice(p,a,b,c)       (p)->lpVtbl->CreateDevice(p,a,b,c)
+#define IDirectInput8W_EnumDevices(p,a,b,c,d)      (p)->lpVtbl->EnumDevices(p,a,b,c,d)
+#define IDirectInput8W_GetDeviceStatus(p,a)        (p)->lpVtbl->GetDeviceStatus(p,a)
+#define IDirectInput8W_RunControlPanel(p,a,b)      (p)->lpVtbl->RunControlPanel(p,a,b)
+#define IDirectInput8W_Initialize(p,a,b)           (p)->lpVtbl->Initialize(p,a,b)
+#define IDirectInput8W_FindDevice(p,a,b,c)         (p)->lpVtbl->FindDevice(p,a,b,c)
+#define IDirectInput8W_EnumDevicesBySemantics(p,a,b,c,d,e) (p)->lpVtbl->EnumDevicesBySemantics(p,a,b,c,d,e)
+#define IDirectInput8W_ConfigureDevices(p,a,b,c,d) (p)->lpVtbl->ConfigureDevices(p,a,b,c,d)
+#endif
+
 #endif /* DI8 */
 
 /* Export functions */
@@ -1452,7 +1718,7 @@
 #endif
 
 HRESULT WINAPI DirectInputCreateA(HINSTANCE,DWORD,LPDIRECTINPUTA *,LPUNKNOWN);
-HRESULT WINAPI DirectInputCreateW(HINSTANCE,DWORD,LPDIRECTINPUTA *,LPUNKNOWN);
+HRESULT WINAPI DirectInputCreateW(HINSTANCE,DWORD,LPDIRECTINPUTW *,LPUNKNOWN);
 #define DirectInputCreate WINELIB_NAME_AW(DirectInputCreate)
 
 HRESULT WINAPI DirectInputCreateEx(HINSTANCE,DWORD,REFIID,LPVOID *,LPUNKNOWN);
Index: dlls/dinput/device.c
===================================================================
RCS file: /home/wine/wine/dlls/dinput/device.c,v
retrieving revision 1.11
diff -u -r1.11 device.c
--- dlls/dinput/device.c	29 Apr 2003 22:47:04 -0000	1.11
+++ dlls/dinput/device.c	9 Jun 2003 17:29:30 -0000
@@ -28,6 +28,7 @@
 
 #include <string.h>
 #include "wine/debug.h"
+#include "wine/unicode.h"
 #include "winbase.h"
 #include "winerror.h"
 #include "windef.h"
@@ -107,6 +108,13 @@
   }
 }
 
+void _dump_OBJECTINSTANCEW(DIDEVICEOBJECTINSTANCEW *ddoi) {
+  if (TRACE_ON(dinput)) {
+    DPRINTF("    - enumerating : %s - %2ld - 0x%08lx - %s\n",
+	    debugstr_guid(&ddoi->guidType), ddoi->dwOfs, ddoi->dwType, debugstr_w(ddoi->tszName));
+  }
+}
+
 /* Conversion between internal data buffer and external data buffer */
 void fill_DataFormat(void *out, void *in, DataFormat *df) {
   int i;
@@ -267,6 +275,40 @@
   return ret;
 }
 
+BOOL DIEnumDevicesCallbackAtoW(LPCDIDEVICEOBJECTINSTANCEA lpddi, LPVOID lpvRef) {
+  DIDEVICEOBJECTINSTANCEW ddtmp;
+  device_enumobjects_AtoWcb_data* data;
+
+  data = (device_enumobjects_AtoWcb_data*) lpvRef;
+  
+  memset(&ddtmp, 0, sizeof(DIDEVICEINSTANCEW)); 
+
+  ddtmp.dwSize = sizeof(DIDEVICEINSTANCEW);
+  ddtmp.guidType     = lpddi->guidType;
+  ddtmp.dwOfs        = lpddi->dwOfs;
+  ddtmp.dwType       = lpddi->dwType;
+  ddtmp.dwFlags      = lpddi->dwFlags;
+  MultiByteToWideChar(CP_ACP, 0, lpddi->tszName, -1, ddtmp.tszName, MAX_PATH);
+#if(DIRECTINPUT_VERSION >= 0x0500)
+  if (lpddi->dwSize == sizeof(DIDEVICEINSTANCEA)) {
+    /**
+     * if dwSize < sizeof(DIDEVICEINSTANCEA of DInput version >= 5)
+     *  force feedback and other newer datas aren't available
+     */
+    ddtmp.dwFFMaxForce        = lpddi->dwFFMaxForce;
+    ddtmp.dwFFForceResolution = lpddi->dwFFForceResolution;
+    ddtmp.wCollectionNumber   = lpddi->wCollectionNumber;
+    ddtmp.wDesignatorIndex    = lpddi->wDesignatorIndex;
+    ddtmp.wUsagePage          = lpddi->wUsagePage;
+    ddtmp.wUsage              = lpddi->wUsage;
+    ddtmp.dwDimension         = lpddi->dwDimension;
+    ddtmp.wExponent           = lpddi->wExponent;
+    ddtmp.wReserved           = lpddi->wReserved;
+  }
+#endif
+  return data->lpCallBack(&ddtmp, lpvRef);
+}
+
 /******************************************************************************
  *	IDirectInputDeviceA
  */
@@ -291,7 +333,7 @@
     TRACE("dwType 0x%02x,dwInstance %d\n",DIDFT_GETTYPE(df->rgodf[i].dwType),DIDFT_GETINSTANCE(df->rgodf[i].dwType));
     TRACE("df.rgodf[%d].dwFlags 0x%08lx\n",i,df->rgodf[i].dwFlags);
   }
-  return 0;
+  return DI_OK;
 }
 
 HRESULT WINAPI IDirectInputDevice2AImpl_SetCooperativeLevel(
@@ -303,7 +345,7 @@
 	    TRACE(" cooperative level : ");
 	    _dump_cooperativelevel_DI(dwflags);
 	}
-	return 0;
+	return DI_OK;
 }
 
 HRESULT WINAPI IDirectInputDevice2AImpl_SetEventNotification(
@@ -311,7 +353,7 @@
 ) {
 	ICOM_THIS(IDirectInputDevice2AImpl,iface);
 	FIXME("(this=%p,0x%08lx): stub\n",This,(DWORD)hnd);
-	return 0;
+	return DI_OK;
 }
 
 ULONG WINAPI IDirectInputDevice2AImpl_Release(LPDIRECTINPUTDEVICE8A iface)
@@ -321,7 +363,7 @@
 	if (This->ref)
 		return This->ref;
 	HeapFree(GetProcessHeap(),0,This);
-	return 0;
+	return DI_OK;
 }
 
 HRESULT WINAPI IDirectInputDevice2AImpl_QueryInterface(
@@ -334,17 +376,53 @@
 	if (IsEqualGUID(&IID_IUnknown,riid)) {
 		IDirectInputDevice2_AddRef(iface);
 		*ppobj = This;
-		return 0;
+		return DI_OK;
 	}
 	if (IsEqualGUID(&IID_IDirectInputDeviceA,riid)) {
 		IDirectInputDevice2_AddRef(iface);
 		*ppobj = This;
-		return 0;
+		return DI_OK;
+	}
+	if (IsEqualGUID(&IID_IDirectInputDevice2A,riid)) {
+		IDirectInputDevice2_AddRef(iface);
+		*ppobj = This;
+		return DI_OK;
 	}
 	if (IsEqualGUID(&IID_IDirectInputDevice7A,riid)) {
 		IDirectInputDevice7_AddRef(iface);
 		*ppobj = This;
-		return 0;
+		return DI_OK;
+	}
+	TRACE("Unsupported interface !\n");
+	return E_FAIL;
+}
+
+HRESULT WINAPI IDirectInputDevice2WImpl_QueryInterface(
+	LPDIRECTINPUTDEVICE8W iface,REFIID riid,LPVOID *ppobj
+)
+{
+	ICOM_THIS(IDirectInputDevice2AImpl,iface);
+
+	TRACE("(this=%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
+	if (IsEqualGUID(&IID_IUnknown,riid)) {
+		IDirectInputDevice2_AddRef(iface);
+		*ppobj = This;
+		return DI_OK;
+	}
+	if (IsEqualGUID(&IID_IDirectInputDeviceW,riid)) {
+		IDirectInputDevice2_AddRef(iface);
+		*ppobj = This;
+		return DI_OK;
+	}
+	if (IsEqualGUID(&IID_IDirectInputDevice2W,riid)) {
+		IDirectInputDevice2_AddRef(iface);
+		*ppobj = This;
+		return DI_OK;
+	}
+	if (IsEqualGUID(&IID_IDirectInputDevice7W,riid)) {
+		IDirectInputDevice7_AddRef(iface);
+		*ppobj = This;
+		return DI_OK;
 	}
 	TRACE("Unsupported interface !\n");
 	return E_FAIL;
@@ -373,6 +451,22 @@
 	return DI_OK;
 }
 
+HRESULT WINAPI IDirectInputDevice2WImpl_EnumObjects(
+	LPDIRECTINPUTDEVICE8W iface,
+	LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback,
+	LPVOID lpvRef,
+	DWORD dwFlags)
+{
+	FIXME("(this=%p,%p,%p,%08lx): stub!\n", iface, lpCallback, lpvRef, dwFlags);
+	if (TRACE_ON(dinput)) {
+	  DPRINTF("  - flags = ");
+	  _dump_EnumObjects_flags(dwFlags);
+	  DPRINTF("\n");
+	}
+
+	return DI_OK;
+}
+
 HRESULT WINAPI IDirectInputDevice2AImpl_GetProperty(
 	LPDIRECTINPUTDEVICE8A iface,
 	REFGUID rguid,
@@ -399,6 +493,18 @@
 	return DI_OK;
 }
 
+HRESULT WINAPI IDirectInputDevice2WImpl_GetObjectInfo(
+	LPDIRECTINPUTDEVICE8W iface,
+	LPDIDEVICEOBJECTINSTANCEW pdidoi,
+	DWORD dwObj,
+	DWORD dwHow)
+{
+	FIXME("(this=%p,%p,%ld,0x%08lx): stub!\n",
+	      iface, pdidoi, dwObj, dwHow);
+
+	return DI_OK;
+}
+
 HRESULT WINAPI IDirectInputDevice2AImpl_GetDeviceInfo(
 	LPDIRECTINPUTDEVICE8A iface,
 	LPDIDEVICEINSTANCEA pdidi)
@@ -408,6 +514,15 @@
 
 	return DI_OK;
 }
+HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceInfo(
+	LPDIRECTINPUTDEVICE8W iface,
+	LPDIDEVICEINSTANCEW pdidi)
+{
+	FIXME("(this=%p,%p): stub!\n",
+	      iface, pdidi);
+
+	return DI_OK;
+}
 
 HRESULT WINAPI IDirectInputDevice2AImpl_RunControlPanel(
 	LPDIRECTINPUTDEVICE8A iface,
@@ -461,6 +576,20 @@
 	return DI_OK;
 }
 
+HRESULT WINAPI IDirectInputDevice2WImpl_EnumEffects(
+	LPDIRECTINPUTDEVICE8W iface,
+	LPDIENUMEFFECTSCALLBACKW lpCallback,
+	LPVOID lpvRef,
+	DWORD dwFlags)
+{
+	FIXME("(this=%p,%p,%p,0x%08lx): stub!\n",
+	      iface, lpCallback, lpvRef, dwFlags);
+
+	if (lpCallback)
+		lpCallback(NULL, lpvRef);
+	return DI_OK;
+}
+
 HRESULT WINAPI IDirectInputDevice2AImpl_GetEffectInfo(
 	LPDIRECTINPUTDEVICE8A iface,
 	LPDIEFFECTINFOA lpdei,
@@ -471,6 +600,16 @@
 	return DI_OK;
 }
 
+HRESULT WINAPI IDirectInputDevice2WImpl_GetEffectInfo(
+	LPDIRECTINPUTDEVICE8W iface,
+	LPDIEFFECTINFOW lpdei,
+	REFGUID rguid)
+{
+	FIXME("(this=%p,%p,%s): stub!\n",
+	      iface, lpdei, debugstr_guid(rguid));
+	return DI_OK;
+}
+
 HRESULT WINAPI IDirectInputDevice2AImpl_GetForceFeedbackState(
 	LPDIRECTINPUTDEVICE8A iface,
 	LPDWORD pdwOut)
@@ -542,6 +681,17 @@
   return DI_OK;
 }
 
+HRESULT WINAPI IDirectInputDevice7WImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8W iface,
+							  LPCWSTR lpszFileName,
+							  LPDIENUMEFFECTSINFILECALLBACK pec,
+							  LPVOID pvRef,
+							  DWORD dwFlags)
+{
+  FIXME("(%p)->(%s,%p,%p,%08lx): stub !\n", iface, debugstr_w(lpszFileName), pec, pvRef, dwFlags);
+
+  return DI_OK;
+}
+
 HRESULT WINAPI IDirectInputDevice7AImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8A iface,
 							  LPCSTR lpszFileName,
 							  DWORD dwEntries,
@@ -553,6 +703,17 @@
   return DI_OK;
 }
 
+HRESULT WINAPI IDirectInputDevice7WImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8W iface,
+							  LPCWSTR lpszFileName,
+							  DWORD dwEntries,
+							  LPDIFILEEFFECT rgDiFileEft,
+							  DWORD dwFlags)
+{
+  FIXME("(%p)->(%s,%08lx,%p,%08lx): stub !\n", iface, debugstr_w(lpszFileName), dwEntries, rgDiFileEft, dwFlags);
+
+  return DI_OK;
+}
+
 HRESULT WINAPI IDirectInputDevice8AImpl_BuildActionMap(LPDIRECTINPUTDEVICE8A iface,
 						       LPDIACTIONFORMATA lpdiaf,
 						       LPCSTR lpszUserName,
@@ -563,6 +724,16 @@
   return DI_OK;
 }
 
+HRESULT WINAPI IDirectInputDevice8WImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface,
+						       LPDIACTIONFORMATW lpdiaf,
+						       LPCWSTR lpszUserName,
+						       DWORD dwFlags)
+{
+  FIXME("(%p)->(%p,%s,%08lx): stub !\n", iface, lpdiaf, debugstr_w(lpszUserName), dwFlags);
+
+  return DI_OK;
+}
+
 HRESULT WINAPI IDirectInputDevice8AImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface,
 						     LPDIACTIONFORMATA lpdiaf,
 						     LPCSTR lpszUserName,
@@ -573,8 +744,26 @@
   return DI_OK;
 }
 
+HRESULT WINAPI IDirectInputDevice8WImpl_SetActionMap(LPDIRECTINPUTDEVICE8W iface,
+						     LPDIACTIONFORMATW lpdiaf,
+						     LPCWSTR lpszUserName,
+						     DWORD dwFlags)
+{
+  FIXME("(%p)->(%p,%s,%08lx): stub !\n", iface, lpdiaf, debugstr_w(lpszUserName), dwFlags);
+
+  return DI_OK;
+}
+
 HRESULT WINAPI IDirectInputDevice8AImpl_GetImageInfo(LPDIRECTINPUTDEVICE8A iface,
 						     LPDIDEVICEIMAGEINFOHEADERA lpdiDevImageInfoHeader)
+{
+  FIXME("(%p)->(%p): stub !\n", iface, lpdiDevImageInfoHeader);
+
+  return DI_OK;
+}
+
+HRESULT WINAPI IDirectInputDevice8WImpl_GetImageInfo(LPDIRECTINPUTDEVICE8W iface,
+						     LPDIDEVICEIMAGEINFOHEADERW lpdiDevImageInfoHeader)
 {
   FIXME("(%p)->(%p): stub !\n", iface, lpdiDevImageInfoHeader);
 
Index: dlls/dinput/device_private.h
===================================================================
RCS file: /home/wine/wine/dlls/dinput/device_private.h,v
retrieving revision 1.4
diff -u -r1.4 device_private.h
--- dlls/dinput/device_private.h	14 Jun 2002 00:39:44 -0000	1.4
+++ dlls/dinput/device_private.h	9 Jun 2003 17:29:30 -0000
@@ -70,12 +70,24 @@
   }										\
 }
 
+/**
+ * Callback Data used by specific callback 
+ *  for EnumObject on 'W' interfaces
+ */
+typedef struct {
+  LPDIENUMDEVICEOBJECTSCALLBACKW lpCallBack;
+  LPVOID lpvRef;
+} device_enumobjects_AtoWcb_data;
+
+extern BOOL DIEnumDevicesCallbackAtoW(LPCDIDEVICEOBJECTINSTANCEA, LPVOID);
+
 
 /* Various debug tools */
 extern void _dump_cooperativelevel_DI(DWORD dwFlags) ;
 extern void _dump_EnumObjects_flags(DWORD dwFlags) ;
 extern void _dump_DIPROPHEADER(DIPROPHEADER *diph) ;
 extern void _dump_OBJECTINSTANCEA(DIDEVICEOBJECTINSTANCEA *ddoi) ;
+extern void _dump_OBJECTINSTANCEW(DIDEVICEOBJECTINSTANCEW *ddoi) ;
 
 /* And the stubs */
 extern HRESULT WINAPI IDirectInputDevice2AImpl_SetDataFormat(
@@ -85,8 +97,8 @@
 extern HRESULT WINAPI IDirectInputDevice2AImpl_SetEventNotification(
 	LPDIRECTINPUTDEVICE8A iface,HANDLE hnd ) ;
 extern ULONG WINAPI IDirectInputDevice2AImpl_Release(LPDIRECTINPUTDEVICE8A iface) ;
-extern HRESULT WINAPI IDirectInputDevice2AImpl_QueryInterface(
-	LPDIRECTINPUTDEVICE8A iface,REFIID riid,LPVOID *ppobj ) ;
+extern HRESULT WINAPI IDirectInputDevice2AImpl_QueryInterface(LPDIRECTINPUTDEVICE8A iface,REFIID riid,LPVOID *ppobj);
+extern HRESULT WINAPI IDirectInputDevice2WImpl_QueryInterface(LPDIRECTINPUTDEVICE8W iface,REFIID riid,LPVOID *ppobj);
 extern ULONG WINAPI IDirectInputDevice2AImpl_AddRef(
 	LPDIRECTINPUTDEVICE8A iface) ;
 extern HRESULT WINAPI IDirectInputDevice2AImpl_EnumObjects(
@@ -94,6 +106,11 @@
 	LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback,
 	LPVOID lpvRef,
 	DWORD dwFlags) ;
+extern HRESULT WINAPI IDirectInputDevice2WImpl_EnumObjects(
+	LPDIRECTINPUTDEVICE8W iface,
+	LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback,
+	LPVOID lpvRef,
+	DWORD dwFlags) ;
 extern HRESULT WINAPI IDirectInputDevice2AImpl_GetProperty(
 	LPDIRECTINPUTDEVICE8A iface,
 	REFGUID rguid,
@@ -103,9 +120,16 @@
 	LPDIDEVICEOBJECTINSTANCEA pdidoi,
 	DWORD dwObj,
 	DWORD dwHow) ;
+extern HRESULT WINAPI IDirectInputDevice2WImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface, 
+							     LPDIDEVICEOBJECTINSTANCEW pdidoi,
+							     DWORD dwObj,
+							     DWORD dwHow);
 extern HRESULT WINAPI IDirectInputDevice2AImpl_GetDeviceInfo(
 	LPDIRECTINPUTDEVICE8A iface,
 	LPDIDEVICEINSTANCEA pdidi) ;
+extern HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceInfo(
+	LPDIRECTINPUTDEVICE8W iface,
+	LPDIDEVICEINSTANCEW pdidi) ;
 extern HRESULT WINAPI IDirectInputDevice2AImpl_RunControlPanel(
 	LPDIRECTINPUTDEVICE8A iface,
 	HWND hwndOwner,
@@ -126,10 +150,19 @@
 	LPDIENUMEFFECTSCALLBACKA lpCallback,
 	LPVOID lpvRef,
 	DWORD dwFlags) ;
+extern HRESULT WINAPI IDirectInputDevice2WImpl_EnumEffects(
+	LPDIRECTINPUTDEVICE8W iface,
+	LPDIENUMEFFECTSCALLBACKW lpCallback,
+	LPVOID lpvRef,
+	DWORD dwFlags) ;
 extern HRESULT WINAPI IDirectInputDevice2AImpl_GetEffectInfo(
 	LPDIRECTINPUTDEVICE8A iface,
 	LPDIEFFECTINFOA lpdei,
 	REFGUID rguid) ;
+extern HRESULT WINAPI IDirectInputDevice2WImpl_GetEffectInfo(
+	LPDIRECTINPUTDEVICE8W iface,
+	LPDIEFFECTINFOW lpdei,
+	REFGUID rguid) ;
 extern HRESULT WINAPI IDirectInputDevice2AImpl_GetForceFeedbackState(
 	LPDIRECTINPUTDEVICE8A iface,
 	LPDWORD pdwOut) ;
@@ -157,20 +190,40 @@
 								 LPDIENUMEFFECTSINFILECALLBACK pec,
 								 LPVOID pvRef,
 								 DWORD dwFlags) ;
+extern HRESULT WINAPI IDirectInputDevice7WImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8W iface,
+								 LPCWSTR lpszFileName,
+								 LPDIENUMEFFECTSINFILECALLBACK pec,
+								 LPVOID pvRef,
+								 DWORD dwFlags) ;
 extern HRESULT WINAPI IDirectInputDevice7AImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8A iface,
 								 LPCSTR lpszFileName,
 								 DWORD dwEntries,
 								 LPDIFILEEFFECT rgDiFileEft,
 								 DWORD dwFlags) ;
+extern HRESULT WINAPI IDirectInputDevice7WImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8W iface,
+								 LPCWSTR lpszFileName,
+								 DWORD dwEntries,
+								 LPDIFILEEFFECT rgDiFileEft,
+								 DWORD dwFlags) ;
 extern HRESULT WINAPI IDirectInputDevice8AImpl_BuildActionMap(LPDIRECTINPUTDEVICE8A iface,
 							      LPDIACTIONFORMATA lpdiaf,
 							      LPCSTR lpszUserName,
 							      DWORD dwFlags);
+extern HRESULT WINAPI IDirectInputDevice8WImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface,
+							      LPDIACTIONFORMATW lpdiaf,
+							      LPCWSTR lpszUserName,
+							      DWORD dwFlags);
 extern HRESULT WINAPI IDirectInputDevice8AImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface,
 							    LPDIACTIONFORMATA lpdiaf,
 							    LPCSTR lpszUserName,
 							    DWORD dwFlags);
+extern HRESULT WINAPI IDirectInputDevice8WImpl_SetActionMap(LPDIRECTINPUTDEVICE8W iface,
+							    LPDIACTIONFORMATW lpdiaf,
+							    LPCWSTR lpszUserName,
+							    DWORD dwFlags);
 extern HRESULT WINAPI IDirectInputDevice8AImpl_GetImageInfo(LPDIRECTINPUTDEVICE8A iface,
 							    LPDIDEVICEIMAGEINFOHEADERA lpdiDevImageInfoHeader);
+extern HRESULT WINAPI IDirectInputDevice8WImpl_GetImageInfo(LPDIRECTINPUTDEVICE8W iface,
+							    LPDIDEVICEIMAGEINFOHEADERW lpdiDevImageInfoHeader);
 
 #endif /* __WINE_DLLS_DINPUT_DINPUTDEVICE_PRIVATE_H */
Index: dlls/dinput/dinput.spec
===================================================================
RCS file: /home/wine/wine/dlls/dinput/dinput.spec,v
retrieving revision 1.12
diff -u -r1.12 dinput.spec
--- dlls/dinput/dinput.spec	20 Mar 2003 03:53:15 -0000	1.12
+++ dlls/dinput/dinput.spec	9 Jun 2003 17:29:30 -0000
@@ -1,5 +1,5 @@
 @ stdcall DirectInputCreateA(long long ptr ptr)
-@ stub DirectInputCreateW
+@ stdcall DirectInputCreateW(long long ptr ptr)
 @ stdcall DirectInputCreateEx(long long ptr ptr ptr)
 @ stdcall DllCanUnloadNow() DINPUT_DllCanUnloadNow
 @ stdcall DllGetClassObject(ptr ptr ptr) DINPUT_DllGetClassObject
Index: dlls/dinput/dinput_main.c
===================================================================
RCS file: /home/wine/wine/dlls/dinput/dinput_main.c,v
retrieving revision 1.34
diff -u -r1.34 dinput_main.c
--- dlls/dinput/dinput_main.c	29 Apr 2003 22:43:48 -0000	1.34
+++ dlls/dinput/dinput_main.c	9 Jun 2003 17:29:31 -0000
@@ -34,6 +34,7 @@
 #include <string.h>
 
 #include "wine/debug.h"
+#include "wine/unicode.h"
 #include "winbase.h"
 #include "winuser.h"
 #include "winerror.h"
@@ -43,7 +44,9 @@
 WINE_DEFAULT_DEBUG_CHANNEL(dinput);
 
 static ICOM_VTABLE(IDirectInput7A) ddi7avt;
+static ICOM_VTABLE(IDirectInput7W) ddi7awt;
 static ICOM_VTABLE(IDirectInput8A) ddi8avt;
+static ICOM_VTABLE(IDirectInput8W) ddi8wvt;
 
 /* This array will be filled a dinput.so loading */
 #define MAX_WINE_DINPUT_DEVICES 4
@@ -94,29 +97,50 @@
  */
 HRESULT WINAPI DirectInputCreateEx(
 	HINSTANCE hinst, DWORD dwVersion, REFIID riid, LPVOID *ppDI,
-	LPUNKNOWN punkOuter
-) {
-	IDirectInputAImpl* This;
+	LPUNKNOWN punkOuter) 
+{
+	IDirectInputImpl* This;
+
+	TRACE("(0x%08lx,%04lx,%s,%p,%p)\n", (DWORD)hinst,dwVersion,debugstr_guid(riid),ppDI,punkOuter);
 
-	TRACE("(0x%08lx,%04lx,%s,%p,%p)\n",
-		(DWORD)hinst,dwVersion,debugstr_guid(riid),ppDI,punkOuter
-	);
 	if (IsEqualGUID(&IID_IDirectInputA,riid) ||
 	    IsEqualGUID(&IID_IDirectInput2A,riid) ||
 	    IsEqualGUID(&IID_IDirectInput7A,riid)) {
-	  This = (IDirectInputAImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputAImpl));
+	  This = (IDirectInputImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl));
 	  This->lpVtbl = &ddi7avt;
 	  This->ref = 1;
+	  This->version = 1;
 	  *ppDI = This;
 
 	  return DI_OK;
 	}
 
+	if (IsEqualGUID(&IID_IDirectInputW,riid) ||
+	    IsEqualGUID(&IID_IDirectInput2W,riid) ||
+	    IsEqualGUID(&IID_IDirectInput7W,riid)) {
+	  This = (IDirectInputImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl));
+	  This->lpVtbl = &ddi7awt;
+	  This->ref = 1;
+	  This->version = 1;
+	  *ppDI = This;
+
+	  return DI_OK;
+	}
 
 	if (IsEqualGUID(&IID_IDirectInput8A,riid)) {
-	  This = (IDirectInputAImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputAImpl));
+	  This = (IDirectInputImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl));
 	  This->lpVtbl = &ddi8avt;
 	  This->ref = 1;
+	  This->version = 8;
+	  *ppDI = This;
+
+	  return DI_OK;
+	}
+
+	if (IsEqualGUID(&IID_IDirectInput8W,riid)) {
+	  This = (IDirectInputImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl));
+	  This->lpVtbl = &ddi8wvt;
+	  This->ref = 1;
 	  *ppDI = This;
 
 	  return DI_OK;
@@ -130,17 +154,31 @@
  */
 HRESULT WINAPI DirectInputCreateA(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTA *ppDI, LPUNKNOWN punkOuter)
 {
-	IDirectInputAImpl* This;
-	TRACE("(0x%08lx,%04lx,%p,%p)\n",
-		(DWORD)hinst,dwVersion,ppDI,punkOuter
-	);
-	This = (IDirectInputAImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputAImpl));
+	IDirectInputImpl* This;
+	TRACE("(0x%08lx,%04lx,%p,%p)\n", (DWORD)hinst,dwVersion,ppDI,punkOuter);
+	This = (IDirectInputImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl));
 	This->lpVtbl = &ddi7avt;
 	This->ref = 1;
-	*ppDI=(IDirectInputA*)This;
+	*ppDI = (IDirectInputA*)This;
 	return 0;
 
 }
+
+/******************************************************************************
+ *	DirectInputCreateW (DINPUT.@)
+ */
+HRESULT WINAPI DirectInputCreateW(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTW *ppDI, LPUNKNOWN punkOuter)
+{
+	IDirectInputImpl* This;
+	TRACE("(0x%08lx,%04lx,%p,%p)\n", (DWORD)hinst,dwVersion,ppDI,punkOuter);
+	This = (IDirectInputImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl));
+	This->lpVtbl = &ddi7awt;
+	This->ref = 1;
+	*ppDI = (IDirectInputW*)This;
+	return 0;
+
+}
+
 /******************************************************************************
  *	IDirectInputA_EnumDevices
  */
@@ -149,7 +187,7 @@
 	LPVOID pvRef, DWORD dwFlags
 )
 {
-	ICOM_THIS(IDirectInputAImpl,iface);
+	ICOM_THIS(IDirectInputImpl,iface);
 	DIDEVICEINSTANCEA devInstance;
 	int i;
 
@@ -157,7 +195,7 @@
 
 	for (i = 0; i < nrof_dinput_devices; i++) {
 	  devInstance.dwSize = sizeof(devInstance);
-	  if (dinput_devices[i]->enum_device(dwDevType, dwFlags, &devInstance)) {
+	  if (dinput_devices[i]->enum_deviceA(dwDevType, dwFlags, &devInstance, This->version)) {
 	    if (lpCallback(&devInstance,pvRef) == DIENUM_STOP)
 	      return 0;
 	  }
@@ -165,11 +203,32 @@
 
 	return 0;
 }
+/******************************************************************************
+ *	IDirectInputW_EnumDevices
+ */
+static HRESULT WINAPI IDirectInputWImpl_EnumDevices(
+	LPDIRECTINPUT7W iface, DWORD dwDevType, LPDIENUMDEVICESCALLBACKW lpCallback,
+	LPVOID pvRef, DWORD dwFlags) 
+{
+	ICOM_THIS(IDirectInputImpl,iface);
+	DIDEVICEINSTANCEW devInstance;
+	int i;
 
-static HRESULT WINAPI IDirectInputAImpl_QueryInterface(
-	LPDIRECTINPUT7A iface,REFIID riid,LPVOID *ppobj
-) {
-	ICOM_THIS(IDirectInputAImpl,iface);
+	TRACE("(this=%p,0x%04lx,%p,%p,%04lx)\n", This, dwDevType, lpCallback, pvRef, dwFlags);
+
+	for (i = 0; i < nrof_dinput_devices; i++) {
+	  devInstance.dwSize = sizeof(devInstance);
+	  if (dinput_devices[i]->enum_deviceW(dwDevType, dwFlags, &devInstance, This->version)) {
+	    if (lpCallback(&devInstance,pvRef) == DIENUM_STOP)
+	      return 0;
+	  }
+	}
+
+	return 0;
+}
+
+static HRESULT WINAPI IDirectInputAImpl_QueryInterface(LPDIRECTINPUT7A iface, REFIID riid, LPVOID *ppobj) {
+	ICOM_THIS(IDirectInputImpl,iface);
 
 	TRACE("(this=%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
 	if (IsEqualGUID(&IID_IUnknown,riid) ||
@@ -184,15 +243,31 @@
 	return E_FAIL;
 }
 
+static HRESULT WINAPI IDirectInputWImpl_QueryInterface(LPDIRECTINPUT7W iface, REFIID riid, LPVOID *ppobj) {
+	ICOM_THIS(IDirectInputImpl,iface);
+
+	TRACE("(this=%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
+	if (IsEqualGUID(&IID_IUnknown,riid) ||
+	    IsEqualGUID(&IID_IDirectInputW,riid) ||
+	    IsEqualGUID(&IID_IDirectInput2W,riid) ||
+	    IsEqualGUID(&IID_IDirectInput7W,riid)) {
+		IDirectInputA_AddRef(iface);
+		*ppobj = This;
+		return 0;
+	}
+	TRACE("Unsupported interface !\n");
+	return E_FAIL;
+}
+
 static ULONG WINAPI IDirectInputAImpl_AddRef(LPDIRECTINPUT7A iface)
 {
-	ICOM_THIS(IDirectInputAImpl,iface);
+	ICOM_THIS(IDirectInputImpl,iface);
 	return ++(This->ref);
 }
 
 static ULONG WINAPI IDirectInputAImpl_Release(LPDIRECTINPUT7A iface)
 {
-	ICOM_THIS(IDirectInputAImpl,iface);
+	ICOM_THIS(IDirectInputImpl,iface);
 	if (!(--This->ref)) {
 		HeapFree(GetProcessHeap(),0,This);
 		return 0;
@@ -204,7 +279,7 @@
 	LPDIRECTINPUT7A iface,REFGUID rguid,LPDIRECTINPUTDEVICEA* pdev,
 	LPUNKNOWN punk
 ) {
-	ICOM_THIS(IDirectInputAImpl,iface);
+	ICOM_THIS(IDirectInputImpl,iface);
 	HRESULT ret_value = DIERR_DEVICENOTREG;
 	int i;
 
@@ -213,7 +288,7 @@
 	/* Loop on all the devices to see if anyone matches the given GUID */
 	for (i = 0; i < nrof_dinput_devices; i++) {
 	  HRESULT ret;
-	  if ((ret = dinput_devices[i]->create_device(This, rguid, NULL, pdev)) == DI_OK)
+	  if ((ret = dinput_devices[i]->create_deviceA(This, rguid, NULL, pdev)) == DI_OK)
 	    return DI_OK;
 
 	  if (ret == DIERR_NOINTERFACE)
@@ -223,15 +298,34 @@
 	return ret_value;
 }
 
-static HRESULT WINAPI IDirectInputAImpl_Initialize(
-	LPDIRECTINPUT7A iface,HINSTANCE hinst,DWORD x
-) {
+static HRESULT WINAPI IDirectInputWImpl_CreateDevice(LPDIRECTINPUT7A iface, 
+						     REFGUID rguid, LPDIRECTINPUTDEVICEW* pdev, LPUNKNOWN punk) {
+        ICOM_THIS(IDirectInputImpl,iface);
+	HRESULT ret_value = DIERR_DEVICENOTREG;
+	int i;
+
+	TRACE("(this=%p,%s,%p,%p)\n",This,debugstr_guid(rguid),pdev,punk);
+
+	/* Loop on all the devices to see if anyone matches the given GUID */
+	for (i = 0; i < nrof_dinput_devices; i++) {
+	  HRESULT ret;
+	  if ((ret = dinput_devices[i]->create_deviceW(This, rguid, NULL, pdev)) == DI_OK)
+	    return DI_OK;
+
+	  if (ret == DIERR_NOINTERFACE)
+	    ret_value = DIERR_NOINTERFACE;
+	}
+
+	return ret_value;
+}
+
+static HRESULT WINAPI IDirectInputAImpl_Initialize(LPDIRECTINPUT7A iface, HINSTANCE hinst, DWORD x) {
 	return DIERR_ALREADYINITIALIZED;
 }
 
 static HRESULT WINAPI IDirectInputAImpl_GetDeviceStatus(LPDIRECTINPUT7A iface,
 							REFGUID rguid) {
-  ICOM_THIS(IDirectInputAImpl,iface);
+  ICOM_THIS(IDirectInputImpl,iface);
 
   FIXME("(%p)->(%s): stub\n",This,debugstr_guid(rguid));
 
@@ -241,7 +335,7 @@
 static HRESULT WINAPI IDirectInputAImpl_RunControlPanel(LPDIRECTINPUT7A iface,
 							HWND hwndOwner,
 							DWORD dwFlags) {
-  ICOM_THIS(IDirectInputAImpl,iface);
+  ICOM_THIS(IDirectInputImpl,iface);
   FIXME("(%p)->(%08lx,%08lx): stub\n",This, (DWORD) hwndOwner, dwFlags);
 
   return DI_OK;
@@ -249,16 +343,24 @@
 
 static HRESULT WINAPI IDirectInput2AImpl_FindDevice(LPDIRECTINPUT7A iface, REFGUID rguid,
 						    LPCSTR pszName, LPGUID pguidInstance) {
-  ICOM_THIS(IDirectInputAImpl,iface);
+  ICOM_THIS(IDirectInputImpl,iface);
   FIXME("(%p)->(%s, %s, %p): stub\n", This, debugstr_guid(rguid), pszName, pguidInstance);
 
   return DI_OK;
 }
 
+static HRESULT WINAPI IDirectInput2WImpl_FindDevice(LPDIRECTINPUT7W iface, REFGUID rguid,
+						    LPCWSTR pszName, LPGUID pguidInstance) {
+  ICOM_THIS(IDirectInputImpl,iface);
+  FIXME("(%p)->(%s, %s, %p): stub\n", This, debugstr_guid(rguid), debugstr_w(pszName), pguidInstance);
+
+  return DI_OK;
+}
+
 static HRESULT WINAPI IDirectInput7AImpl_CreateDeviceEx(LPDIRECTINPUT7A iface, REFGUID rguid,
 							REFIID riid, LPVOID* pvOut, LPUNKNOWN lpUnknownOuter)
 {
-  ICOM_THIS(IDirectInputAImpl,iface);
+  ICOM_THIS(IDirectInputImpl,iface);
   HRESULT ret_value = DIERR_DEVICENOTREG;
   int i;
 
@@ -267,7 +369,7 @@
   /* Loop on all the devices to see if anyone matches the given GUID */
   for (i = 0; i < nrof_dinput_devices; i++) {
     HRESULT ret;
-    if ((ret = dinput_devices[i]->create_device(This, rguid, riid, (LPDIRECTINPUTDEVICEA*) pvOut)) == DI_OK)
+    if ((ret = dinput_devices[i]->create_deviceA(This, rguid, riid, (LPDIRECTINPUTDEVICEA*) pvOut)) == DI_OK)
       return DI_OK;
 
     if (ret == DIERR_NOINTERFACE)
@@ -277,10 +379,30 @@
   return ret_value;
 }
 
-static HRESULT WINAPI IDirectInput8AImpl_QueryInterface(
-      LPDIRECTINPUT8A iface,REFIID riid,LPVOID *ppobj
-) {
-      ICOM_THIS(IDirectInputAImpl,iface);
+static HRESULT WINAPI IDirectInput7WImpl_CreateDeviceEx(LPDIRECTINPUT7W iface, REFGUID rguid,
+							REFIID riid, LPVOID* pvOut, LPUNKNOWN lpUnknownOuter)
+{
+  ICOM_THIS(IDirectInputImpl,iface);
+  HRESULT ret_value = DIERR_DEVICENOTREG;
+  int i;
+
+  TRACE("(%p)->(%s, %s, %p, %p)\n", This, debugstr_guid(rguid), debugstr_guid(riid), pvOut, lpUnknownOuter);
+
+  /* Loop on all the devices to see if anyone matches the given GUID */
+  for (i = 0; i < nrof_dinput_devices; i++) {
+    HRESULT ret;
+    if ((ret = dinput_devices[i]->create_deviceW(This, rguid, riid, (LPDIRECTINPUTDEVICEW*) pvOut)) == DI_OK)
+      return DI_OK;
+
+    if (ret == DIERR_NOINTERFACE)
+      ret_value = DIERR_NOINTERFACE;
+  }
+
+  return ret_value;
+}
+
+static HRESULT WINAPI IDirectInput8AImpl_QueryInterface(LPDIRECTINPUT8A iface, REFIID riid, LPVOID *ppobj) {
+      ICOM_THIS(IDirectInputImpl,iface);
 
       TRACE("(this=%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
       if (IsEqualGUID(&IID_IUnknown,riid) ||
@@ -290,7 +412,21 @@
               return 0;
       }
       TRACE("Unsupported interface !\n");
-      return E_FAIL;
+      return E_NOINTERFACE;
+}
+
+static HRESULT WINAPI IDirectInput8WImpl_QueryInterface(LPDIRECTINPUT8W iface, REFIID riid, LPVOID *ppobj) {
+      ICOM_THIS(IDirectInputImpl,iface);
+
+      TRACE("(this=%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
+      if (IsEqualGUID(&IID_IUnknown,riid) ||
+          IsEqualGUID(&IID_IDirectInput8W,riid)) {
+              IDirectInputA_AddRef(iface);
+              *ppobj = This;
+              return 0;
+      }
+      TRACE("Unsupported interface !\n");
+      return E_NOINTERFACE;
 }
 
 static HRESULT WINAPI IDirectInput8AImpl_EnumDevicesBySemantics(
@@ -299,19 +435,44 @@
       LPVOID pvRef, DWORD dwFlags
 )
 {
-      ICOM_THIS(IDirectInputAImpl,iface);
+      ICOM_THIS(IDirectInputImpl,iface);
 
       FIXME("(this=%p,%s,%p,%p,%p,%04lx): stub\n", This, ptszUserName, lpdiActionFormat,
             lpCallback, pvRef, dwFlags);
       return 0;
 }
 
+static HRESULT WINAPI IDirectInput8WImpl_EnumDevicesBySemantics(
+      LPDIRECTINPUT8W iface, LPCWSTR ptszUserName, LPDIACTIONFORMATW lpdiActionFormat,
+      LPDIENUMDEVICESBYSEMANTICSCBW lpCallback,
+      LPVOID pvRef, DWORD dwFlags
+)
+{
+      ICOM_THIS(IDirectInputImpl,iface);
+
+      FIXME("(this=%p,%s,%p,%p,%p,%04lx): stub\n", This, debugstr_w(ptszUserName), lpdiActionFormat,
+            lpCallback, pvRef, dwFlags);
+      return 0;
+}
+
 static HRESULT WINAPI IDirectInput8AImpl_ConfigureDevices(
       LPDIRECTINPUT8A iface, LPDICONFIGUREDEVICESCALLBACK lpdiCallback,
       LPDICONFIGUREDEVICESPARAMSA lpdiCDParams, DWORD dwFlags, LPVOID pvRefData
 )
 {
-      ICOM_THIS(IDirectInputAImpl,iface);
+      ICOM_THIS(IDirectInputImpl,iface);
+
+      FIXME("(this=%p,%p,%p,%04lx,%p): stub\n", This, lpdiCallback, lpdiCDParams,
+            dwFlags, pvRefData);
+      return 0;
+}
+
+static HRESULT WINAPI IDirectInput8WImpl_ConfigureDevices(
+      LPDIRECTINPUT8W iface, LPDICONFIGUREDEVICESCALLBACK lpdiCallback,
+      LPDICONFIGUREDEVICESPARAMSW lpdiCDParams, DWORD dwFlags, LPVOID pvRefData
+)
+{
+      ICOM_THIS(IDirectInputImpl,iface);
 
       FIXME("(this=%p,%p,%p,%04lx,%p): stub\n", This, lpdiCallback, lpdiCDParams,
             dwFlags, pvRefData);
@@ -335,7 +496,28 @@
 	XCAST(RunControlPanel)IDirectInputAImpl_RunControlPanel,
 	XCAST(Initialize)IDirectInputAImpl_Initialize,
 	XCAST(FindDevice)IDirectInput2AImpl_FindDevice,
-	IDirectInput7AImpl_CreateDeviceEx
+	XCAST(CreateDeviceEx)IDirectInput7AImpl_CreateDeviceEx
+};
+
+#undef XCAST
+#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
+# define XCAST(fun)   (typeof(ddi7awt.fun))
+#else
+# define XCAST(fun)	(void*)
+#endif
+
+static ICOM_VTABLE(IDirectInput7W) ddi7awt = {
+	ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
+	XCAST(QueryInterface)IDirectInputWImpl_QueryInterface,
+	XCAST(AddRef)IDirectInputAImpl_AddRef,
+	XCAST(Release)IDirectInputAImpl_Release,
+	XCAST(CreateDevice)IDirectInputWImpl_CreateDevice,
+	XCAST(EnumDevices)IDirectInputWImpl_EnumDevices,
+	XCAST(GetDeviceStatus)IDirectInputAImpl_GetDeviceStatus,
+	XCAST(RunControlPanel)IDirectInputAImpl_RunControlPanel,
+	XCAST(Initialize)IDirectInputAImpl_Initialize,
+	XCAST(FindDevice)IDirectInput2WImpl_FindDevice,
+	XCAST(CreateDeviceEx)IDirectInput7WImpl_CreateDeviceEx
 };
 #undef XCAST
 
@@ -356,8 +538,29 @@
 	XCAST(RunControlPanel)IDirectInputAImpl_RunControlPanel,
 	XCAST(Initialize)IDirectInputAImpl_Initialize,
 	XCAST(FindDevice)IDirectInput2AImpl_FindDevice,
-	IDirectInput8AImpl_EnumDevicesBySemantics,
-	IDirectInput8AImpl_ConfigureDevices
+	XCAST(EnumDevicesBySemantics)IDirectInput8AImpl_EnumDevicesBySemantics,
+	XCAST(ConfigureDevices)IDirectInput8AImpl_ConfigureDevices
+};
+#undef XCAST
+
+#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
+# define XCAST(fun)	(typeof(ddi8wvt.fun))
+#else
+# define XCAST(fun)	(void*)
+#endif
+static ICOM_VTABLE(IDirectInput8W) ddi8wvt = {
+	ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
+	XCAST(QueryInterface)IDirectInput8WImpl_QueryInterface,
+	XCAST(AddRef)IDirectInputAImpl_AddRef,
+	XCAST(Release)IDirectInputAImpl_Release,
+	XCAST(CreateDevice)IDirectInputWImpl_CreateDevice,
+	XCAST(EnumDevices)IDirectInputWImpl_EnumDevices,
+	XCAST(GetDeviceStatus)IDirectInputAImpl_GetDeviceStatus,
+	XCAST(RunControlPanel)IDirectInputAImpl_RunControlPanel,
+	XCAST(Initialize)IDirectInputAImpl_Initialize,
+	XCAST(FindDevice)IDirectInput2WImpl_FindDevice,
+	XCAST(EnumDevicesBySemantics)IDirectInput8WImpl_EnumDevicesBySemantics,
+	XCAST(ConfigureDevices)IDirectInput8WImpl_ConfigureDevices
 };
 #undef XCAST
 
@@ -398,7 +601,8 @@
 	if ( IsEqualGUID( &IID_IDirectInputA, riid ) ||
 	     IsEqualGUID( &IID_IDirectInput2A, riid ) ||
 	     IsEqualGUID( &IID_IDirectInput7A, riid ) ||
-	     IsEqualGUID( &IID_IDirectInput8A, riid ) ) {
+	     IsEqualGUID( &IID_IDirectInput8A, riid ) ||
+	     IsEqualGUID( &IID_IDirectInput8W, riid ) ) {
 		/* FIXME: reuse already created dinput if present? */
 		return DirectInputCreateEx(0,0,riid,ppobj,pOuter);
 	}
Index: dlls/dinput/dinput_private.h
===================================================================
RCS file: /home/wine/wine/dlls/dinput/dinput_private.h,v
retrieving revision 1.8
diff -u -r1.8 dinput_private.h
--- dlls/dinput/dinput_private.h	11 Feb 2003 22:10:11 -0000	1.8
+++ dlls/dinput/dinput_private.h	9 Jun 2003 17:29:32 -0000
@@ -23,24 +23,28 @@
 #include "dinput.h"
 
 /* Implementation specification */
-typedef struct IDirectInputAImpl IDirectInputAImpl;
-struct IDirectInputAImpl
+typedef struct IDirectInputImpl IDirectInputImpl;
+struct IDirectInputImpl
 {
    LPVOID lpVtbl;
    DWORD  ref;
 
    /* Used to have an unique sequence number for all the events */
    DWORD evsequence;
+
+   int version;
 };
 
 /* Function called by all devices that Wine supports */
 typedef struct dinput_device {
   INT pref;
-  BOOL (*enum_device)(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi);
-  HRESULT (*create_device)(IDirectInputAImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEA* pdev);
+  BOOL (*enum_deviceA)(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi, int version);
+  BOOL (*enum_deviceW)(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEW lpddi, int version);
+  HRESULT (*create_deviceA)(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEA* pdev);
+  HRESULT (*create_deviceW)(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEW* pdev);
 } dinput_device;
 
-extern void dinput_register_device(dinput_device *device) ;
+extern void dinput_register_device(dinput_device *device);
 
 extern HINSTANCE DINPUT_instance;
 
Index: dlls/dinput/joystick/linux.c
===================================================================
RCS file: /home/wine/wine/dlls/dinput/joystick/linux.c,v
retrieving revision 1.14
diff -u -r1.14 linux.c
--- dlls/dinput/joystick/linux.c	15 Mar 2003 00:12:43 -0000	1.14
+++ dlls/dinput/joystick/linux.c	9 Jun 2003 17:29:33 -0000
@@ -47,6 +47,7 @@
 #define JOYDEV	"/dev/js0"
 
 #include "wine/debug.h"
+#include "wine/unicode.h"
 #include "winbase.h"
 #include "winerror.h"
 #include "windef.h"
@@ -61,16 +62,17 @@
 #define WINE_JOYSTICK_AXIS_BASE   0
 #define WINE_JOYSTICK_BUTTON_BASE 8
 
-typedef struct JoystickAImpl JoystickAImpl;
+typedef struct JoystickImpl JoystickImpl;
 static ICOM_VTABLE(IDirectInputDevice8A) JoystickAvt;
-struct JoystickAImpl
+static ICOM_VTABLE(IDirectInputDevice8W) JoystickWvt;
+struct JoystickImpl
 {
         LPVOID                          lpVtbl;
         DWORD                           ref;
         GUID                            guid;
 
 	/* The 'parent' DInput */
-	IDirectInputAImpl *dinput;
+	IDirectInputImpl               *dinput;
 
 	/* joystick private */
 	int				joyfd;
@@ -89,7 +91,7 @@
   {0x8d, 0x4a, 0x23, 0x90, 0x3f, 0xb6, 0xbd, 0xf7}
 };
 
-static BOOL joydev_enum_device(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi)
+static BOOL joydev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi, int version)
 {
   int fd = -1;
 
@@ -121,11 +123,43 @@
   return FALSE;
 }
 
-static JoystickAImpl *alloc_device(REFGUID rguid, LPVOID jvt, IDirectInputAImpl *dinput)
+static BOOL joydev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEW lpddi, int version)
 {
-  JoystickAImpl* newDevice;
+  int fd = -1;
+
+  if (dwFlags & DIEDFL_FORCEFEEDBACK)
+    return FALSE;
+
+  if ((dwDevType==0) || (GET_DIDEVICE_TYPE(dwDevType)==DIDEVTYPE_JOYSTICK)) {
+    /* check whether we have a joystick */
+    if ((fd = open(JOYDEV,O_RDONLY) != -1) || (errno!=ENODEV && errno!=ENOENT)) {
+      TRACE("Enumerating the linux Joystick device\n");
+
+      /* Return joystick */
+      lpddi->guidInstance	= GUID_Joystick;
+      lpddi->guidProduct	= DInput_Wine_Joystick_GUID;
+      /* we only support traditional joysticks for now */
+      lpddi->dwDevType	= DIDEVTYPE_JOYSTICK |
+	 		 (DIDEVTYPEJOYSTICK_TRADITIONAL<<8);
 
-  newDevice = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(JoystickAImpl));
+      MultiByteToWideChar(CP_ACP, 0, "Joystick", -1, lpddi->tszInstanceName, MAX_PATH);
+      /* ioctl JSIOCGNAME(len) */
+      MultiByteToWideChar(CP_ACP, 0, "Wine Joystick", -1, lpddi->tszProductName, MAX_PATH);
+      lpddi->guidFFDriver = GUID_NULL;
+      if (fd != -1)
+	close(fd);
+      return TRUE;
+    }
+  }
+
+  return FALSE;
+}
+
+static JoystickImpl *alloc_device(REFGUID rguid, LPVOID jvt, IDirectInputImpl *dinput)
+{
+  JoystickImpl* newDevice;
+
+  newDevice = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(JoystickImpl));
   newDevice->lpVtbl = jvt;
   newDevice->ref = 1;
   newDevice->joyfd = -1;
@@ -137,7 +171,7 @@
   return newDevice;
 }
 
-static HRESULT joydev_create_device(IDirectInputAImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEA* pdev)
+static HRESULT joydev_create_deviceA(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEA* pdev)
 {
   if ((IsEqualGUID(&GUID_Joystick,rguid)) ||
       (IsEqualGUID(&DInput_Wine_Joystick_GUID,rguid))) {
@@ -157,10 +191,32 @@
   return DIERR_DEVICENOTREG;
 }
 
+static HRESULT joydev_create_deviceW(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEW* pdev)
+{
+  if ((IsEqualGUID(&GUID_Joystick,rguid)) ||
+      (IsEqualGUID(&DInput_Wine_Joystick_GUID,rguid))) {
+    if ((riid == NULL) ||
+	IsEqualGUID(&IID_IDirectInputDeviceW,riid) ||
+	IsEqualGUID(&IID_IDirectInputDevice2W,riid) ||
+	IsEqualGUID(&IID_IDirectInputDevice7W,riid) ||
+	IsEqualGUID(&IID_IDirectInputDevice8W,riid)) {
+      *pdev = (IDirectInputDeviceW*) alloc_device(rguid, &JoystickWvt, dinput);
+
+      TRACE("Creating a Joystick device (%p)\n", *pdev);
+      return DI_OK;
+    } else
+      return DIERR_NOINTERFACE;
+  }
+
+  return DIERR_DEVICENOTREG;
+}
+
 static dinput_device joydev = {
   10,
-  joydev_enum_device,
-  joydev_create_device
+  joydev_enum_deviceA,
+  joydev_enum_deviceW,
+  joydev_create_deviceA,
+  joydev_create_deviceW
 };
 
 DECL_GLOBAL_CONSTRUCTOR(joydev_register) { dinput_register_device(&joydev); }
@@ -170,7 +226,7 @@
  */
 static ULONG WINAPI JoystickAImpl_Release(LPDIRECTINPUTDEVICE8A iface)
 {
-	ICOM_THIS(JoystickAImpl,iface);
+	ICOM_THIS(JoystickImpl,iface);
 
 	This->ref--;
 	if (This->ref)
@@ -195,7 +251,7 @@
 	LPDIRECTINPUTDEVICE8A iface,LPCDIDATAFORMAT df
 )
 {
-  ICOM_THIS(JoystickAImpl,iface);
+  ICOM_THIS(JoystickImpl,iface);
   int i;
 
   TRACE("(this=%p,%p)\n",This,df);
@@ -227,7 +283,7 @@
   */
 static HRESULT WINAPI JoystickAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
 {
-    ICOM_THIS(JoystickAImpl,iface);
+    ICOM_THIS(JoystickImpl,iface);
 
     TRACE("(this=%p)\n",This);
     if (This->joyfd!=-1)
@@ -243,7 +299,7 @@
   */
 static HRESULT WINAPI JoystickAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface)
 {
-    ICOM_THIS(JoystickAImpl,iface);
+    ICOM_THIS(JoystickImpl,iface);
 
     TRACE("(this=%p)\n",This);
     if (This->joyfd!=-1) {
@@ -255,7 +311,7 @@
 
 #define map_axis(val) ((val+32768)*(This->lMax-This->lMin)/65536+This->lMin)
 
-static void joy_polldev(JoystickAImpl *This) {
+static void joy_polldev(JoystickImpl *This) {
     struct timeval tv;
     fd_set	readfds;
     struct	js_event jse;
@@ -305,7 +361,7 @@
 static HRESULT WINAPI JoystickAImpl_GetDeviceState(
 	LPDIRECTINPUTDEVICE8A iface,DWORD len,LPVOID ptr
 ) {
-    ICOM_THIS(JoystickAImpl,iface);
+    ICOM_THIS(JoystickImpl,iface);
 
     joy_polldev(This);
     TRACE("(this=%p,0x%08lx,%p)\n",This,len,ptr);
@@ -327,7 +383,7 @@
 					      LPDWORD entries,
 					      DWORD flags
 ) {
-  ICOM_THIS(JoystickAImpl,iface);
+  ICOM_THIS(JoystickImpl,iface);
 
   FIXME("(%p)->(dods=%ld,entries=%ld,fl=0x%08lx),STUB!\n",This,dodsize,*entries,flags);
 
@@ -348,7 +404,7 @@
 					    REFGUID rguid,
 					    LPCDIPROPHEADER ph)
 {
-  ICOM_THIS(JoystickAImpl,iface);
+  ICOM_THIS(JoystickImpl,iface);
 
   FIXME("(this=%p,%s,%p)\n",This,debugstr_guid(rguid),ph);
   FIXME("ph.dwSize = %ld, ph.dwHeaderSize =%ld, ph.dwObj = %ld, ph.dwHow= %ld\n",ph->dwSize, ph->dwHeaderSize,ph->dwObj,ph->dwHow);
@@ -390,7 +446,7 @@
 static HRESULT WINAPI JoystickAImpl_SetEventNotification(
 	LPDIRECTINPUTDEVICE8A iface, HANDLE hnd
 ) {
-    ICOM_THIS(JoystickAImpl,iface);
+    ICOM_THIS(JoystickImpl,iface);
 
     TRACE("(this=%p,0x%08lx)\n",This,(DWORD)hnd);
     This->hEvent = hnd;
@@ -401,7 +457,7 @@
 	LPDIRECTINPUTDEVICE8A iface,
 	LPDIDEVCAPS lpDIDevCaps)
 {
-    ICOM_THIS(JoystickAImpl,iface);
+    ICOM_THIS(JoystickImpl,iface);
     BYTE	axes,buttons;
     int		xfd = This->joyfd;
 
@@ -425,7 +481,7 @@
     return DI_OK;
 }
 static HRESULT WINAPI JoystickAImpl_Poll(LPDIRECTINPUTDEVICE8A iface) {
-    ICOM_THIS(JoystickAImpl,iface);
+    ICOM_THIS(JoystickImpl,iface);
     TRACE("(),stub!\n");
 
     joy_polldev(This);
@@ -441,7 +497,7 @@
 	LPVOID lpvRef,
 	DWORD dwFlags)
 {
-  ICOM_THIS(JoystickAImpl,iface);
+  ICOM_THIS(JoystickImpl,iface);
   DIDEVICEOBJECTINSTANCEA ddoi;
   int xfd = This->joyfd;
 
@@ -518,13 +574,32 @@
 }
 
 /******************************************************************************
+  *     EnumObjects : enumerate the different buttons and axis...
+  */
+static HRESULT WINAPI JoystickWImpl_EnumObjects(
+	LPDIRECTINPUTDEVICE8W iface,
+	LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback,
+	LPVOID lpvRef,
+	DWORD dwFlags)
+{
+  ICOM_THIS(JoystickImpl,iface);
+
+  device_enumobjects_AtoWcb_data data;
+
+  data.lpCallBack = lpCallback;
+  data.lpvRef = lpvRef;
+
+  return JoystickAImpl_EnumObjects((LPDIRECTINPUTDEVICE8A) This, (LPDIENUMDEVICEOBJECTSCALLBACKA) DIEnumDevicesCallbackAtoW, (LPVOID) &data, dwFlags);
+}
+
+/******************************************************************************
   *     GetProperty : get input device properties
   */
 static HRESULT WINAPI JoystickAImpl_GetProperty(LPDIRECTINPUTDEVICE8A iface,
 						REFGUID rguid,
 						LPDIPROPHEADER pdiph)
 {
-  ICOM_THIS(JoystickAImpl,iface);
+  ICOM_THIS(JoystickImpl,iface);
 
   TRACE("(this=%p,%s,%p): stub!\n",
 	iface, debugstr_guid(rguid), pdiph);
@@ -601,5 +676,49 @@
 	IDirectInputDevice8AImpl_SetActionMap,
 	IDirectInputDevice8AImpl_GetImageInfo
 };
+
+#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
+# define XCAST(fun)	(typeof(SysJoystickWvt.fun))
+#else
+# define XCAST(fun)	(void*)
+#endif
+
+static ICOM_VTABLE(IDirectInputDevice8W) SysJoystickWvt =
+{
+	ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
+	IDirectInputDevice2WImpl_QueryInterface,
+	XCAST(AddRef)IDirectInputDevice2AImpl_AddRef,
+	XCAST(Release)JoystickAImpl_Release,
+	XCAST(GetCapabilities)JoystickAImpl_GetCapabilities,
+	JoystickWImpl_EnumObjects,
+	XCAST(GetProperty)JoystickAImpl_GetProperty,
+	XCAST(SetProperty)JoystickAImpl_SetProperty,
+	XCAST(Acquire)JoystickAImpl_Acquire,
+	XCAST(Unacquire)JoystickAImpl_Unacquire,
+	XCAST(GetDeviceState)JoystickAImpl_GetDeviceState,
+	XCAST(GetDeviceData)JoystickAImpl_GetDeviceData,
+	XCAST(SetDataFormat)JoystickAImpl_SetDataFormat,
+	XCAST(SetEventNotification)JoystickAImpl_SetEventNotification,
+	XCAST(SetCooperativeLevel)IDirectInputDevice2AImpl_SetCooperativeLevel,
+	IDirectInputDevice2WImpl_GetObjectInfo,
+	IDirectInputDevice2WImpl_GetDeviceInfo,
+	XCAST(RunControlPanel)IDirectInputDevice2AImpl_RunControlPanel,
+	XCAST(Initialize)IDirectInputDevice2AImpl_Initialize,
+	XCAST(CreateEffect)IDirectInputDevice2AImpl_CreateEffect,
+	IDirectInputDevice2WImpl_EnumEffects,
+	IDirectInputDevice2WImpl_GetEffectInfo,
+	XCAST(GetForceFeedbackState)IDirectInputDevice2AImpl_GetForceFeedbackState,
+	XCAST(SendForceFeedbackCommand)IDirectInputDevice2AImpl_SendForceFeedbackCommand,
+	XCAST(EnumCreatedEffectObjects)IDirectInputDevice2AImpl_EnumCreatedEffectObjects,
+	XCAST(Escape)IDirectInputDevice2AImpl_Escape,
+	XCAST(Poll)JoystickAImpl_Poll,
+	XCAST(SendDeviceData)IDirectInputDevice2AImpl_SendDeviceData,
+        IDirectInputDevice7WImpl_EnumEffectsInFile,
+        IDirectInputDevice7WImpl_WriteEffectToFile,
+        IDirectInputDevice8WImpl_BuildActionMap,
+        IDirectInputDevice8WImpl_SetActionMap,
+        IDirectInputDevice8WImpl_GetImageInfo
+};
+#undef XCAST
 
 #endif  /* HAVE_LINUX_22_JOYSTICK_API */
Index: dlls/dinput/joystick/linuxinput.c
===================================================================
RCS file: /home/wine/wine/dlls/dinput/joystick/linuxinput.c,v
retrieving revision 1.14
diff -u -r1.14 linuxinput.c
--- dlls/dinput/joystick/linuxinput.c	15 Mar 2003 00:12:43 -0000	1.14
+++ dlls/dinput/joystick/linuxinput.c	9 Jun 2003 17:29:34 -0000
@@ -53,6 +53,7 @@
 #define EVDEVPREFIX	"/dev/input/event"
 
 #include "wine/debug.h"
+#include "wine/unicode.h"
 #include "winbase.h"
 #include "winerror.h"
 #include "windef.h"
@@ -67,9 +68,10 @@
 #define WINE_JOYSTICK_AXIS_BASE   0
 #define WINE_JOYSTICK_BUTTON_BASE 8
 
-typedef struct JoystickAImpl JoystickAImpl;
+typedef struct JoystickImpl JoystickImpl;
 static ICOM_VTABLE(IDirectInputDevice8A) JoystickAvt;
-struct JoystickAImpl
+static ICOM_VTABLE(IDirectInputDevice8W) JoystickWvt;
+struct JoystickImpl
 {
         LPVOID                          lpVtbl;
         DWORD                           ref;
@@ -77,7 +79,7 @@
 
 
 	/* The 'parent' DInput */
-	IDirectInputAImpl *dinput;
+	IDirectInputImpl               *dinput;
 
 	/* joystick private */
 	/* what range and deadzone the game wants */
@@ -122,15 +124,10 @@
 
 #define test_bit(arr,bit) (((BYTE*)arr)[bit>>3]&(1<<(bit&7)))
 
-static BOOL joydev_enum_device(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi)
+static int joydev_have(void)
 {
-  int i, fd, havejoy = 0;
-
-  if ((dwDevType != 0) && (GET_DIDEVICE_TYPE(dwDevType) != DIDEVTYPE_JOYSTICK))
-      return FALSE;
-
-  if (dwFlags & DIEDFL_FORCEFEEDBACK)
-    return FALSE;
+  int i, fd;
+  int havejoy = 0;
 
   for (i=0;i<64;i++) {
       char	buf[200];
@@ -164,6 +161,20 @@
       if (havejoy || (errno==ENODEV))
 	  break;
   }
+  return havejoy;
+}
+
+static BOOL joydev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi, int version)
+{
+  int havejoy = 0;
+
+  if ((dwDevType != 0) && (GET_DIDEVICE_TYPE(dwDevType) != DIDEVTYPE_JOYSTICK))
+      return FALSE;
+
+  if (dwFlags & DIEDFL_FORCEFEEDBACK)
+    return FALSE;
+
+  havejoy = joydev_have();
 
   if (!havejoy)
       return FALSE;
@@ -175,21 +186,50 @@
   lpddi->guidProduct	= DInput_Wine_Joystick_GUID;
 
   lpddi->guidFFDriver = GUID_NULL;
-  lpddi->dwDevType	= DIDEVTYPE_JOYSTICK |
-		       (DIDEVTYPEJOYSTICK_TRADITIONAL<<8);
+  lpddi->dwDevType    = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_TRADITIONAL<<8);
 
-  strcpy(lpddi->tszInstanceName,	"Joystick");
+  strcpy(lpddi->tszInstanceName, "Joystick");
   /* ioctl JSIOCGNAME(len) */
   strcpy(lpddi->tszProductName,	"Wine Joystick");
   return TRUE;
 }
 
-static JoystickAImpl *alloc_device(REFGUID rguid, LPVOID jvt, IDirectInputAImpl *dinput)
+static BOOL joydev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEW lpddi, int version)
+{
+  int havejoy = 0;
+
+  if ((dwDevType != 0) && (GET_DIDEVICE_TYPE(dwDevType) != DIDEVTYPE_JOYSTICK))
+      return FALSE;
+
+  if (dwFlags & DIEDFL_FORCEFEEDBACK)
+    return FALSE;
+
+  havejoy = joydev_have();
+
+  if (!havejoy)
+      return FALSE;
+
+  TRACE("Enumerating the linuxinput Joystick device\n");
+
+  /* Return joystick */
+  lpddi->guidInstance	= GUID_Joystick;
+  lpddi->guidProduct	= DInput_Wine_Joystick_GUID;
+
+  lpddi->guidFFDriver = GUID_NULL;
+  lpddi->dwDevType    = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_TRADITIONAL<<8);
+
+  MultiByteToWideChar(CP_ACP, 0, "Joystick", -1, lpddi->tszInstanceName, MAX_PATH);
+  /* ioctl JSIOCGNAME(len) */
+  MultiByteToWideChar(CP_ACP, 0, "Wine Joystick", -1, lpddi->tszProductName, MAX_PATH);
+  return TRUE;
+}
+
+static JoystickImpl *alloc_device(REFGUID rguid, LPVOID jvt, IDirectInputImpl *dinput)
 {
-  JoystickAImpl* newDevice;
+  JoystickImpl* newDevice;
   int i;
 
-  newDevice = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(JoystickAImpl));
+  newDevice = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(JoystickImpl));
   newDevice->lpVtbl = jvt;
   newDevice->ref = 1;
   newDevice->joyfd = -1;
@@ -203,42 +243,11 @@
   return newDevice;
 }
 
-static HRESULT joydev_create_device(IDirectInputAImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEA* pdev)
+static HRESULT joydev_create_deviceA(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEA* pdev)
 {
-  int i, fd, havejoy = 0;
+  int havejoy = 0;
 
-  for (i=0;i<64;i++) {
-      char	buf[200];
-      BYTE	absbits[(ABS_MAX+7)/8],keybits[(KEY_MAX+7)/8];
-
-      sprintf(buf,EVDEVPREFIX"%d",i);
-      if (-1!=(fd=open(buf,O_RDONLY))) {
-	  if (-1==ioctl(fd,EVIOCGBIT(EV_ABS,sizeof(absbits)),absbits)) {
-	      perror("EVIOCGBIT EV_ABS");
-	      close(fd);
-	      continue;
-	  }
-	  if (-1==ioctl(fd,EVIOCGBIT(EV_KEY,sizeof(keybits)),keybits)) {
-	      perror("EVIOCGBIT EV_KEY");
-	      close(fd);
-	      continue;
-	  }
-	  /* A true joystick has at least axis X and Y, and at least 1
-	   * button. copied from linux/drivers/input/joydev.c */
-	  if (test_bit(absbits,ABS_X) && test_bit(absbits,ABS_Y) &&
-	      (   test_bit(keybits,BTN_TRIGGER)	||
-		  test_bit(keybits,BTN_A) 	||
-		  test_bit(keybits,BTN_1)
-	      )
-	  ) {
-	      FIXME("found a joystick at %s!\n",buf);
-	      havejoy = 1;
-	  }
-	  close(fd);
-      }
-      if (havejoy || (errno==ENODEV))
-	  break;
-  }
+  havejoy = joydev_have();
 
   if (!havejoy)
       return DIERR_DEVICENOTREG;
@@ -250,7 +259,34 @@
 	IsEqualGUID(&IID_IDirectInputDevice2A,riid) ||
 	IsEqualGUID(&IID_IDirectInputDevice7A,riid) ||
 	IsEqualGUID(&IID_IDirectInputDevice8A,riid)) {
-      *pdev=(IDirectInputDeviceA*) alloc_device(rguid, &JoystickAvt, dinput);
+      *pdev = (IDirectInputDeviceA*) alloc_device(rguid, &JoystickAvt, dinput);
+      TRACE("Creating a Joystick device (%p)\n", *pdev);
+      return DI_OK;
+    } else
+      return DIERR_NOINTERFACE;
+  }
+
+  return DIERR_DEVICENOTREG;
+}
+
+
+static HRESULT joydev_create_deviceW(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEW* pdev)
+{
+  int havejoy = 0;
+
+  havejoy = joydev_have();
+
+  if (!havejoy)
+      return DIERR_DEVICENOTREG;
+
+  if ((IsEqualGUID(&GUID_Joystick,rguid)) ||
+      (IsEqualGUID(&DInput_Wine_Joystick_GUID,rguid))) {
+    if ((riid == NULL) ||
+	IsEqualGUID(&IID_IDirectInputDeviceW,riid) ||
+	IsEqualGUID(&IID_IDirectInputDevice2W,riid) ||
+	IsEqualGUID(&IID_IDirectInputDevice7W,riid) ||
+	IsEqualGUID(&IID_IDirectInputDevice8W,riid)) {
+      *pdev = (IDirectInputDeviceW*) alloc_device(rguid, &JoystickWvt, dinput);
       TRACE("Creating a Joystick device (%p)\n", *pdev);
       return DI_OK;
     } else
@@ -262,8 +298,10 @@
 
 static dinput_device joydev = {
   20,
-  joydev_enum_device,
-  joydev_create_device
+  joydev_enum_deviceA,
+  joydev_enum_deviceW,
+  joydev_create_deviceA,
+  joydev_create_deviceW
 };
 
 DECL_GLOBAL_CONSTRUCTOR(joydev_register) { dinput_register_device(&joydev); }
@@ -273,7 +311,7 @@
  */
 static ULONG WINAPI JoystickAImpl_Release(LPDIRECTINPUTDEVICE8A iface)
 {
-	ICOM_THIS(JoystickAImpl,iface);
+	ICOM_THIS(JoystickImpl,iface);
 
 	This->ref--;
 	if (This->ref)
@@ -298,7 +336,7 @@
 	LPDIRECTINPUTDEVICE8A iface,LPCDIDATAFORMAT df
 )
 {
-  ICOM_THIS(JoystickAImpl,iface);
+  ICOM_THIS(JoystickImpl,iface);
   int i;
 
   TRACE("(this=%p,%p)\n",This,df);
@@ -331,7 +369,7 @@
 static HRESULT WINAPI JoystickAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
 {
     int		i;
-    ICOM_THIS(JoystickAImpl,iface);
+    ICOM_THIS(JoystickImpl,iface);
     char	buf[200];
 
     TRACE("(this=%p)\n",This);
@@ -387,7 +425,7 @@
   */
 static HRESULT WINAPI JoystickAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface)
 {
-    ICOM_THIS(JoystickAImpl,iface);
+    ICOM_THIS(JoystickImpl,iface);
 
     TRACE("(this=%p)\n",This);
     if (This->joyfd!=-1) {
@@ -403,7 +441,7 @@
  * adapts values accordingly.
  */
 static int
-map_axis(JoystickAImpl* This, int axis, int val) {
+map_axis(JoystickImpl* This, int axis, int val) {
     int	xmid = This->axes[axis][AXE_ABS];
     int	xmin = This->axes[axis][AXE_ABSMIN];
     int	xmax = This->axes[axis][AXE_ABSMAX];
@@ -436,7 +474,7 @@
     return ret;
 }
 
-static void joy_polldev(JoystickAImpl *This) {
+static void joy_polldev(JoystickImpl *This) {
     struct timeval tv;
     fd_set	readfds;
     struct	input_event ie;
@@ -515,7 +553,7 @@
 static HRESULT WINAPI JoystickAImpl_GetDeviceState(
 	LPDIRECTINPUTDEVICE8A iface,DWORD len,LPVOID ptr
 ) {
-    ICOM_THIS(JoystickAImpl,iface);
+    ICOM_THIS(JoystickImpl,iface);
 
     joy_polldev(This);
 
@@ -538,7 +576,7 @@
 					      LPDWORD entries,
 					      DWORD flags
 ) {
-  ICOM_THIS(JoystickAImpl,iface);
+  ICOM_THIS(JoystickImpl,iface);
 
   FIXME("(%p)->(dods=%ld,entries=%ld,fl=0x%08lx),STUB!\n",This,dodsize,*entries,flags);
 
@@ -559,7 +597,7 @@
 					    REFGUID rguid,
 					    LPCDIPROPHEADER ph)
 {
-  ICOM_THIS(JoystickAImpl,iface);
+  ICOM_THIS(JoystickImpl,iface);
 
   FIXME("(this=%p,%s,%p)\n",This,debugstr_guid(rguid),ph);
   FIXME("ph.dwSize = %ld, ph.dwHeaderSize =%ld, ph.dwObj = %ld, ph.dwHow= %ld\n",ph->dwSize, ph->dwHeaderSize,ph->dwObj,ph->dwHow);
@@ -612,7 +650,7 @@
 static HRESULT WINAPI JoystickAImpl_SetEventNotification(
 	LPDIRECTINPUTDEVICE8A iface, HANDLE hnd
 ) {
-    ICOM_THIS(JoystickAImpl,iface);
+    ICOM_THIS(JoystickImpl,iface);
 
     TRACE("(this=%p,0x%08lx)\n",This,(DWORD)hnd);
     This->hEvent = hnd;
@@ -623,7 +661,7 @@
 	LPDIRECTINPUTDEVICE8A iface,
 	LPDIDEVCAPS lpDIDevCaps)
 {
-    ICOM_THIS(JoystickAImpl,iface);
+    ICOM_THIS(JoystickImpl,iface);
     int		xfd = This->joyfd;
     int		i,axes,buttons;
     int		wasacquired = 1;
@@ -653,7 +691,7 @@
 }
 
 static HRESULT WINAPI JoystickAImpl_Poll(LPDIRECTINPUTDEVICE8A iface) {
-    ICOM_THIS(JoystickAImpl,iface);
+    ICOM_THIS(JoystickImpl,iface);
     TRACE("(),stub!\n");
 
     joy_polldev(This);
@@ -669,7 +707,7 @@
 	LPVOID lpvRef,
 	DWORD dwFlags)
 {
-  ICOM_THIS(JoystickAImpl,iface);
+  ICOM_THIS(JoystickImpl,iface);
   DIDEVICEOBJECTINSTANCEA ddoi;
   int xfd = This->joyfd;
 
@@ -825,6 +863,21 @@
   return DI_OK;
 }
 
+static HRESULT WINAPI JoystickWImpl_EnumObjects(LPDIRECTINPUTDEVICE8W iface,
+						LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback,
+						LPVOID lpvRef,
+						DWORD dwFlags)
+{
+  ICOM_THIS(JoystickImpl,iface);
+
+  device_enumobjects_AtoWcb_data data;
+
+  data.lpCallBack = lpCallback;
+  data.lpvRef = lpvRef;
+
+  return JoystickAImpl_EnumObjects((LPDIRECTINPUTDEVICE8A) This, (LPDIENUMDEVICEOBJECTSCALLBACKA) DIEnumDevicesCallbackAtoW, (LPVOID) &data, dwFlags);
+}
+
 /******************************************************************************
   *     GetProperty : get input device properties
   */
@@ -832,7 +885,7 @@
 						REFGUID rguid,
 						LPDIPROPHEADER pdiph)
 {
-  ICOM_THIS(JoystickAImpl,iface);
+  ICOM_THIS(JoystickImpl,iface);
 
   TRACE("(this=%p,%s,%p): stub!\n",
 	iface, debugstr_guid(rguid), pdiph);
@@ -907,6 +960,50 @@
         IDirectInputDevice8AImpl_SetActionMap,
         IDirectInputDevice8AImpl_GetImageInfo
 };
+
+#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
+# define XCAST(fun)	(typeof(JoystickWvt.fun))
+#else
+# define XCAST(fun)	(void*)
+#endif
+
+static ICOM_VTABLE(IDirectInputDevice8W) JoystickWvt =
+{
+	ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
+	IDirectInputDevice2WImpl_QueryInterface,
+	XCAST(AddRef)IDirectInputDevice2AImpl_AddRef,
+	XCAST(Release)JoystickAImpl_Release,
+	XCAST(GetCapabilities)JoystickAImpl_GetCapabilities,
+	JoystickWImpl_EnumObjects,
+	XCAST(GetProperty)JoystickAImpl_GetProperty,
+	XCAST(SetProperty)JoystickAImpl_SetProperty,
+	XCAST(Acquire)JoystickAImpl_Acquire,
+	XCAST(Unacquire)JoystickAImpl_Unacquire,
+	XCAST(GetDeviceState)JoystickAImpl_GetDeviceState,
+	XCAST(GetDeviceData)JoystickAImpl_GetDeviceData,
+	XCAST(SetDataFormat)JoystickAImpl_SetDataFormat,
+	XCAST(SetEventNotification)JoystickAImpl_SetEventNotification,
+	XCAST(SetCooperativeLevel)IDirectInputDevice2AImpl_SetCooperativeLevel,
+	IDirectInputDevice2WImpl_GetObjectInfo,
+	IDirectInputDevice2WImpl_GetDeviceInfo,
+	XCAST(RunControlPanel)IDirectInputDevice2AImpl_RunControlPanel,
+	XCAST(Initialize)IDirectInputDevice2AImpl_Initialize,
+	XCAST(CreateEffect)IDirectInputDevice2AImpl_CreateEffect,
+	IDirectInputDevice2WImpl_EnumEffects,
+	IDirectInputDevice2WImpl_GetEffectInfo,
+	XCAST(GetForceFeedbackState)IDirectInputDevice2AImpl_GetForceFeedbackState,
+	XCAST(SendForceFeedbackCommand)IDirectInputDevice2AImpl_SendForceFeedbackCommand,
+	XCAST(EnumCreatedEffectObjects)IDirectInputDevice2AImpl_EnumCreatedEffectObjects,
+	XCAST(Escape)IDirectInputDevice2AImpl_Escape,
+	XCAST(Poll)JoystickAImpl_Poll,
+	XCAST(SendDeviceData)IDirectInputDevice2AImpl_SendDeviceData,
+        IDirectInputDevice7WImpl_EnumEffectsInFile,
+        IDirectInputDevice7WImpl_WriteEffectToFile,
+        IDirectInputDevice8WImpl_BuildActionMap,
+        IDirectInputDevice8WImpl_SetActionMap,
+        IDirectInputDevice8WImpl_GetImageInfo
+};
+#undef XCAST
 
 #endif  /* HAVE_LINUX_INPUT_H */
 
Index: dlls/dinput/keyboard/main.c
===================================================================
RCS file: /home/wine/wine/dlls/dinput/keyboard/main.c,v
retrieving revision 1.23
diff -u -r1.23 main.c
--- dlls/dinput/keyboard/main.c	4 Jun 2003 20:11:56 -0000	1.23
+++ dlls/dinput/keyboard/main.c	9 Jun 2003 17:29:36 -0000
@@ -31,19 +31,21 @@
 #include "dinput_private.h"
 #include "device_private.h"
 #include "wine/debug.h"
+#include "wine/unicode.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(dinput);
 
 static ICOM_VTABLE(IDirectInputDevice8A) SysKeyboardAvt;
+static ICOM_VTABLE(IDirectInputDevice8W) SysKeyboardWvt;
 
-typedef struct SysKeyboardAImpl SysKeyboardAImpl;
-struct SysKeyboardAImpl
+typedef struct SysKeyboardImpl SysKeyboardImpl;
+struct SysKeyboardImpl
 {
         LPVOID                          lpVtbl;
         DWORD                           ref;
         GUID                            guid;
 
-	IDirectInputAImpl *dinput;
+	IDirectInputImpl*               dinput;
 
 	HANDLE	hEvent;
         /* SysKeyboardAImpl */
@@ -61,7 +63,7 @@
         CRITICAL_SECTION                crit;
 };
 
-SysKeyboardAImpl *current; /* Today's acquired device
+SysKeyboardImpl *current; /* Today's acquired device
 FIXME: currently this can be only one.
 Maybe this should be a linked list or st.
 I don't know what the rules are for multiple acquired keyboards,
@@ -117,7 +119,7 @@
 
               if (current->count == current->buffersize)
                 {
-                  current->start++;
+                  current->start = ++current->start % current->buffersize;
                   current->overflow = TRUE;
                 }
               else
@@ -138,7 +140,7 @@
   {0x8c, 0x73, 0x71, 0xdf, 0x54, 0xa9, 0x64, 0x41}
 };
 
-static void fill_keyboard_dideviceinstancea(LPDIDEVICEINSTANCEA lpddi) {
+static void fill_keyboard_dideviceinstanceA(LPDIDEVICEINSTANCEA lpddi, int version) {
     DWORD dwSize;
     DIDEVICEINSTANCEA ddi;
     
@@ -152,19 +154,63 @@
     ddi.dwSize = dwSize;
     ddi.guidInstance = GUID_SysKeyboard;/* DInput's GUID */
     ddi.guidProduct = DInput_Wine_Keyboard_GUID; /* Vendor's GUID */
-    ddi.dwDevType = DIDEVTYPE_KEYBOARD | (DIDEVTYPEKEYBOARD_UNKNOWN << 8);
+    if (version >= 8)
+        ddi.dwDevType = DI8DEVTYPE_KEYBOARD | (DI8DEVTYPEKEYBOARD_UNKNOWN << 8);
+    else
+        ddi.dwDevType = DIDEVTYPE_KEYBOARD | (DIDEVTYPEKEYBOARD_UNKNOWN << 8);
     strcpy(ddi.tszInstanceName, "Keyboard");
     strcpy(ddi.tszProductName, "Wine Keyboard");
 
     memcpy(lpddi, &ddi, (dwSize < sizeof(ddi) ? dwSize : sizeof(ddi)));
 }
 
-static BOOL keyboarddev_enum_device(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi)
+static void fill_keyboard_dideviceinstanceW(LPDIDEVICEINSTANCEW lpddi, int version) {
+    DWORD dwSize;
+    DIDEVICEINSTANCEW ddi;
+    
+    dwSize = lpddi->dwSize;
+
+    TRACE("%ld %p\n", dwSize, lpddi);
+    
+    memset(lpddi, 0, dwSize);
+    memset(&ddi, 0, sizeof(ddi));
+
+    ddi.dwSize = dwSize;
+    ddi.guidInstance = GUID_SysKeyboard;/* DInput's GUID */
+    ddi.guidProduct = DInput_Wine_Keyboard_GUID; /* Vendor's GUID */
+    if (version >= 8)
+        ddi.dwDevType = DI8DEVTYPE_KEYBOARD | (DI8DEVTYPEKEYBOARD_UNKNOWN << 8);
+    else
+        ddi.dwDevType = DIDEVTYPE_KEYBOARD | (DIDEVTYPEKEYBOARD_UNKNOWN << 8);
+    MultiByteToWideChar(CP_ACP, 0, "Keyboard", -1, ddi.tszInstanceName, MAX_PATH);
+    MultiByteToWideChar(CP_ACP, 0, "Wine Keyboard", -1, ddi.tszProductName, MAX_PATH);
+
+    memcpy(lpddi, &ddi, (dwSize < sizeof(ddi) ? dwSize : sizeof(ddi)));
+}
+
+static BOOL keyboarddev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi, int version)
+{
+  if ((dwDevType == 0) ||
+      ((dwDevType == DIDEVTYPE_KEYBOARD) && (version < 8)) ||
+      ((dwDevType == DI8DEVTYPE_KEYBOARD) && (version >= 8))) {
+    TRACE("Enumerating the Keyboard device\n");
+
+    fill_keyboard_dideviceinstanceA(lpddi, version);
+    
+    return TRUE;
+  }
+
+  return FALSE;
+}
+
+static BOOL keyboarddev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEW lpddi, int version)
 {
-  if ((dwDevType == 0) || (dwDevType == DIDEVTYPE_KEYBOARD)) {
+  if ((dwDevType == 0) ||
+      ((dwDevType == DIDEVTYPE_KEYBOARD) && (version < 8)) ||
+      ((dwDevType == DI8DEVTYPE_KEYBOARD) && (version >= 8))) {
     TRACE("Enumerating the Keyboard device\n");
 
-    fill_keyboard_dideviceinstancea(lpddi);
+    fill_keyboard_dideviceinstanceW(lpddi, version);
     
     return TRUE;
   }
@@ -172,10 +218,10 @@
   return FALSE;
 }
 
-static SysKeyboardAImpl *alloc_device(REFGUID rguid, LPVOID kvt, IDirectInputAImpl *dinput)
+static SysKeyboardImpl *alloc_device(REFGUID rguid, LPVOID kvt, IDirectInputImpl *dinput)
 {
-    SysKeyboardAImpl* newDevice;
-    newDevice = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(SysKeyboardAImpl));
+    SysKeyboardImpl* newDevice;
+    newDevice = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(SysKeyboardImpl));
     newDevice->lpVtbl = kvt;
     newDevice->ref = 1;
     memcpy(&(newDevice->guid),rguid,sizeof(*rguid));
@@ -190,7 +236,7 @@
 }
 
 
-static HRESULT keyboarddev_create_device(IDirectInputAImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEA* pdev)
+static HRESULT keyboarddev_create_deviceA(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEA* pdev)
 {
   if ((IsEqualGUID(&GUID_SysKeyboard,rguid)) ||          /* Generic Keyboard */
       (IsEqualGUID(&DInput_Wine_Keyboard_GUID,rguid))) { /* Wine Keyboard */
@@ -199,27 +245,46 @@
 	IsEqualGUID(&IID_IDirectInputDevice2A,riid) ||
 	IsEqualGUID(&IID_IDirectInputDevice7A,riid) ||
 	IsEqualGUID(&IID_IDirectInputDevice8A,riid)) {
-      *pdev=(IDirectInputDeviceA*) alloc_device(rguid, &SysKeyboardAvt, dinput);
+      *pdev = (IDirectInputDeviceA*) alloc_device(rguid, &SysKeyboardAvt, dinput);
       TRACE("Creating a Keyboard device (%p)\n", *pdev);
       return DI_OK;
     } else
       return DIERR_NOINTERFACE;
   }
+  return DIERR_DEVICENOTREG;
+}
 
+static HRESULT keyboarddev_create_deviceW(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEW* pdev)
+{
+  if ((IsEqualGUID(&GUID_SysKeyboard,rguid)) ||          /* Generic Keyboard */
+      (IsEqualGUID(&DInput_Wine_Keyboard_GUID,rguid))) { /* Wine Keyboard */
+    if ((riid == NULL) ||
+	IsEqualGUID(&IID_IDirectInputDeviceW,riid) ||
+	IsEqualGUID(&IID_IDirectInputDevice2W,riid) ||
+	IsEqualGUID(&IID_IDirectInputDevice7W,riid) ||
+	IsEqualGUID(&IID_IDirectInputDevice8W,riid)) {
+      *pdev = (IDirectInputDeviceW*) alloc_device(rguid, &SysKeyboardWvt, dinput);
+      TRACE("Creating a Keyboard device (%p)\n", *pdev);
+      return DI_OK;
+    } else
+      return DIERR_NOINTERFACE;
+  }
   return DIERR_DEVICENOTREG;
 }
 
 static dinput_device keyboarddev = {
   100,
-  keyboarddev_enum_device,
-  keyboarddev_create_device
+  keyboarddev_enum_deviceA,
+  keyboarddev_enum_deviceW,
+  keyboarddev_create_deviceA,
+  keyboarddev_create_deviceW
 };
 
 DECL_GLOBAL_CONSTRUCTOR(keyboarddev_register) { dinput_register_device(&keyboarddev); }
 
 static ULONG WINAPI SysKeyboardAImpl_Release(LPDIRECTINPUTDEVICE8A iface)
 {
-	ICOM_THIS(SysKeyboardAImpl,iface);
+	ICOM_THIS(SysKeyboardImpl,iface);
 
 	This->ref--;
 	if (This->ref)
@@ -239,14 +304,14 @@
 	DeleteCriticalSection(&(This->crit));
 
 	HeapFree(GetProcessHeap(),0,This);
-	return 0;
+	return DI_OK;
 }
 
 static HRESULT WINAPI SysKeyboardAImpl_SetProperty(
 	LPDIRECTINPUTDEVICE8A iface,REFGUID rguid,LPCDIPROPHEADER ph
 )
 {
-	ICOM_THIS(SysKeyboardAImpl,iface);
+	ICOM_THIS(SysKeyboardImpl,iface);
 
 	TRACE("(this=%p,%s,%p)\n",This,debugstr_guid(rguid),ph);
 	TRACE("(size=%ld,headersize=%ld,obj=%ld,how=%ld\n",
@@ -270,13 +335,15 @@
 			break;
 		}
 	}
-	return 0;
+	return DI_OK;
 }
 
 static HRESULT WINAPI SysKeyboardAImpl_GetDeviceState(
 	LPDIRECTINPUTDEVICE8A iface,DWORD len,LPVOID ptr
 )
 {
+    TRACE("(%p)->(%ld,%p)\n", iface, len, ptr);
+
     /* Note: device does not need to be acquired */
     if (len != 256)
       return DIERR_INVALIDPARAM;
@@ -292,7 +359,7 @@
 	LPDWORD entries,DWORD flags
 )
 {
-	ICOM_THIS(SysKeyboardAImpl,iface);
+	ICOM_THIS(SysKeyboardImpl,iface);
 	int ret = DI_OK, i = 0;
 
 	TRACE("(this=%p,%ld,%p,%p(%ld)),0x%08lx)\n",
@@ -353,7 +420,7 @@
 	LPVOID lpvRef,
 	DWORD dwFlags)
 {
-    ICOM_THIS(SysKeyboardAImpl,iface);
+    ICOM_THIS(SysKeyboardImpl,iface);
     DIDEVICEOBJECTINSTANCEA ddoi;
     int i;
     
@@ -381,11 +448,26 @@
     return DI_OK;
 }
 
+static HRESULT WINAPI SysKeyboardWImpl_EnumObjects(LPDIRECTINPUTDEVICE8W iface,
+						   LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback,
+						   LPVOID lpvRef,
+						   DWORD dwFlags)
+{
+  ICOM_THIS(SysKeyboardImpl,iface);
+
+  device_enumobjects_AtoWcb_data data;
+
+  data.lpCallBack = lpCallback;
+  data.lpvRef = lpvRef;
+
+  return SysKeyboardAImpl_EnumObjects((LPDIRECTINPUTDEVICE8A) This, (LPDIENUMDEVICEOBJECTSCALLBACKA) DIEnumDevicesCallbackAtoW, (LPVOID) &data, dwFlags);
+}
+
 static HRESULT WINAPI SysKeyboardAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface);
 
 static HRESULT WINAPI SysKeyboardAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
 {
-	ICOM_THIS(SysKeyboardAImpl,iface);
+	ICOM_THIS(SysKeyboardImpl,iface);
 
 	TRACE("(this=%p)\n",This);
 
@@ -419,7 +501,7 @@
 
 static HRESULT WINAPI SysKeyboardAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface)
 {
-	ICOM_THIS(SysKeyboardAImpl,iface);
+	ICOM_THIS(SysKeyboardImpl,iface);
 	TRACE("(this=%p)\n",This);
 
         if (This->acquired == 0)
@@ -444,7 +526,7 @@
 
 static HRESULT WINAPI SysKeyboardAImpl_SetEventNotification(LPDIRECTINPUTDEVICE8A iface,
 							    HANDLE hnd) {
-  ICOM_THIS(SysKeyboardAImpl,iface);
+  ICOM_THIS(SysKeyboardImpl,iface);
 
   TRACE("(this=%p,0x%08lx)\n",This,(DWORD)hnd);
 
@@ -459,13 +541,16 @@
 	LPDIRECTINPUTDEVICE8A iface,
 	LPDIDEVCAPS lpDIDevCaps)
 {
-  ICOM_THIS(SysKeyboardAImpl,iface);
+  ICOM_THIS(SysKeyboardImpl,iface);
 
   TRACE("(this=%p,%p)\n",This,lpDIDevCaps);
 
   if (lpDIDevCaps->dwSize == sizeof(DIDEVCAPS)) {
     lpDIDevCaps->dwFlags = DIDC_ATTACHED;
-    lpDIDevCaps->dwDevType = DIDEVTYPE_KEYBOARD;
+    if (This->dinput->version >= 8)
+        lpDIDevCaps->dwDevType = DI8DEVTYPE_KEYBOARD | (DI8DEVTYPEKEYBOARD_UNKNOWN << 8);
+    else
+        lpDIDevCaps->dwDevType = DIDEVTYPE_KEYBOARD | (DIDEVTYPEKEYBOARD_UNKNOWN << 8);
     lpDIDevCaps->dwAxes = 0;
     lpDIDevCaps->dwButtons = 256;
     lpDIDevCaps->dwPOVs = 0;
@@ -493,7 +578,7 @@
 	DWORD dwObj,
 	DWORD dwHow)
 {
-    ICOM_THIS(SysKeyboardAImpl,iface);
+    ICOM_THIS(SysKeyboardImpl,iface);
     DIDEVICEOBJECTINSTANCEA ddoi;
     DWORD dwSize = pdidoi->dwSize;
     
@@ -521,6 +606,39 @@
     return DI_OK;
 }
 
+static HRESULT WINAPI SysKeyboardWImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface,
+						     LPDIDEVICEOBJECTINSTANCEW pdidoi,
+						     DWORD dwObj,
+						     DWORD dwHow)
+{
+    ICOM_THIS(SysKeyboardImpl,iface);
+    DIDEVICEOBJECTINSTANCEW ddoi;
+    DWORD dwSize = pdidoi->dwSize;
+    
+    TRACE("(this=%p,%p,%ld,0x%08lx)\n", This, pdidoi, dwObj, dwHow);
+
+    if (dwHow == DIPH_BYID) {
+        WARN(" querying by id not supported yet...\n");
+	return DI_OK;
+    }
+
+    memset(pdidoi, 0, dwSize);
+    memset(&ddoi, 0, sizeof(ddoi));
+
+    ddoi.dwSize = dwSize;
+    ddoi.guidType = GUID_Key;
+    ddoi.dwOfs = dwObj;
+    ddoi.dwType = DIDFT_MAKEINSTANCE(dwObj) | DIDFT_BUTTON;
+    GetKeyNameTextW(((dwObj & 0x7f) << 16) | ((dwObj & 0x80) << 17), ddoi.tszName, sizeof(ddoi.tszName));
+
+    /* And return our just filled device object instance structure */
+    memcpy(pdidoi, &ddoi, (dwSize < sizeof(ddoi) ? dwSize : sizeof(ddoi)));
+    
+    _dump_OBJECTINSTANCEW(pdidoi);
+
+    return DI_OK;
+}
+
 /******************************************************************************
   *     GetDeviceInfo : get information about a device's identity
   */
@@ -528,7 +646,7 @@
 	LPDIRECTINPUTDEVICE8A iface,
 	LPDIDEVICEINSTANCEA pdidi)
 {
-    ICOM_THIS(SysKeyboardAImpl,iface);
+    ICOM_THIS(SysKeyboardImpl,iface);
     TRACE("(this=%p,%p)\n", This, pdidi);
 
     if (pdidi->dwSize != sizeof(DIDEVICEINSTANCEA)) {
@@ -536,7 +654,22 @@
 	return DI_OK;
     }
 
-    fill_keyboard_dideviceinstancea(pdidi);
+    fill_keyboard_dideviceinstanceA(pdidi, This->dinput->version);
+    
+    return DI_OK;
+}
+
+static HRESULT WINAPI SysKeyboardWImpl_GetDeviceInfo(LPDIRECTINPUTDEVICE8W iface, LPDIDEVICEINSTANCEW pdidi) 
+{
+    ICOM_THIS(SysKeyboardImpl,iface);
+    TRACE("(this=%p,%p)\n", This, pdidi);
+
+    if (pdidi->dwSize != sizeof(DIDEVICEINSTANCEW)) {
+        WARN(" dinput3 not supporte yet...\n");
+	return DI_OK;
+    }
+
+    fill_keyboard_dideviceinstanceW(pdidi, This->dinput->version);
     
     return DI_OK;
 }
@@ -578,3 +711,47 @@
         IDirectInputDevice8AImpl_SetActionMap,
         IDirectInputDevice8AImpl_GetImageInfo
 };
+
+#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
+# define XCAST(fun)	(typeof(SysKeyboardWvt.fun))
+#else
+# define XCAST(fun)	(void*)
+#endif
+
+static ICOM_VTABLE(IDirectInputDevice8W) SysKeyboardWvt =
+{
+	ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
+	IDirectInputDevice2WImpl_QueryInterface,
+	XCAST(AddRef)IDirectInputDevice2AImpl_AddRef,
+	XCAST(Release)SysKeyboardAImpl_Release,
+	XCAST(GetCapabilities)SysKeyboardAImpl_GetCapabilities,
+	SysKeyboardWImpl_EnumObjects,
+	XCAST(GetProperty)IDirectInputDevice2AImpl_GetProperty,
+	XCAST(SetProperty)SysKeyboardAImpl_SetProperty,
+	XCAST(Acquire)SysKeyboardAImpl_Acquire,
+	XCAST(Unacquire)SysKeyboardAImpl_Unacquire,
+	XCAST(GetDeviceState)SysKeyboardAImpl_GetDeviceState,
+	XCAST(GetDeviceData)SysKeyboardAImpl_GetDeviceData,
+	XCAST(SetDataFormat)IDirectInputDevice2AImpl_SetDataFormat,
+	XCAST(SetEventNotification)SysKeyboardAImpl_SetEventNotification,
+	XCAST(SetCooperativeLevel)IDirectInputDevice2AImpl_SetCooperativeLevel,
+	SysKeyboardWImpl_GetObjectInfo,
+	SysKeyboardWImpl_GetDeviceInfo,
+	XCAST(RunControlPanel)IDirectInputDevice2AImpl_RunControlPanel,
+	XCAST(Initialize)IDirectInputDevice2AImpl_Initialize,
+	XCAST(CreateEffect)IDirectInputDevice2AImpl_CreateEffect,
+	IDirectInputDevice2WImpl_EnumEffects,
+	IDirectInputDevice2WImpl_GetEffectInfo,
+	XCAST(GetForceFeedbackState)IDirectInputDevice2AImpl_GetForceFeedbackState,
+	XCAST(SendForceFeedbackCommand)IDirectInputDevice2AImpl_SendForceFeedbackCommand,
+	XCAST(EnumCreatedEffectObjects)IDirectInputDevice2AImpl_EnumCreatedEffectObjects,
+	XCAST(Escape)IDirectInputDevice2AImpl_Escape,
+	XCAST(Poll)IDirectInputDevice2AImpl_Poll,
+        XCAST(SendDeviceData)IDirectInputDevice2AImpl_SendDeviceData,
+        IDirectInputDevice7WImpl_EnumEffectsInFile,
+        IDirectInputDevice7WImpl_WriteEffectToFile,
+        IDirectInputDevice8WImpl_BuildActionMap,
+        IDirectInputDevice8WImpl_SetActionMap,
+        IDirectInputDevice8WImpl_GetImageInfo
+};
+#undef XCAST
Index: dlls/dinput/mouse/main.c
===================================================================
RCS file: /home/wine/wine/dlls/dinput/mouse/main.c,v
retrieving revision 1.22
diff -u -r1.22 main.c
--- dlls/dinput/mouse/main.c	7 Jun 2003 00:36:51 -0000	1.22
+++ dlls/dinput/mouse/main.c	9 Jun 2003 17:29:38 -0000
@@ -33,6 +33,7 @@
 #include "dinput_private.h"
 #include "device_private.h"
 #include "wine/debug.h"
+#include "wine/unicode.h"
 
 #define MOUSE_HACK
 
@@ -92,7 +93,9 @@
 };
 
 static ICOM_VTABLE(IDirectInputDevice8A) SysMouseAvt;
-typedef struct SysMouseAImpl SysMouseAImpl;
+static ICOM_VTABLE(IDirectInputDevice8W) SysMouseWvt;
+
+typedef struct SysMouseImpl SysMouseImpl;
 
 typedef enum {
   WARP_NEEDED,  /* Warping is needed */
@@ -100,13 +103,13 @@
   WARP_DONE     /* Warping has been done */
 } WARP_STATUS;
 
-struct SysMouseAImpl
+struct SysMouseImpl
 {
         LPVOID                          lpVtbl;
         DWORD                           ref;
         GUID                            guid;
 
-	IDirectInputAImpl *dinput;
+	IDirectInputImpl               *dinput;
 
 	/* The current data format and the conversion between internal
 	   and external data formats */
@@ -146,7 +149,7 @@
   {0x8d, 0x4a, 0x23, 0x90, 0x3f, 0xb6, 0xbd, 0xf7}
 };
 
-static void fill_mouse_dideviceinstancea(LPDIDEVICEINSTANCEA lpddi) {
+static void fill_mouse_dideviceinstanceA(LPDIDEVICEINSTANCEA lpddi, int version) {
     DWORD dwSize;
     DIDEVICEINSTANCEA ddi;
     
@@ -160,19 +163,48 @@
     ddi.dwSize = dwSize;
     ddi.guidInstance = GUID_SysMouse;/* DInput's GUID */
     ddi.guidProduct = DInput_Wine_Mouse_GUID; /* Vendor's GUID */
-    ddi.dwDevType = DIDEVTYPE_MOUSE | (DIDEVTYPEMOUSE_UNKNOWN << 8);
+    if (version >= 8)
+        ddi.dwDevType = DI8DEVTYPE_MOUSE | (DI8DEVTYPEMOUSE_TRADITIONAL << 8);
+    else
+        ddi.dwDevType = DIDEVTYPE_MOUSE | (DIDEVTYPEMOUSE_TRADITIONAL << 8);
     strcpy(ddi.tszInstanceName, "Mouse");
     strcpy(ddi.tszProductName, "Wine Mouse");
 
     memcpy(lpddi, &ddi, (dwSize < sizeof(ddi) ? dwSize : sizeof(ddi)));
 }
 
-static BOOL mousedev_enum_device(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi)
+static void fill_mouse_dideviceinstanceW(LPDIDEVICEINSTANCEW lpddi, int version) {
+    DWORD dwSize;
+    DIDEVICEINSTANCEW ddi;
+    
+    dwSize = lpddi->dwSize;
+
+    TRACE("%ld %p\n", dwSize, lpddi);
+    
+    memset(lpddi, 0, dwSize);
+    memset(&ddi, 0, sizeof(ddi));
+
+    ddi.dwSize = dwSize;
+    ddi.guidInstance = GUID_SysMouse;/* DInput's GUID */
+    ddi.guidProduct = DInput_Wine_Mouse_GUID; /* Vendor's GUID */
+    if (version >= 8)
+        ddi.dwDevType = DI8DEVTYPE_MOUSE | (DI8DEVTYPEMOUSE_TRADITIONAL << 8);
+    else
+        ddi.dwDevType = DIDEVTYPE_MOUSE | (DIDEVTYPEMOUSE_TRADITIONAL << 8);
+    MultiByteToWideChar(CP_ACP, 0, "Mouse", -1, ddi.tszInstanceName, MAX_PATH);
+    MultiByteToWideChar(CP_ACP, 0, "Wine Mouse", -1, ddi.tszProductName, MAX_PATH);
+
+    memcpy(lpddi, &ddi, (dwSize < sizeof(ddi) ? dwSize : sizeof(ddi)));
+}
+
+static BOOL mousedev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi, int version)
 {
-  if ((dwDevType == 0) || (dwDevType == DIDEVTYPE_MOUSE)) {
+  if ((dwDevType == 0) ||
+      ((dwDevType == DIDEVTYPE_MOUSE) && (version < 8)) ||
+      ((dwDevType == DI8DEVTYPE_MOUSE) && (version >= 8))) {
     TRACE("Enumerating the mouse device\n");
 
-    fill_mouse_dideviceinstancea(lpddi);
+    fill_mouse_dideviceinstanceA(lpddi, version);
 
     return TRUE;
   }
@@ -180,7 +212,22 @@
   return FALSE;
 }
 
-static SysMouseAImpl *alloc_device(REFGUID rguid, LPVOID mvt, IDirectInputAImpl *dinput)
+static BOOL mousedev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEW lpddi, int version)
+{
+  if ((dwDevType == 0) ||
+      ((dwDevType == DIDEVTYPE_MOUSE) && (version < 8)) ||
+      ((dwDevType == DI8DEVTYPE_MOUSE) && (version >= 8))) {
+    TRACE("Enumerating the mouse device\n");
+
+    fill_mouse_dideviceinstanceW(lpddi, version);
+
+    return TRUE;
+  }
+
+  return FALSE;
+}
+
+static SysMouseImpl *alloc_device(REFGUID rguid, LPVOID mvt, IDirectInputImpl *dinput)
 {
     int offset_array[WINE_INTERNALMOUSE_NUM_OBJS] = {
       FIELD_OFFSET(Wine_InternalMouseData, lX),
@@ -190,8 +237,8 @@
       FIELD_OFFSET(Wine_InternalMouseData, rgbButtons) + 1,
       FIELD_OFFSET(Wine_InternalMouseData, rgbButtons) + 2
     };
-    SysMouseAImpl* newDevice;
-    newDevice = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(SysMouseAImpl));
+    SysMouseImpl* newDevice;
+    newDevice = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(SysMouseImpl));
     newDevice->ref = 1;
     newDevice->lpVtbl = mvt;
     InitializeCriticalSection(&(newDevice->crit));
@@ -209,7 +256,7 @@
     return newDevice;
 }
 
-static HRESULT mousedev_create_device(IDirectInputAImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEA* pdev)
+static HRESULT mousedev_create_deviceA(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEA* pdev)
 {
   if ((IsEqualGUID(&GUID_SysMouse,rguid)) ||             /* Generic Mouse */
       (IsEqualGUID(&DInput_Wine_Mouse_GUID,rguid))) { /* Wine Mouse */
@@ -218,7 +265,7 @@
 	IsEqualGUID(&IID_IDirectInputDevice2A,riid) ||
 	IsEqualGUID(&IID_IDirectInputDevice7A,riid) ||
 	IsEqualGUID(&IID_IDirectInputDevice8A,riid)) {
-      *pdev=(IDirectInputDeviceA*) alloc_device(rguid, &SysMouseAvt, dinput);
+      *pdev = (IDirectInputDeviceA*) alloc_device(rguid, &SysMouseAvt, dinput);
       TRACE("Creating a Mouse device (%p)\n", *pdev);
       return DI_OK;
     } else
@@ -228,10 +275,30 @@
   return DIERR_DEVICENOTREG;
 }
 
+static HRESULT mousedev_create_deviceW(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEW* pdev)
+{
+  if ((IsEqualGUID(&GUID_SysMouse,rguid)) ||             /* Generic Mouse */
+      (IsEqualGUID(&DInput_Wine_Mouse_GUID,rguid))) { /* Wine Mouse */
+    if ((riid == NULL) ||
+	IsEqualGUID(&IID_IDirectInputDeviceW,riid) ||
+	IsEqualGUID(&IID_IDirectInputDevice2W,riid) ||
+	IsEqualGUID(&IID_IDirectInputDevice7W,riid) ||
+	IsEqualGUID(&IID_IDirectInputDevice8W,riid)) {
+      *pdev = (IDirectInputDeviceW*) alloc_device(rguid, &SysMouseWvt, dinput);
+      TRACE("Creating a Mouse device (%p)\n", *pdev);
+      return DI_OK;
+    } else
+      return DIERR_NOINTERFACE;
+  }
+
+  return DIERR_DEVICENOTREG;
+}
 static dinput_device mousedev = {
   100,
-  mousedev_enum_device,
-  mousedev_create_device
+  mousedev_enum_deviceA,
+  mousedev_enum_deviceW,
+  mousedev_create_deviceA,
+  mousedev_create_deviceW
 };
 
 DECL_GLOBAL_CONSTRUCTOR(mousedev_register) { dinput_register_device(&mousedev); }
@@ -245,7 +312,7 @@
   */
 static ULONG WINAPI SysMouseAImpl_Release(LPDIRECTINPUTDEVICE8A iface)
 {
-	ICOM_THIS(SysMouseAImpl,iface);
+	ICOM_THIS(SysMouseImpl,iface);
 
 	This->ref--;
 	if (This->ref)
@@ -269,7 +336,7 @@
 	}
 
 	HeapFree(GetProcessHeap(),0,This);
-	return 0;
+	return DI_OK;
 }
 
 
@@ -281,7 +348,7 @@
 	LPDIRECTINPUTDEVICE8A iface,HWND hwnd,DWORD dwflags
 )
 {
-  ICOM_THIS(SysMouseAImpl,iface);
+  ICOM_THIS(SysMouseImpl,iface);
 
   TRACE("(this=%p,0x%08lx,0x%08lx)\n",This,(DWORD)hwnd,dwflags);
 
@@ -296,7 +363,7 @@
   This->win = hwnd;
   This->dwCoopLevel = dwflags;
 
-  return 0;
+  return DI_OK;
 }
 
 
@@ -311,7 +378,7 @@
 	LPDIRECTINPUTDEVICE8A iface,LPCDIDATAFORMAT df
 )
 {
-  ICOM_THIS(SysMouseAImpl,iface);
+  ICOM_THIS(SysMouseImpl,iface);
   int i;
 
   TRACE("(this=%p,%p)\n",This,df);
@@ -344,7 +411,7 @@
   /* Prepare all the data-conversion filters */
   This->wine_df = create_DataFormat(&(Wine_InternalMouseFormat), df, This->offset_array);
 
-  return 0;
+  return DI_OK;
 }
 
 /* low-level mouse hook */
@@ -352,7 +419,7 @@
 {
     LRESULT ret;
     MSLLHOOKSTRUCT *hook = (MSLLHOOKSTRUCT *)lparam;
-    SysMouseAImpl* This = (SysMouseAImpl*) current_lock;
+    SysMouseImpl* This = (SysMouseImpl*) current_lock;
     DWORD dwCoop;
     static long last_event = 0;
     int wdata;
@@ -484,7 +551,7 @@
 }
 
 
-static void dinput_window_check(SysMouseAImpl* This)
+static void dinput_window_check(SysMouseImpl* This)
 {
   RECT rect;
   DWORD centerX, centerY;
@@ -508,7 +575,7 @@
   */
 static HRESULT WINAPI SysMouseAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
 {
-  ICOM_THIS(SysMouseAImpl,iface);
+  ICOM_THIS(SysMouseImpl,iface);
   RECT	rect;
 
   TRACE("(this=%p)\n",This);
@@ -570,7 +637,7 @@
   */
 static HRESULT WINAPI SysMouseAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface)
 {
-    ICOM_THIS(SysMouseAImpl,iface);
+    ICOM_THIS(SysMouseImpl,iface);
 
     TRACE("(this=%p)\n",This);
 
@@ -605,7 +672,7 @@
 static HRESULT WINAPI SysMouseAImpl_GetDeviceState(
 	LPDIRECTINPUTDEVICE8A iface,DWORD len,LPVOID ptr
 ) {
-  ICOM_THIS(SysMouseAImpl,iface);
+  ICOM_THIS(SysMouseImpl,iface);
 
   EnterCriticalSection(&(This->crit));
   TRACE("(this=%p,0x%08lx,%p): \n",This,len,ptr);
@@ -639,7 +706,7 @@
 	This->m_state.lX, This->m_state.lY,
 	This->m_state.rgbButtons[0], This->m_state.rgbButtons[2], This->m_state.rgbButtons[1]);
 
-  return 0;
+  return DI_OK;
 }
 
 /******************************************************************************
@@ -651,7 +718,7 @@
 					      LPDWORD entries,
 					      DWORD flags
 ) {
-  ICOM_THIS(SysMouseAImpl,iface);
+  ICOM_THIS(SysMouseImpl,iface);
   DWORD len, nqtail;
 
   TRACE("(%p)->(dods=%ld,entries=%ld,fl=0x%08lx)\n",This,dodsize,*entries,flags);
@@ -716,7 +783,7 @@
     This->need_warp = WARP_STARTED;
 #endif
   }
-  return 0;
+  return DI_OK;
 }
 
 /******************************************************************************
@@ -726,7 +793,7 @@
 					    REFGUID rguid,
 					    LPCDIPROPHEADER ph)
 {
-  ICOM_THIS(SysMouseAImpl,iface);
+  ICOM_THIS(SysMouseImpl,iface);
 
   TRACE("(this=%p,%s,%p)\n",This,debugstr_guid(rguid),ph);
 
@@ -756,7 +823,7 @@
     }
   }
 
-  return 0;
+  return DI_OK;
 }
 
 /******************************************************************************
@@ -766,7 +833,7 @@
 						REFGUID rguid,
 						LPDIPROPHEADER pdiph)
 {
-  ICOM_THIS(SysMouseAImpl,iface);
+  ICOM_THIS(SysMouseImpl,iface);
 
   TRACE("(this=%p,%s,%p): stub!\n",
 	iface, debugstr_guid(rguid), pdiph);
@@ -826,7 +893,7 @@
   */
 static HRESULT WINAPI SysMouseAImpl_SetEventNotification(LPDIRECTINPUTDEVICE8A iface,
 							 HANDLE hnd) {
-  ICOM_THIS(SysMouseAImpl,iface);
+  ICOM_THIS(SysMouseImpl,iface);
 
   TRACE("(this=%p,0x%08lx)\n",This,(DWORD)hnd);
 
@@ -842,13 +909,16 @@
 	LPDIRECTINPUTDEVICE8A iface,
 	LPDIDEVCAPS lpDIDevCaps)
 {
-  ICOM_THIS(SysMouseAImpl,iface);
+  ICOM_THIS(SysMouseImpl,iface);
 
   TRACE("(this=%p,%p)\n",This,lpDIDevCaps);
 
   if (lpDIDevCaps->dwSize == sizeof(DIDEVCAPS)) {
     lpDIDevCaps->dwFlags = DIDC_ATTACHED;
-    lpDIDevCaps->dwDevType = DIDEVTYPE_MOUSE;
+    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;
@@ -875,7 +945,7 @@
 	LPVOID lpvRef,
 	DWORD dwFlags)
 {
-  ICOM_THIS(SysMouseAImpl,iface);
+  ICOM_THIS(SysMouseImpl,iface);
   DIDEVICEOBJECTINSTANCEA ddoi;
 
   TRACE("(this=%p,%p,%p,%08lx)\n", This, lpCallback, lpvRef, dwFlags);
@@ -946,6 +1016,19 @@
   return DI_OK;
 }
 
+static HRESULT WINAPI SysMouseWImpl_EnumObjects(LPDIRECTINPUTDEVICE8W iface, LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback,	LPVOID lpvRef,DWORD dwFlags)
+{
+  ICOM_THIS(SysMouseImpl,iface);
+
+  device_enumobjects_AtoWcb_data data;
+
+  data.lpCallBack = lpCallback;
+  data.lpvRef = lpvRef;
+
+  return SysMouseAImpl_EnumObjects((LPDIRECTINPUTDEVICE8A) This, (LPDIENUMDEVICEOBJECTSCALLBACKA) DIEnumDevicesCallbackAtoW, (LPVOID) &data, dwFlags);
+}
+
+
 /******************************************************************************
   *     GetDeviceInfo : get information about a device's identity
   */
@@ -953,7 +1036,7 @@
 	LPDIRECTINPUTDEVICE8A iface,
 	LPDIDEVICEINSTANCEA pdidi)
 {
-    ICOM_THIS(SysMouseAImpl,iface);
+    ICOM_THIS(SysMouseImpl,iface);
     TRACE("(this=%p,%p)\n", This, pdidi);
 
     if (pdidi->dwSize != sizeof(DIDEVICEINSTANCEA)) {
@@ -961,11 +1044,27 @@
 	return DI_OK;
     }
 
-    fill_mouse_dideviceinstancea(pdidi);
+    fill_mouse_dideviceinstanceA(pdidi, This->dinput->version);
     
     return DI_OK;
 }
 
+static HRESULT WINAPI SysMouseWImpl_GetDeviceInfo(LPDIRECTINPUTDEVICE8W iface, LPDIDEVICEINSTANCEW pdidi)
+{
+    ICOM_THIS(SysMouseImpl,iface);
+    TRACE("(this=%p,%p)\n", This, pdidi);
+
+    if (pdidi->dwSize != sizeof(DIDEVICEINSTANCEW)) {
+        WARN(" dinput3 not supporte yet...\n");
+	return DI_OK;
+    }
+
+    fill_mouse_dideviceinstanceW(pdidi, This->dinput->version);
+    
+    return DI_OK;
+}
+
+
 static ICOM_VTABLE(IDirectInputDevice8A) SysMouseAvt =
 {
 	ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
@@ -1002,3 +1101,47 @@
         IDirectInputDevice8AImpl_SetActionMap,
         IDirectInputDevice8AImpl_GetImageInfo
 };
+
+#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
+# define XCAST(fun)	(typeof(SysMouseWvt.fun))
+#else
+# define XCAST(fun)	(void*)
+#endif
+
+static ICOM_VTABLE(IDirectInputDevice8W) SysMouseWvt =
+{
+	ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
+	IDirectInputDevice2WImpl_QueryInterface,
+	XCAST(AddRef)IDirectInputDevice2AImpl_AddRef,
+	XCAST(Release)SysMouseAImpl_Release,
+	XCAST(GetCapabilities)SysMouseAImpl_GetCapabilities,
+	SysMouseWImpl_EnumObjects,
+	XCAST(GetProperty)SysMouseAImpl_GetProperty,
+	XCAST(SetProperty)SysMouseAImpl_SetProperty,
+	XCAST(Acquire)SysMouseAImpl_Acquire,
+	XCAST(Unacquire)SysMouseAImpl_Unacquire,
+	XCAST(GetDeviceState)SysMouseAImpl_GetDeviceState,
+	XCAST(GetDeviceData)SysMouseAImpl_GetDeviceData,
+	XCAST(SetDataFormat)SysMouseAImpl_SetDataFormat,
+	XCAST(SetEventNotification)SysMouseAImpl_SetEventNotification,
+	XCAST(SetCooperativeLevel)SysMouseAImpl_SetCooperativeLevel,
+	IDirectInputDevice2WImpl_GetObjectInfo,
+	SysMouseWImpl_GetDeviceInfo,
+	XCAST(RunControlPanel)IDirectInputDevice2AImpl_RunControlPanel,
+	XCAST(Initialize)IDirectInputDevice2AImpl_Initialize,
+	XCAST(CreateEffect)IDirectInputDevice2AImpl_CreateEffect,
+	IDirectInputDevice2WImpl_EnumEffects,
+	IDirectInputDevice2WImpl_GetEffectInfo,
+	XCAST(GetForceFeedbackState)IDirectInputDevice2AImpl_GetForceFeedbackState,
+	XCAST(SendForceFeedbackCommand)IDirectInputDevice2AImpl_SendForceFeedbackCommand,
+	XCAST(EnumCreatedEffectObjects)IDirectInputDevice2AImpl_EnumCreatedEffectObjects,
+	XCAST(Escape)IDirectInputDevice2AImpl_Escape,
+	XCAST(Poll)IDirectInputDevice2AImpl_Poll,
+	XCAST(SendDeviceData)IDirectInputDevice2AImpl_SendDeviceData,
+        IDirectInputDevice7WImpl_EnumEffectsInFile,
+        IDirectInputDevice7WImpl_WriteEffectToFile,
+        IDirectInputDevice8WImpl_BuildActionMap,
+        IDirectInputDevice8WImpl_SetActionMap,
+        IDirectInputDevice8WImpl_GetImageInfo
+};
+#undef XCAST

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux