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