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