Release 991031.
[wine] / include / dinput.h
1 #ifndef __WINE_DINPUT_H
2 #define __WINE_DINPUT_H
3
4 #include "windef.h" /* for MAX_PATH */
5 #include "unknwn.h"
6 #include "mouse.h"
7
8 #define DIRECTINPUT_VERSION     0x0500
9
10 /* Classes */
11 DEFINE_GUID(CLSID_DirectInput,          0x25E609E0,0xB259,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
12 DEFINE_GUID(CLSID_DirectInputDevice,    0x25E609E1,0xB259,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
13
14 /* Interfaces */
15 DEFINE_GUID(IID_IDirectInputA,          0x89521360,0xAA8A,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
16 DEFINE_GUID(IID_IDirectInputW,          0x89521361,0xAA8A,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
17 DEFINE_GUID(IID_IDirectInput2A,         0x5944E662,0xAA8A,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
18 DEFINE_GUID(IID_IDirectInput2W,         0x5944E663,0xAA8A,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
19 DEFINE_GUID(IID_IDirectInputDeviceA,    0x5944E680,0xC92E,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
20 DEFINE_GUID(IID_IDirectInputDeviceW,    0x5944E681,0xC92E,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
21 DEFINE_GUID(IID_IDirectInputDevice2A,   0x5944E682,0xC92E,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
22 DEFINE_GUID(IID_IDirectInputDevice2W,   0x5944E683,0xC92E,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
23 DEFINE_GUID(IID_IDirectInputEffect,     0xE7E1F7C0,0x88D2,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35);
24
25 /* Predefined object types */
26 DEFINE_GUID(GUID_XAxis, 0xA36D02E0,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
27 DEFINE_GUID(GUID_YAxis, 0xA36D02E1,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
28 DEFINE_GUID(GUID_ZAxis, 0xA36D02E2,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
29 DEFINE_GUID(GUID_RxAxis,0xA36D02F4,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
30 DEFINE_GUID(GUID_RyAxis,0xA36D02F5,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
31 DEFINE_GUID(GUID_RzAxis,0xA36D02E3,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
32 DEFINE_GUID(GUID_Slider,0xA36D02E4,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
33 DEFINE_GUID(GUID_Button,0xA36D02F0,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
34 DEFINE_GUID(GUID_Key,   0x55728220,0xD33C,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
35 DEFINE_GUID(GUID_POV,   0xA36D02F2,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
36 DEFINE_GUID(GUID_Unknown,0xA36D02F3,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
37
38 /* Predefined product GUIDs */
39 DEFINE_GUID(GUID_SysMouse,      0x6F1D2B60,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
40 DEFINE_GUID(GUID_SysKeyboard,   0x6F1D2B61,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
41 DEFINE_GUID(GUID_Joystick,      0x6F1D2B70,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
42
43 /* predefined forcefeedback effects */
44 DEFINE_GUID(GUID_ConstantForce, 0x13541C20,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35);
45 DEFINE_GUID(GUID_RampForce,     0x13541C21,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35);
46 DEFINE_GUID(GUID_Square,        0x13541C22,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35);
47 DEFINE_GUID(GUID_Sine,          0x13541C23,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35);
48 DEFINE_GUID(GUID_Triangle,      0x13541C24,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35);
49 DEFINE_GUID(GUID_SawtoothUp,    0x13541C25,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35);
50 DEFINE_GUID(GUID_SawtoothDown,  0x13541C26,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35);
51 DEFINE_GUID(GUID_Spring,        0x13541C27,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35);
52 DEFINE_GUID(GUID_Damper,        0x13541C28,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35);
53 DEFINE_GUID(GUID_Inertia,       0x13541C29,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35);
54 DEFINE_GUID(GUID_Friction,      0x13541C2A,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35);
55 DEFINE_GUID(GUID_CustomForce,   0x13541C2B,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35);
56
57 typedef struct IDirectInputA IDirectInputA,*LPDIRECTINPUTA;
58 typedef struct IDirectInputDeviceA IDirectInputDeviceA,*LPDIRECTINPUTDEVICEA;
59 typedef struct IDirectInputDevice2A IDirectInputDevice2A,*LPDIRECTINPUTDEVICE2A;
60 typedef struct IDirectInputEffect IDirectInputEffect,*LPDIRECTINPUTEFFECT;
61 typedef struct SysKeyboardA SysKeyboardA,*LPSYSKEYBOARDA;
62 typedef struct SysMouseA SysMouseA,*LPSYSMOUSEA;
63
64 #define DI_OK                           S_OK
65 #define DI_NOTATTACHED                  S_FALSE
66 #define DI_BUFFEROVERFLOW               S_FALSE
67 #define DI_PROPNOEFFECT                 S_FALSE
68 #define DI_NOEFFECT                     S_FALSE
69 #define DI_POLLEDDEVICE                 ((HRESULT)0x00000002L)
70 #define DI_DOWNLOADSKIPPED              ((HRESULT)0x00000003L)
71 #define DI_EFFECTRESTARTED              ((HRESULT)0x00000004L)
72 #define DI_TRUNCATED                    ((HRESULT)0x00000008L)
73 #define DI_TRUNCATEDANDRESTARTED        ((HRESULT)0x0000000CL)
74
75 #define DIERR_OLDDIRECTINPUTVERSION     \
76     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_OLD_WIN_VERSION)
77 #define DIERR_BETADIRECTINPUTVERSION    \
78     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_RMODE_APP)
79 #define DIERR_BADDRIVERVER              \
80     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_BAD_DRIVER_LEVEL)
81 #define DIERR_DEVICENOTREG              REGDB_E_CLASSNOTREG
82 #define DIERR_NOTFOUND                  \
83     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_FILE_NOT_FOUND)
84 #define DIERR_OBJECTNOTFOUND            \
85     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_FILE_NOT_FOUND)
86 #define DIERR_INVALIDPARAM              E_INVALIDARG
87 #define DIERR_NOINTERFACE               E_NOINTERFACE
88 #define DIERR_GENERIC                   E_FAIL
89 #define DIERR_OUTOFMEMORY               E_OUTOFMEMORY
90 #define DIERR_UNSUPPORTED               E_NOTIMPL
91 #define DIERR_NOTINITIALIZED            \
92     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NOT_READY)
93 #define DIERR_ALREADYINITIALIZED        \
94     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_ALREADY_INITIALIZED)
95 #define DIERR_NOAGGREGATION             CLASS_E_NOAGGREGATION
96 #define DIERR_OTHERAPPHASPRIO           E_ACCESSDENIED
97 #define DIERR_INPUTLOST                 \
98     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_READ_FAULT)
99 #define DIERR_ACQUIRED                  \
100     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_BUSY)
101 #define DIERR_NOTACQUIRED               \
102     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_INVALID_ACCESS)
103 #define DIERR_READONLY                  E_ACCESSDENIED
104 #define DIERR_HANDLEEXISTS              E_ACCESSDENIED
105 #ifndef E_PENDING
106 #define E_PENDING                       0x8000000AL
107 #endif
108 #define DIERR_INSUFFICIENTPRIVS         0x80040200L
109 #define DIERR_DEVICEFULL                0x80040201L
110 #define DIERR_MOREDATA                  0x80040202L
111 #define DIERR_NOTDOWNLOADED             0x80040203L
112 #define DIERR_HASEFFECTS                0x80040204L
113 #define DIERR_NOTEXCLUSIVEACQUIRED      0x80040205L
114 #define DIERR_INCOMPLETEEFFECT          0x80040206L
115 #define DIERR_NOTBUFFERED               0x80040207L
116 #define DIERR_EFFECTPLAYING             0x80040208L
117 #define DIERR_UNPLUGGED                 0x80040209L
118 #define DIERR_REPORTFULL                0x8004020AL
119
120 #define DIENUM_STOP                     0
121 #define DIENUM_CONTINUE                 1
122
123 #define DIDEVTYPE_DEVICE                1
124 #define DIDEVTYPE_MOUSE                 2
125 #define DIDEVTYPE_KEYBOARD              3
126 #define DIDEVTYPE_JOYSTICK              4
127 #define DIDEVTYPE_HID                   0x00010000
128
129 #define DIDEVTYPEMOUSE_UNKNOWN          1
130 #define DIDEVTYPEMOUSE_TRADITIONAL      2
131 #define DIDEVTYPEMOUSE_FINGERSTICK      3
132 #define DIDEVTYPEMOUSE_TOUCHPAD         4
133 #define DIDEVTYPEMOUSE_TRACKBALL        5
134
135 #define DIDEVTYPEKEYBOARD_UNKNOWN       0
136 #define DIDEVTYPEKEYBOARD_PCXT          1
137 #define DIDEVTYPEKEYBOARD_OLIVETTI      2
138 #define DIDEVTYPEKEYBOARD_PCAT          3
139 #define DIDEVTYPEKEYBOARD_PCENH         4
140 #define DIDEVTYPEKEYBOARD_NOKIA1050     5
141 #define DIDEVTYPEKEYBOARD_NOKIA9140     6
142 #define DIDEVTYPEKEYBOARD_NEC98         7
143 #define DIDEVTYPEKEYBOARD_NEC98LAPTOP   8
144 #define DIDEVTYPEKEYBOARD_NEC98106      9
145 #define DIDEVTYPEKEYBOARD_JAPAN106     10
146 #define DIDEVTYPEKEYBOARD_JAPANAX      11
147 #define DIDEVTYPEKEYBOARD_J3100        12
148
149 #define DIDEVTYPEJOYSTICK_UNKNOWN       1
150 #define DIDEVTYPEJOYSTICK_TRADITIONAL   2
151 #define DIDEVTYPEJOYSTICK_FLIGHTSTICK   3
152 #define DIDEVTYPEJOYSTICK_GAMEPAD       4
153 #define DIDEVTYPEJOYSTICK_RUDDER        5
154 #define DIDEVTYPEJOYSTICK_WHEEL         6
155 #define DIDEVTYPEJOYSTICK_HEADTRACKER   7
156
157 typedef struct {
158     DWORD       dwSize;
159     GUID        guidType;
160     DWORD       dwOfs;
161     DWORD       dwType;
162     DWORD       dwFlags;
163     CHAR        tszName[MAX_PATH];
164 #if(DIRECTINPUT_VERSION >= 0x0500)
165     DWORD       dwFFMaxForce;
166     DWORD       dwFFForceResolution;
167     WORD        wCollectionNumber;
168     WORD        wDesignatorIndex;
169     WORD        wUsagePage;
170     WORD        wUsage;
171     DWORD       dwDimension;
172     WORD        wExponent;
173     WORD        wReserved;
174 #endif /* DIRECTINPUT_VERSION >= 0x0500 */
175 } DIDEVICEOBJECTINSTANCEA, *LPDIDEVICEOBJECTINSTANCEA,*LPCDIDEVICEOBJECTINSTANCEA;
176
177 typedef struct {
178     DWORD       dwSize;
179     GUID        guidType;
180     DWORD       dwOfs;
181     DWORD       dwType;
182     DWORD       dwFlags;
183     WCHAR       tszName[MAX_PATH];
184 #if(DIRECTINPUT_VERSION >= 0x0500)
185     DWORD       dwFFMaxForce;
186     DWORD       dwFFForceResolution;
187     WORD        wCollectionNumber;
188     WORD        wDesignatorIndex;
189     WORD        wUsagePage;
190     WORD        wUsage;
191     DWORD       dwDimension;
192     WORD        wExponent;
193     WORD        wReserved;
194 #endif /* DIRECTINPUT_VERSION >= 0x0500 */
195 } DIDEVICEOBJECTINSTANCEW, *LPDIDEVICEOBJECTINSTANCEW,*LPCDIDEVICEOBJECTINSTANCEW;
196 DECL_WINELIB_TYPE_AW(LPDIDEVICEOBJECTINSTANCE)
197 DECL_WINELIB_TYPE_AW(DIDEVICEOBJECTINSTANCE)
198
199
200 typedef struct {
201     DWORD       dwSize;
202     GUID        guidInstance;
203     GUID        guidProduct;
204     DWORD       dwDevType;
205     CHAR        tszInstanceName[MAX_PATH];
206     CHAR        tszProductName[MAX_PATH];
207 #if(DIRECTINPUT_VERSION >= 0x0500)
208     GUID        guidFFDriver;
209     WORD        wUsagePage;
210     WORD        wUsage;
211 #endif /* DIRECTINPUT_VERSION >= 0x0500 */
212 } DIDEVICEINSTANCEA, *LPDIDEVICEINSTANCEA, *LPCDIDEVICEINSTANCEA;
213
214 typedef struct {
215     DWORD       dwSize;
216     GUID        guidInstance;
217     GUID        guidProduct;
218     DWORD       dwDevType;
219     WCHAR       tszInstanceName[MAX_PATH];
220     WCHAR       tszProductName[MAX_PATH];
221 #if(DIRECTINPUT_VERSION >= 0x0500)
222     GUID        guidFFDriver;
223     WORD        wUsagePage;
224     WORD        wUsage;
225 #endif /* DIRECTINPUT_VERSION >= 0x0500 */
226 } DIDEVICEINSTANCEW, *LPDIDEVICEINSTANCEW, *LPCDIDEVICEINSTANCEW;
227 DECL_WINELIB_TYPE_AW(DIDEVICEINSTANCE)
228 DECL_WINELIB_TYPE_AW(LPDIDEVICEINSTANCE)
229 DECL_WINELIB_TYPE_AW(LPCDIDEVICEINSTANCE)
230
231 typedef BOOL (CALLBACK * LPDIENUMDEVICESCALLBACKA)(LPCDIDEVICEINSTANCEA,LPVOID);
232 typedef BOOL (CALLBACK * LPDIENUMDEVICESCALLBACKW)(LPCDIDEVICEINSTANCEW,LPVOID);
233 DECL_WINELIB_TYPE_AW(LPDIENUMDEVICESCALLBACK)
234
235 typedef BOOL (CALLBACK * LPDIENUMDEVICEOBJECTSCALLBACKA)(LPCDIDEVICEOBJECTINSTANCEA, LPVOID);
236 typedef BOOL (CALLBACK * LPDIENUMDEVICEOBJECTSCALLBACKW)(LPCDIDEVICEOBJECTINSTANCEW,LPVOID);
237 DECL_WINELIB_TYPE_AW(LPDIENUMDEVICEOBJECTSCALLBACK)
238
239 typedef BOOL (CALLBACK * LPDIENUMCREATEDEFFECTOBJECTSCALLBACK)(LPDIRECTINPUTEFFECT, LPVOID);
240
241 #define DIK_ESCAPE          0x01
242 #define DIK_1               0x02
243 #define DIK_2               0x03
244 #define DIK_3               0x04
245 #define DIK_4               0x05
246 #define DIK_5               0x06
247 #define DIK_6               0x07
248 #define DIK_7               0x08
249 #define DIK_8               0x09
250 #define DIK_9               0x0A
251 #define DIK_0               0x0B
252 #define DIK_MINUS           0x0C    /* - on main keyboard */
253 #define DIK_EQUALS          0x0D
254 #define DIK_BACK            0x0E    /* backspace */
255 #define DIK_TAB             0x0F
256 #define DIK_Q               0x10
257 #define DIK_W               0x11
258 #define DIK_E               0x12
259 #define DIK_R               0x13
260 #define DIK_T               0x14
261 #define DIK_Y               0x15
262 #define DIK_U               0x16
263 #define DIK_I               0x17
264 #define DIK_O               0x18
265 #define DIK_P               0x19
266 #define DIK_LBRACKET        0x1A
267 #define DIK_RBRACKET        0x1B
268 #define DIK_RETURN          0x1C    /* Enter on main keyboard */
269 #define DIK_LCONTROL        0x1D
270 #define DIK_A               0x1E
271 #define DIK_S               0x1F
272 #define DIK_D               0x20
273 #define DIK_F               0x21
274 #define DIK_G               0x22
275 #define DIK_H               0x23
276 #define DIK_J               0x24
277 #define DIK_K               0x25
278 #define DIK_L               0x26
279 #define DIK_SEMICOLON       0x27
280 #define DIK_APOSTROPHE      0x28
281 #define DIK_GRAVE           0x29    /* accent grave */
282 #define DIK_LSHIFT          0x2A
283 #define DIK_BACKSLASH       0x2B
284 #define DIK_Z               0x2C
285 #define DIK_X               0x2D
286 #define DIK_C               0x2E
287 #define DIK_V               0x2F
288 #define DIK_B               0x30
289 #define DIK_N               0x31
290 #define DIK_M               0x32
291 #define DIK_COMMA           0x33
292 #define DIK_PERIOD          0x34    /* . on main keyboard */
293 #define DIK_SLASH           0x35    /* / on main keyboard */
294 #define DIK_RSHIFT          0x36
295 #define DIK_MULTIPLY        0x37    /* * on numeric keypad */
296 #define DIK_LMENU           0x38    /* left Alt */
297 #define DIK_SPACE           0x39
298 #define DIK_CAPITAL         0x3A
299 #define DIK_F1              0x3B
300 #define DIK_F2              0x3C
301 #define DIK_F3              0x3D
302 #define DIK_F4              0x3E
303 #define DIK_F5              0x3F
304 #define DIK_F6              0x40
305 #define DIK_F7              0x41
306 #define DIK_F8              0x42
307 #define DIK_F9              0x43
308 #define DIK_F10             0x44
309 #define DIK_NUMLOCK         0x45
310 #define DIK_SCROLL          0x46    /* Scroll Lock */
311 #define DIK_NUMPAD7         0x47
312 #define DIK_NUMPAD8         0x48
313 #define DIK_NUMPAD9         0x49
314 #define DIK_SUBTRACT        0x4A    /* - on numeric keypad */
315 #define DIK_NUMPAD4         0x4B
316 #define DIK_NUMPAD5         0x4C
317 #define DIK_NUMPAD6         0x4D
318 #define DIK_ADD             0x4E    /* + on numeric keypad */
319 #define DIK_NUMPAD1         0x4F
320 #define DIK_NUMPAD2         0x50
321 #define DIK_NUMPAD3         0x51
322 #define DIK_NUMPAD0         0x52
323 #define DIK_DECIMAL         0x53    /* . on numeric keypad */
324 #define DIK_F11             0x57
325 #define DIK_F12             0x58
326 #define DIK_F13             0x64    /*                     (NEC PC98) */
327 #define DIK_F14             0x65    /*                     (NEC PC98) */
328 #define DIK_F15             0x66    /*                     (NEC PC98) */
329 #define DIK_KANA            0x70    /* (Japanese keyboard)            */
330 #define DIK_CONVERT         0x79    /* (Japanese keyboard)            */
331 #define DIK_NOCONVERT       0x7B    /* (Japanese keyboard)            */
332 #define DIK_YEN             0x7D    /* (Japanese keyboard)            */
333 #define DIK_NUMPADEQUALS    0x8D    /* = on numeric keypad (NEC PC98) */
334 #define DIK_CIRCUMFLEX      0x90    /* (Japanese keyboard)            */
335 #define DIK_AT              0x91    /*                     (NEC PC98) */
336 #define DIK_COLON           0x92    /*                     (NEC PC98) */
337 #define DIK_UNDERLINE       0x93    /*                     (NEC PC98) */
338 #define DIK_KANJI           0x94    /* (Japanese keyboard)            */
339 #define DIK_STOP            0x95    /*                     (NEC PC98) */
340 #define DIK_AX              0x96    /*                     (Japan AX) */
341 #define DIK_UNLABELED       0x97    /*                        (J3100) */
342 #define DIK_NUMPADENTER     0x9C    /* Enter on numeric keypad */
343 #define DIK_RCONTROL        0x9D
344 #define DIK_NUMPADCOMMA     0xB3    /* , on numeric keypad (NEC PC98) */
345 #define DIK_DIVIDE          0xB5    /* / on numeric keypad */
346 #define DIK_SYSRQ           0xB7
347 #define DIK_RMENU           0xB8    /* right Alt */
348 #define DIK_PAUSE           0xC5    /* Pause */
349 #define DIK_HOME            0xC7    /* Home on arrow keypad */
350 #define DIK_UP              0xC8    /* UpArrow on arrow keypad */
351 #define DIK_PRIOR           0xC9    /* PgUp on arrow keypad */
352 #define DIK_LEFT            0xCB    /* LeftArrow on arrow keypad */
353 #define DIK_RIGHT           0xCD    /* RightArrow on arrow keypad */
354 #define DIK_END             0xCF    /* End on arrow keypad */
355 #define DIK_DOWN            0xD0    /* DownArrow on arrow keypad */
356 #define DIK_NEXT            0xD1    /* PgDn on arrow keypad */
357 #define DIK_INSERT          0xD2    /* Insert on arrow keypad */
358 #define DIK_DELETE          0xD3    /* Delete on arrow keypad */
359 #define DIK_LWIN            0xDB    /* Left Windows key */
360 #define DIK_RWIN            0xDC    /* Right Windows key */
361 #define DIK_APPS            0xDD    /* AppMenu key */
362 #define DIK_POWER           0xDE
363 #define DIK_SLEEP           0xDF
364 #define DIK_BACKSPACE       DIK_BACK            /* backspace */
365 #define DIK_NUMPADSTAR      DIK_MULTIPLY        /* * on numeric keypad */
366 #define DIK_LALT            DIK_LMENU           /* left Alt */
367 #define DIK_CAPSLOCK        DIK_CAPITAL         /* CapsLock */
368 #define DIK_NUMPADMINUS     DIK_SUBTRACT        /* - on numeric keypad */
369 #define DIK_NUMPADPLUS      DIK_ADD             /* + on numeric keypad */
370 #define DIK_NUMPADPERIOD    DIK_DECIMAL         /* . on numeric keypad */
371 #define DIK_NUMPADSLASH     DIK_DIVIDE          /* / on numeric keypad */
372 #define DIK_RALT            DIK_RMENU           /* right Alt */
373 #define DIK_UPARROW         DIK_UP              /* UpArrow on arrow keypad */
374 #define DIK_PGUP            DIK_PRIOR           /* PgUp on arrow keypad */
375 #define DIK_LEFTARROW       DIK_LEFT            /* LeftArrow on arrow keypad */
376 #define DIK_RIGHTARROW      DIK_RIGHT           /* RightArrow on arrow keypad */
377 #define DIK_DOWNARROW       DIK_DOWN            /* DownArrow on arrow keypad */
378 #define DIK_PGDN            DIK_NEXT            /* PgDn on arrow keypad */
379
380 #define DIDFT_ALL               0x00000000
381 #define DIDFT_RELAXIS           0x00000001
382 #define DIDFT_ABSAXIS           0x00000002
383 #define DIDFT_AXIS              0x00000003
384 #define DIDFT_PSHBUTTON         0x00000004
385 #define DIDFT_TGLBUTTON         0x00000008
386 #define DIDFT_BUTTON            0x0000000C
387 #define DIDFT_POV               0x00000010
388 #define DIDFT_COLLECTION        0x00000040
389 #define DIDFT_NODATA            0x00000080
390 #define DIDFT_ANYINSTANCE       0x00FFFF00
391 #define DIDFT_INSTANCEMASK      DIDFT_ANYINSTANCE
392 #define DIDFT_MAKEINSTANCE(n)   ((WORD)(n) << 8)
393 #define DIDFT_GETTYPE(n)        LOBYTE(n)
394 #define DIDFT_GETINSTANCE(n)    LOWORD((n) >> 8)
395 #define DIDFT_FFACTUATOR        0x01000000
396 #define DIDFT_FFEFFECTTRIGGER   0x02000000
397 #define DIDFT_OUTPUT            0x10000000
398 #define DIDFT_ENUMCOLLECTION(n) ((WORD)(n) << 8)
399 #define DIDFT_NOCOLLECTION      0x00FFFF00
400 #define DIDF_ABSAXIS            0x00000001
401 #define DIDF_RELAXIS            0x00000002
402
403 #define DIGDD_PEEK              0x00000001
404
405 typedef struct {
406     DWORD       dwOfs;
407     DWORD       dwData;
408     DWORD       dwTimeStamp;
409     DWORD       dwSequence;
410 } DIDEVICEOBJECTDATA,*LPDIDEVICEOBJECTDATA,*LPCDIDEVICEOBJECTDATA;
411
412 typedef struct _DIOBJECTDATAFORMAT {
413     const GUID *pguid;
414     DWORD       dwOfs;
415     DWORD       dwType;
416     DWORD       dwFlags;
417 } DIOBJECTDATAFORMAT, *LPDIOBJECTDATAFORMAT;
418
419 typedef struct {
420     DWORD                       dwSize;
421     DWORD                       dwObjSize;
422     DWORD                       dwFlags;
423     DWORD                       dwDataSize;
424     DWORD                       dwNumObjs;
425     LPDIOBJECTDATAFORMAT        rgodf;
426 } DIDATAFORMAT, *LPDIDATAFORMAT,*LPCDIDATAFORMAT;
427
428 typedef struct {
429     DWORD       dwSize;
430     DWORD       dwHeaderSize;
431     DWORD       dwObj;
432     DWORD       dwHow;
433 } DIPROPHEADER,*LPDIPROPHEADER,*LPCDIPROPHEADER;
434
435 #define DIPH_DEVICE     0
436 #define DIPH_BYOFFSET   1
437 #define DIPH_BYID       2
438 #define DIPH_BYUSAGE    3
439
440 #define DIMAKEUSAGEDWORD(UsagePage, Usage) (DWORD)MAKELONG(Usage, UsagePage)
441
442 typedef struct DIPROPDWORD {
443         DIPROPHEADER    diph;
444         DWORD           dwData;
445 } DIPROPDWORD, *LPDIPROPDWORD;
446 typedef const DIPROPDWORD *LPCDIPROPDWORD;
447
448 typedef struct DIPROPRANGE {
449         DIPROPHEADER    diph;
450         LONG            lMin;
451         LONG            lMax;
452 } DIPROPRANGE, *LPDIPROPRANGE;
453 typedef const DIPROPRANGE *LPCDIPROPRANGE;
454
455 #define DIPROPRANGE_NOMIN       ((LONG)0x80000000)
456 #define DIPROPRANGE_NOMAX       ((LONG)0x7FFFFFFF)
457
458 typedef struct DIPROPCAL {
459         DIPROPHEADER diph;
460         LONG    lMin;
461         LONG    lCenter;
462         LONG    lMax;
463 } DIPROPCAL, *LPDIPROPCAL;
464 typedef const DIPROPCAL *LPCDIPROPCAL;
465
466 typedef struct DIPROPGUIDANDPATH {
467         DIPROPHEADER diph;
468         GUID    guidClass;
469         WCHAR   wszPath[MAX_PATH];
470 } DIPROPGUIDANDPATH, *LPDIPROPGUIDANDPATH,*LPCDIPROPGUIDANDPATH;
471
472 /* special property GUIDs */
473 #define MAKEDIPROP(prop)        ((REFGUID)(prop))
474 #define DIPROP_BUFFERSIZE       MAKEDIPROP(1)
475 #define DIPROP_AXISMODE         MAKEDIPROP(2)
476
477 #define DIPROPAXISMODE_ABS      0
478 #define DIPROPAXISMODE_REL      1
479
480 #define DIPROP_GRANULARITY      MAKEDIPROP(3)
481 #define DIPROP_RANGE            MAKEDIPROP(4)
482 #define DIPROP_DEADZONE         MAKEDIPROP(5)
483 #define DIPROP_SATURATION       MAKEDIPROP(6)
484 #define DIPROP_FFGAIN           MAKEDIPROP(7)
485 #define DIPROP_FFLOAD           MAKEDIPROP(8)
486 #define DIPROP_AUTOCENTER       MAKEDIPROP(9)
487
488 #define DIPROPAUTOCENTER_OFF    0
489 #define DIPROPAUTOCENTER_ON     1
490
491 #define DIPROP_CALIBRATIONMODE  MAKEDIPROP(10)
492
493 #define DIPROPCALIBRATIONMODE_COOKED    0
494 #define DIPROPCALIBRATIONMODE_RAW       1
495
496 #define DIPROP_CALIBRATION      MAKEDIPROP(11)
497 #define DIPROP_GUIDANDPATH      MAKEDIPROP(12)
498
499
500 typedef struct DIDEVCAPS {
501     DWORD       dwSize;
502     DWORD       dwFlags;
503     DWORD       dwDevType;
504     DWORD       dwAxes;
505     DWORD       dwButtons;
506     DWORD       dwPOVs;
507 #if(DIRECTINPUT_VERSION >= 0x0500)
508     DWORD       dwFFSamplePeriod;
509     DWORD       dwFFMinTimeResolution;
510     DWORD       dwFirmwareRevision;
511     DWORD       dwHardwareRevision;
512     DWORD       dwFFDriverVersion;
513 #endif /* DIRECTINPUT_VERSION >= 0x0500 */
514 } DIDEVCAPS,*LPDIDEVCAPS;
515
516 #define DIDC_ATTACHED           0x00000001
517 #define DIDC_POLLEDDEVICE       0x00000002
518 #define DIDC_EMULATED           0x00000004
519 #define DIDC_POLLEDDATAFORMAT   0x00000008
520 #define DIDC_FORCEFEEDBACK      0x00000100
521 #define DIDC_FFATTACK           0x00000200
522 #define DIDC_FFFADE             0x00000400
523 #define DIDC_SATURATION         0x00000800
524 #define DIDC_POSNEGCOEFFICIENTS 0x00001000
525 #define DIDC_POSNEGSATURATION   0x00002000
526 #define DIDC_DEADBAND           0x00004000
527
528 /* SetCooperativeLevel dwFlags */
529 #define DISCL_EXCLUSIVE         0x00000001
530 #define DISCL_NONEXCLUSIVE      0x00000002
531 #define DISCL_FOREGROUND        0x00000004
532 #define DISCL_BACKGROUND        0x00000008
533
534 typedef struct DICONSTANTFORCE {
535         LONG                    lMagnitude;
536 } DICONSTANTFORCE, *LPDICONSTANTFORCE;
537
538 typedef const DICONSTANTFORCE *LPCDICONSTANTFORCE;
539
540 typedef struct DIRAMPFORCE {
541         LONG                    lStart;
542         LONG                    lEnd;
543 } DIRAMPFORCE, *LPDIRAMPFORCE;
544
545 typedef const DIRAMPFORCE *LPCDIRAMPFORCE;
546
547 typedef struct DIPERIODIC {
548         DWORD                   dwMagnitude;
549         LONG                    lOffset;
550         DWORD                   dwPhase;
551         DWORD                   dwPeriod;
552 } DIPERIODIC, *LPDIPERIODIC;
553
554 typedef const DIPERIODIC *LPCDIPERIODIC;
555
556 typedef struct DICONDITION {
557         LONG                    lOffset;
558         LONG                    lPositiveCoefficient;
559         LONG                    lNegativeCoefficient;
560         DWORD                   dwPositiveSaturation;
561         DWORD                   dwNegativeSaturation;
562         LONG                    lDeadBand;
563 } DICONDITION, *LPDICONDITION;
564
565 typedef const DICONDITION *LPCDICONDITION;
566
567 typedef struct DICUSTOMFORCE {
568         DWORD                   cChannels;
569         DWORD                   dwSamplePeriod;
570         DWORD                   cSamples;
571         LPLONG                  rglForceData;
572 } DICUSTOMFORCE, *LPDICUSTOMFORCE;
573
574 typedef const DICUSTOMFORCE *LPCDICUSTOMFORCE;
575
576 typedef struct DIENVELOPE {
577         DWORD                   dwSize;
578         DWORD                   dwAttackLevel;
579         DWORD                   dwAttackTime;
580         DWORD                   dwFadeLevel;
581         DWORD                   dwFadeTime;
582 } DIENVELOPE, *LPDIENVELOPE;
583
584 typedef const DIENVELOPE *LPCDIENVELOPE;
585
586 typedef struct DIEFFECT {
587         DWORD                   dwSize;
588         DWORD                   dwFlags;
589         DWORD                   dwDuration;
590         DWORD                   dwSamplePeriod;
591         DWORD                   dwGain;
592         DWORD                   dwTriggerButton;
593         DWORD                   dwTriggerRepeatInterval;
594         DWORD                   cAxes;
595         LPDWORD                 rgdwAxes;
596         LPLONG                  rglDirection;
597         LPDIENVELOPE            lpEnvelope;
598         DWORD                   cbTypeSpecificParams;
599         LPVOID                  lpvTypeSpecificParams;
600 } DIEFFECT, *LPDIEFFECT;
601
602 typedef const DIEFFECT *LPCDIEFFECT;
603
604 typedef struct DIEFFECTINFOA {
605         DWORD                   dwSize;
606         GUID                    guid;
607         DWORD                   dwEffType;
608         DWORD                   dwStaticParams;
609         DWORD                   dwDynamicParams;
610         CHAR                    tszName[MAX_PATH];
611 } DIEFFECTINFOA, *LPDIEFFECTINFOA;
612
613 typedef struct DIEFFECTINFOW {
614         DWORD                   dwSize;
615         GUID                    guid;
616         DWORD                   dwEffType;
617         DWORD                   dwStaticParams;
618         DWORD                   dwDynamicParams;
619         WCHAR                   tszName[MAX_PATH];
620 } DIEFFECTINFOW, *LPDIEFFECTINFOW;
621
622 #ifdef UNICODE
623 typedef DIEFFECTINFOW DIEFFECTINFO;
624 typedef LPDIEFFECTINFOW LPDIEFFECTINFO;
625 #else
626 typedef DIEFFECTINFOA DIEFFECTINFO;
627 typedef LPDIEFFECTINFOA LPDIEFFECTINFO;
628 #endif
629
630 typedef const DIEFFECTINFOA *LPCDIEFFECTINFOA;
631 typedef const DIEFFECTINFOW *LPCDIEFFECTINFOW;
632 typedef const DIEFFECTINFO  *LPCDIEFFECTINFO;
633
634 typedef BOOL (CALLBACK * LPDIENUMEFFECTSCALLBACKA)(LPCDIEFFECTINFOA, LPVOID);
635 typedef BOOL (CALLBACK * LPDIENUMEFFECTSCALLBACKW)(LPCDIEFFECTINFOW, LPVOID);
636
637 typedef struct DIEFFESCAPE {
638         DWORD   dwSize;
639         DWORD   dwCommand;
640         LPVOID  lpvInBuffer;
641         DWORD   cbInBuffer;
642         LPVOID  lpvOutBuffer;
643         DWORD   cbOutBuffer;
644 } DIEFFESCAPE, *LPDIEFFESCAPE;
645
646 typedef struct DIJOYSTATE {
647         LONG    lX;
648         LONG    lY;
649         LONG    lZ;
650         LONG    lRx;
651         LONG    lRy;
652         LONG    lRz;
653         LONG    rglSlider[2];
654         DWORD   rgdwPOV[4];
655         BYTE    rgbButtons[32];
656 } DIJOYSTATE, *LPDIJOYSTATE;
657
658 typedef struct DIJOYSTATE2 {
659         LONG    lX;
660         LONG    lY;
661         LONG    lZ;
662         LONG    lRx;
663         LONG    lRy;
664         LONG    lRz;
665         LONG    rglSlider[2];
666         DWORD   rgdwPOV[4];
667         BYTE    rgbButtons[128];
668         LONG    lVX;            /* 'v' as in velocity */
669         LONG    lVY;
670         LONG    lVZ;
671         LONG    lVRx;
672         LONG    lVRy;
673         LONG    lVRz;
674         LONG    rglVSlider[2];
675         LONG    lAX;            /* 'a' as in acceleration */
676         LONG    lAY;
677         LONG    lAZ;
678         LONG    lARx;
679         LONG    lARy;
680         LONG    lARz;
681         LONG    rglASlider[2];
682         LONG    lFX;            /* 'f' as in force */
683         LONG    lFY;
684         LONG    lFZ;
685         LONG    lFRx;           /* 'fr' as in rotational force aka torque */
686         LONG    lFRy;
687         LONG    lFRz;
688         LONG    rglFSlider[2];
689 } DIJOYSTATE2, *LPDIJOYSTATE2;
690
691 #define DIJOFS_X                FIELD_OFFSET(DIJOYSTATE, lX)
692 #define DIJOFS_Y                FIELD_OFFSET(DIJOYSTATE, lY)
693 #define DIJOFS_Z                FIELD_OFFSET(DIJOYSTATE, lZ)
694 #define DIJOFS_RX               FIELD_OFFSET(DIJOYSTATE, lRx)
695 #define DIJOFS_RY               FIELD_OFFSET(DIJOYSTATE, lRy)
696 #define DIJOFS_RZ               FIELD_OFFSET(DIJOYSTATE, lRz)
697 #define DIJOFS_SLIDER(n)        (FIELD_OFFSET(DIJOYSTATE, rglSlider) + \
698                                                         (n) * sizeof(LONG))
699 #define DIJOFS_POV(n)           (FIELD_OFFSET(DIJOYSTATE, rgdwPOV) + \
700                                                         (n) * sizeof(DWORD))
701 #define DIJOFS_BUTTON(n)        (FIELD_OFFSET(DIJOYSTATE, rgbButtons) + (n))
702 #define DIJOFS_BUTTON0          DIJOFS_BUTTON(0)
703 #define DIJOFS_BUTTON1          DIJOFS_BUTTON(1)
704 #define DIJOFS_BUTTON2          DIJOFS_BUTTON(2)
705 #define DIJOFS_BUTTON3          DIJOFS_BUTTON(3)
706 #define DIJOFS_BUTTON4          DIJOFS_BUTTON(4)
707 #define DIJOFS_BUTTON5          DIJOFS_BUTTON(5)
708 #define DIJOFS_BUTTON6          DIJOFS_BUTTON(6)
709 #define DIJOFS_BUTTON7          DIJOFS_BUTTON(7)
710 #define DIJOFS_BUTTON8          DIJOFS_BUTTON(8)
711 #define DIJOFS_BUTTON9          DIJOFS_BUTTON(9)
712 #define DIJOFS_BUTTON10         DIJOFS_BUTTON(10)
713 #define DIJOFS_BUTTON11         DIJOFS_BUTTON(11)
714 #define DIJOFS_BUTTON12         DIJOFS_BUTTON(12)
715 #define DIJOFS_BUTTON13         DIJOFS_BUTTON(13)
716 #define DIJOFS_BUTTON14         DIJOFS_BUTTON(14)
717 #define DIJOFS_BUTTON15         DIJOFS_BUTTON(15)
718 #define DIJOFS_BUTTON16         DIJOFS_BUTTON(16)
719 #define DIJOFS_BUTTON17         DIJOFS_BUTTON(17)
720 #define DIJOFS_BUTTON18         DIJOFS_BUTTON(18)
721 #define DIJOFS_BUTTON19         DIJOFS_BUTTON(19)
722 #define DIJOFS_BUTTON20         DIJOFS_BUTTON(20)
723 #define DIJOFS_BUTTON21         DIJOFS_BUTTON(21)
724 #define DIJOFS_BUTTON22         DIJOFS_BUTTON(22)
725 #define DIJOFS_BUTTON23         DIJOFS_BUTTON(23)
726 #define DIJOFS_BUTTON24         DIJOFS_BUTTON(24)
727 #define DIJOFS_BUTTON25         DIJOFS_BUTTON(25)
728 #define DIJOFS_BUTTON26         DIJOFS_BUTTON(26)
729 #define DIJOFS_BUTTON27         DIJOFS_BUTTON(27)
730 #define DIJOFS_BUTTON28         DIJOFS_BUTTON(28)
731 #define DIJOFS_BUTTON29         DIJOFS_BUTTON(29)
732 #define DIJOFS_BUTTON30         DIJOFS_BUTTON(30)
733 #define DIJOFS_BUTTON31         DIJOFS_BUTTON(31)
734
735 /*****************************************************************************
736  * IDirectInputEffect interface
737  */
738 #define ICOM_INTERFACE IDirectInputEffect
739 #define IDirectInputEffect_METHODS \
740     ICOM_METHOD3(HRESULT,Initialize,      HINSTANCE,, DWORD,, REFGUID,) \
741     ICOM_METHOD1(HRESULT,GetEffectGuid,   LPGUID,) \
742     ICOM_METHOD2(HRESULT,GetParameters,   LPDIEFFECT,, DWORD,) \
743     ICOM_METHOD2(HRESULT,SetParameters,   LPCDIEFFECT,, DWORD,) \
744     ICOM_METHOD2(HRESULT,Start,           DWORD,, DWORD,) \
745     ICOM_METHOD (HRESULT,Stop) \
746     ICOM_METHOD1(HRESULT,GetEffectStatus, LPDWORD,) \
747     ICOM_METHOD (HRESULT,Download) \
748     ICOM_METHOD (HRESULT,Unload) \
749     ICOM_METHOD1(HRESULT,Escape,          LPDIEFFESCAPE,)
750 #define IDirectInputEffect_IMETHODS \
751     IUnknown_IMETHODS \
752     IDirectInputEffect_METHODS
753 ICOM_DEFINE(IDirectInputEffect,IUnknown)
754 #undef ICOM_INTERFACE
755
756     /*** IUnknown methods ***/
757 #define IDirectInputEffect_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
758 #define IDirectInputEffect_AddRef(p)             ICOM_CALL (AddRef,p)
759 #define IDirectInputEffect_Release(p)            ICOM_CALL (Release,p)
760     /*** IDirectInputEffect methods ***/
761 #define IDirectInputEffect_Initialize(p,a,b,c)    ICOM_CALL3(Initialize,p,a,b,c)
762 #define IDirectInputEffect_GetEffectGuid(p,a)     ICOM_CALL1(GetEffectGuid,p,a)
763 #define IDirectInputEffect_GetParameters(p,a,b)   ICOM_CALL2(GetParameters,p,a,b)
764 #define IDirectInputEffect_SetParameters(p,a,b)   ICOM_CALL2(SetParameters,p,a,b)
765 #define IDirectInputEffect_Start(p,a,b)           ICOM_CALL2(Start,p,a,b)
766 #define IDirectInputEffect_Stop(p)                ICOM_CALL (Stop,p)
767 #define IDirectInputEffect_GetEffectStatus(p,a,b) ICOM_CALL1(GetEffectStatus,p,a)
768 #define IDirectInputEffect_Download(p)            ICOM_CALL (Download,p)
769 #define IDirectInputEffect_Unload(p)              ICOM_CALL (Unload,p)
770 #define IDirectInputEffect_Escape(p,a)            ICOM_CALL1(Escape,p,a)
771
772
773 /*****************************************************************************
774  * IDirectInputDeviceA interface
775  */
776 #define ICOM_INTERFACE IDirectInputDeviceA
777 #define IDirectInputDeviceA_METHODS \
778     ICOM_METHOD1(HRESULT,GetCapabilities, LPDIDEVCAPS,lpDIDevCaps) \
779     ICOM_METHOD3(HRESULT,EnumObjects, LPDIENUMDEVICEOBJECTSCALLBACKA,lpCallback, LPVOID,pvRef, DWORD,dwFlags) \
780     ICOM_METHOD2(HRESULT,GetProperty, REFGUID,rguidProp, LPDIPROPHEADER,pdiph) \
781     ICOM_METHOD2(HRESULT,SetProperty, REFGUID,rguidProp, LPCDIPROPHEADER,pdiph) \
782     ICOM_METHOD (HRESULT,Acquire) \
783     ICOM_METHOD (HRESULT,Unacquire) \
784     ICOM_METHOD2(HRESULT,GetDeviceState, DWORD,cbData, LPVOID,lpvData) \
785     ICOM_METHOD4(HRESULT,GetDeviceData, DWORD,cbObjectData, LPDIDEVICEOBJECTDATA,rgdod, LPDWORD,pdwInOut, DWORD,dwFlags) \
786     ICOM_METHOD1(HRESULT,SetDataFormat, LPCDIDATAFORMAT,lpdf) \
787     ICOM_METHOD1(HRESULT,SetEventNotification, HANDLE,hEvent) \
788     ICOM_METHOD2(HRESULT,SetCooperativeLevel, HWND,hwnd, DWORD,dwFlags) \
789     ICOM_METHOD3(HRESULT,GetObjectInfo, LPDIDEVICEOBJECTINSTANCEA,pdidoi, DWORD,dwObj, DWORD,dwHow) \
790     ICOM_METHOD1(HRESULT,GetDeviceInfo, LPDIDEVICEINSTANCEA,pdidi) \
791     ICOM_METHOD2(HRESULT,RunControlPanel, HWND,hwndOwner, DWORD,dwFlags) \
792     ICOM_METHOD3(HRESULT,Initialize, HINSTANCE,hinst, DWORD,dwVersion, REFGUID,rguid)
793 #define IDirectInputDeviceA_IMETHODS \
794     IUnknown_IMETHODS \
795     IDirectInputDeviceA_METHODS
796 ICOM_DEFINE(IDirectInputDeviceA,IUnknown)
797 #undef ICOM_INTERFACE
798
799     /*** IUnknown methods ***/
800 #define IDirectInputDevice_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
801 #define IDirectInputDevice_AddRef(p)             ICOM_CALL (AddRef,p)
802 #define IDirectInputDevice_Release(p)            ICOM_CALL (Release,p)
803 /*** IDirectInputDevice methods ***/
804 #define IDirectInputDevice_GetCapabilities(p,a)       ICOM_CALL1(GetCapabilities,p,a)
805 #define IDirectInputDevice_EnumObjects(p,a,b,c)       ICOM_CALL3(EnumObjects,p,a,b,c)
806 #define IDirectInputDevice_GetProperty(p,a,b)         ICOM_CALL2(GetProperty,p,a,b)
807 #define IDirectInputDevice_SetProperty(p,a,b)         ICOM_CALL2(SetProperty,p,a,b)
808 #define IDirectInputDevice_Acquire(p)                 ICOM_CALL (Acquire,p)
809 #define IDirectInputDevice_Unacquire(p)               ICOM_CALL (Unacquire,p)
810 #define IDirectInputDevice_GetDeviceState(p,a,b)      ICOM_CALL2(GetDeviceState,p,a,b)
811 #define IDirectInputDevice_GetDeviceData(p,a,b,c,d)   ICOM_CALL4(GetDeviceData,p,a,b,c,d)
812 #define IDirectInputDevice_SetDataFormat(p,a)         ICOM_CALL1(SetDataFormat,p,a)
813 #define IDirectInputDevice_SetEventNotification(p,a)  ICOM_CALL1(SetEventNotification,p,a)
814 #define IDirectInputDevice_SetCooperativeLevel(p,a,b) ICOM_CALL2(SetCooperativeLevel,p,a,b)
815 #define IDirectInputDevice_GetObjectInfo(p,a,b,c)     ICOM_CALL3(GetObjectInfo,p,a,b,c)
816 #define IDirectInputDevice_GetDeviceInfo(p,a)         ICOM_CALL1(GetDeviceInfo,p,a)
817 #define IDirectInputDevice_RunControlPanel(p,a,b)     ICOM_CALL2(RunControlPanel,p,a,b)
818 #define IDirectInputDevice_Initialize(p,a,b,c)        ICOM_CALL3(Initialize,p,a,b,c)
819
820
821 /*****************************************************************************
822  * IDirectInputDevice2A interface
823  */
824 #define ICOM_INTERFACE IDirectInputDevice2A
825 #define IDirectInputDevice2A_METHODS \
826     ICOM_METHOD4(HRESULT,CreateEffect, REFGUID,rguid, LPCDIEFFECT,lpeff, LPDIRECTINPUTEFFECT*,ppdeff, LPUNKNOWN,punkOuter) \
827     ICOM_METHOD3(HRESULT,EnumEffects, LPDIENUMEFFECTSCALLBACKA,lpCallback, LPVOID,pvRef, DWORD,dwEffType) \
828     ICOM_METHOD2(HRESULT,GetEffectInfo, LPDIEFFECTINFOA,pdei, REFGUID,rguid) \
829     ICOM_METHOD1(HRESULT,GetForceFeedbackState, LPDWORD,pdwOut) \
830     ICOM_METHOD1(HRESULT,SendForceFeedbackCommand, DWORD,dwFlags) \
831     ICOM_METHOD3(HRESULT,EnumCreatedEffectObjects, LPDIENUMCREATEDEFFECTOBJECTSCALLBACK,lpCallback, LPVOID,pvRef, DWORD,fl) \
832     ICOM_METHOD1(HRESULT,Escape, LPDIEFFESCAPE,pesc) \
833     ICOM_METHOD (HRESULT,Poll) \
834     ICOM_METHOD4(HRESULT,SendDeviceData, DWORD,cbObjectData, LPDIDEVICEOBJECTDATA,rgdod, LPDWORD,pdwInOut, DWORD,fl)
835 #define IDirectInputDevice2A_IMETHODS \
836     IDirectInputDeviceA_IMETHODS \
837     IDirectInputDevice2A_METHODS
838 ICOM_DEFINE(IDirectInputDevice2A,IDirectInputDeviceA)
839 #undef ICOM_INTERFACE
840
841 /*** IUnknown methods ***/
842 #define IDirectInputDevice2_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
843 #define IDirectInputDevice2_AddRef(p)             ICOM_CALL (AddRef,p)
844 #define IDirectInputDevice2_Release(p)            ICOM_CALL (Release,p)
845 /*** IDirectInputDevice methods ***/
846 #define IDirectInputDevice2_GetCapabilities(p,a)       ICOM_CALL1(GetCapabilities,p,a)
847 #define IDirectInputDevice2_EnumObjects(p,a,b,c)       ICOM_CALL3(EnumObjects,p,a,b,c)
848 #define IDirectInputDevice2_GetProperty(p,a,b)         ICOM_CALL2(GetProperty,p,a,b)
849 #define IDirectInputDevice2_SetProperty(p,a,b)         ICOM_CALL2(SetProperty,p,a,b)
850 #define IDirectInputDevice2_Acquire(p)                 ICOM_CALL (Acquire,p)
851 #define IDirectInputDevice2_Unacquire(p)               ICOM_CALL (Unacquire,p)
852 #define IDirectInputDevice2_GetDeviceState(p,a,b)      ICOM_CALL2(GetDeviceState,p,a,b)
853 #define IDirectInputDevice2_GetDeviceData(p,a,b,c,d)   ICOM_CALL4(GetDeviceData,p,a,b,c,d)
854 #define IDirectInputDevice2_SetDataFormat(p,a)         ICOM_CALL1(SetDataFormat,p,a)
855 #define IDirectInputDevice2_SetEventNotification(p,a)  ICOM_CALL1(SetEventNotification,p,a)
856 #define IDirectInputDevice2_SetCooperativeLevel(p,a,b) ICOM_CALL2(SetCooperativeLevel,p,a,b)
857 #define IDirectInputDevice2_GetObjectInfo(p,a,b,c)     ICOM_CALL3(GetObjectInfo,p,a,b,c)
858 #define IDirectInputDevice2_GetDeviceInfo(p,a)         ICOM_CALL1(GetDeviceInfo,p,a)
859 #define IDirectInputDevice2_RunControlPanel(p,a,b)     ICOM_CALL2(RunControlPanel,p,a,b)
860 #define IDirectInputDevice2_Initialize(p,a,b,c)        ICOM_CALL3(Initialize,p,a,b,c)
861 /*** IDirectInputDevice2 methods ***/
862 #define IDirectInputDevice2_CreateEffect(p,a,b,c,d)           ICOM_CALL4(CreateEffect,p,a,b,c,d)
863 #define IDirectInputDevice2_EnumEffects(p,a,b,c)              ICOM_CALL3(EnumEffects,p,a,b,c)
864 #define IDirectInputDevice2_GetEffectInfo(p,a,b)              ICOM_CALL2(GetEffectInfo,p,a,b)
865 #define IDirectInputDevice2_GetForceFeedbackState(p,a)        ICOM_CALL1(GetForceFeedbackState,p,a)
866 #define IDirectInputDevice2_SendForceFeedbackCommand(p,a)     ICOM_CALL1(SendForceFeedbackCommand,p,a)
867 #define IDirectInputDevice2_EnumCreatedEffectObjects(p,a,b,c) ICOM_CALL3(EnumCreatedEffectObjects,p,a,b,c)
868 #define IDirectInputDevice2_Escape(p,a)                       ICOM_CALL1(Escape,p,a)
869 #define IDirectInputDevice2_Poll(p)                           ICOM_CALL (Poll,p)
870 #define IDirectInputDevice2_SendDeviceData(p,a,b,c,d)         ICOM_CALL4(SendDeviceData,p,a,b,c,d)
871
872 /* "Standard" Mouse report... */
873 typedef struct DIMOUSESTATE {
874   LONG lX;
875   LONG lY;
876   LONG lZ;
877   BYTE rgbButtons[4];
878 } DIMOUSESTATE;
879
880 #define DIMOFS_X        FIELD_OFFSET(DIMOUSESTATE, lX)
881 #define DIMOFS_Y        FIELD_OFFSET(DIMOUSESTATE, lY)
882 #define DIMOFS_Z        FIELD_OFFSET(DIMOUSESTATE, lZ)
883 #define DIMOFS_BUTTON0 (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 0)
884 #define DIMOFS_BUTTON1 (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 1)
885 #define DIMOFS_BUTTON2 (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 2)
886 #define DIMOFS_BUTTON3 (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 3)
887
888
889 /*****************************************************************************
890  * IDirectInputA interface
891  */
892 #define ICOM_INTERFACE IDirectInputA
893 #define IDirectInputA_METHODS \
894     ICOM_METHOD3(HRESULT,CreateDevice,    REFGUID,rguid, LPDIRECTINPUTDEVICEA*,lplpDirectInputDevice, LPUNKNOWN,pUnkOuter) \
895     ICOM_METHOD4(HRESULT,EnumDevices,     DWORD,dwDevType, LPDIENUMDEVICESCALLBACKA,lpCallback, LPVOID,pvRef, DWORD,dwFlags) \
896     ICOM_METHOD1(HRESULT,GetDeviceStatus, REFGUID,rguidInstance) \
897     ICOM_METHOD2(HRESULT,RunControlPanel, HWND,hwndOwner, DWORD,dwFlags) \
898     ICOM_METHOD2(HRESULT,Initialize,      HINSTANCE,hinst, DWORD,dwVersion)
899 #define IDirectInputA_IMETHODS \
900     IUnknown_IMETHODS \
901     IDirectInputA_METHODS
902 ICOM_DEFINE(IDirectInputA,IUnknown)
903 #undef ICOM_INTERFACE
904
905 /*** IUnknown methods ***/
906 #define IDirectInputA_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
907 #define IDirectInputA_AddRef(p)             ICOM_CALL (AddRef,p)
908 #define IDirectInputA_Release(p)            ICOM_CALL (Release,p)
909         /*** IDirectInputA methods ***/
910 #define IDirectInputA_CreateDevice(p,a,b,c)  ICOM_CALL3(CreateDevice,p,a,b,c)
911 #define IDirectInputA_EnumDevices(p,a,b,c,d) ICOM_CALL4(EnumDevices,p,a,b,c,d)
912 #define IDirectInputA_GetDeviceStatus(p,a)   ICOM_CALL1(GetDeviceStatus,p,a)
913 #define IDirectInputA_RunControlPanel(p,a,b) ICOM_CALL2(RunControlPanel,p,a,b)
914 #define IDirectInputA_Initialize(p,a,b)      ICOM_CALL2(Initialize,p,a,b)
915
916 /* Export functions */ 
917
918 HRESULT WINAPI DirectInputCreateA(HINSTANCE,DWORD,LPDIRECTINPUTA *,LPUNKNOWN);
919 HRESULT WINAPI DirectInputCreateW(HINSTANCE,DWORD,LPDIRECTINPUTA *,LPUNKNOWN);
920 #define DirectInputCreate WINELIB_NAME_AW(DirectInputCreate)
921
922 #endif /* __WINE_DINPUT_H */