dinput: Keep the list of all the dinput devices created for each IDIrectInput object.
[wine] / dlls / dinput / keyboard.c
1 /*              DirectInput Keyboard device
2  *
3  * Copyright 1998 Marcus Meissner
4  * Copyright 1998,1999 Lionel Ulmer
5  * Copyright 2000-2001 TransGaming Technologies Inc.
6  * Copyright 2005 Raphael Junqueira
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21  */
22
23 #include "config.h"
24 #include "wine/port.h"
25
26 #include <stdarg.h>
27 #include <string.h>
28 #include "windef.h"
29 #include "winbase.h"
30 #include "winuser.h"
31 #include "winerror.h"
32 #include "dinput.h"
33
34 #include "dinput_private.h"
35 #include "device_private.h"
36 #include "wine/debug.h"
37 #include "wine/unicode.h"
38
39 WINE_DEFAULT_DEBUG_CHANNEL(dinput);
40
41 #define WINE_DINPUT_KEYBOARD_MAX_KEYS 256
42
43 static const IDirectInputDevice8AVtbl SysKeyboardAvt;
44 static const IDirectInputDevice8WVtbl SysKeyboardWvt;
45
46 typedef struct SysKeyboardImpl SysKeyboardImpl;
47 struct SysKeyboardImpl
48 {
49     struct IDirectInputDevice2AImpl base;
50     BYTE DInputKeyState[WINE_DINPUT_KEYBOARD_MAX_KEYS];
51 };
52
53 static SysKeyboardImpl* current_lock = NULL; 
54 /* Today's acquired device
55  * FIXME: currently this can be only one.
56  * Maybe this should be a linked list or st.
57  * I don't know what the rules are for multiple acquired keyboards,
58  * but 'DI_LOSTFOCUS' and 'DI_UNACQUIRED' exist for a reason.
59 */
60
61 static LRESULT CALLBACK KeyboardCallback( int code, WPARAM wparam, LPARAM lparam )
62 {
63     SysKeyboardImpl *This = (SysKeyboardImpl *)current_lock;
64     int dik_code;
65     KBDLLHOOKSTRUCT *hook = (KBDLLHOOKSTRUCT *)lparam;
66     BYTE new_diks;
67
68     TRACE("(%d,%ld,%ld)\n", code, wparam, lparam);
69
70     /* returns now if not HC_ACTION */
71     if (code != HC_ACTION) return CallNextHookEx(0, code, wparam, lparam);
72   
73     dik_code = hook->scanCode & 0xff;
74     if (hook->flags & LLKHF_EXTENDED) dik_code |= 0x80;
75
76     new_diks = hook->flags & LLKHF_UP ? 0 : 0x80;
77
78     /* returns now if key event already known */
79     if (new_diks == This->DInputKeyState[dik_code])
80         return CallNextHookEx(0, code, wparam, lparam);
81
82     This->DInputKeyState[dik_code] = new_diks;
83     TRACE(" setting %02X to %02X\n", dik_code, This->DInputKeyState[dik_code]);
84       
85     dik_code = id_to_offset(&This->base.data_format, DIDFT_MAKEINSTANCE(dik_code) | DIDFT_PSHBUTTON);
86     EnterCriticalSection(&This->base.crit);
87     queue_event((LPDIRECTINPUTDEVICE8A)This, dik_code, new_diks, hook->time, This->base.dinput->evsequence++);
88     LeaveCriticalSection(&This->base.crit);
89     
90     return CallNextHookEx(0, code, wparam, lparam);
91 }
92
93 static const GUID DInput_Wine_Keyboard_GUID = { /* 0ab8648a-7735-11d2-8c73-71df54a96441 */
94   0x0ab8648a,
95   0x7735,
96   0x11d2,
97   {0x8c, 0x73, 0x71, 0xdf, 0x54, 0xa9, 0x64, 0x41}
98 };
99
100 static void fill_keyboard_dideviceinstanceA(LPDIDEVICEINSTANCEA lpddi, DWORD version) {
101     DWORD dwSize;
102     DIDEVICEINSTANCEA ddi;
103     
104     dwSize = lpddi->dwSize;
105
106     TRACE("%d %p\n", dwSize, lpddi);
107     
108     memset(lpddi, 0, dwSize);
109     memset(&ddi, 0, sizeof(ddi));
110
111     ddi.dwSize = dwSize;
112     ddi.guidInstance = GUID_SysKeyboard;/* DInput's GUID */
113     ddi.guidProduct = DInput_Wine_Keyboard_GUID; /* Vendor's GUID */
114     if (version >= 0x0800)
115         ddi.dwDevType = DI8DEVTYPE_KEYBOARD | (DI8DEVTYPEKEYBOARD_UNKNOWN << 8);
116     else
117         ddi.dwDevType = DIDEVTYPE_KEYBOARD | (DIDEVTYPEKEYBOARD_UNKNOWN << 8);
118     strcpy(ddi.tszInstanceName, "Keyboard");
119     strcpy(ddi.tszProductName, "Wine Keyboard");
120
121     memcpy(lpddi, &ddi, (dwSize < sizeof(ddi) ? dwSize : sizeof(ddi)));
122 }
123
124 static void fill_keyboard_dideviceinstanceW(LPDIDEVICEINSTANCEW lpddi, DWORD version) {
125     DWORD dwSize;
126     DIDEVICEINSTANCEW ddi;
127     
128     dwSize = lpddi->dwSize;
129
130     TRACE("%d %p\n", dwSize, lpddi);
131     
132     memset(lpddi, 0, dwSize);
133     memset(&ddi, 0, sizeof(ddi));
134  
135     ddi.dwSize = dwSize;
136     ddi.guidInstance = GUID_SysKeyboard;/* DInput's GUID */
137     ddi.guidProduct = DInput_Wine_Keyboard_GUID; /* Vendor's GUID */
138     if (version >= 0x0800)
139         ddi.dwDevType = DI8DEVTYPE_KEYBOARD | (DI8DEVTYPEKEYBOARD_UNKNOWN << 8);
140     else
141         ddi.dwDevType = DIDEVTYPE_KEYBOARD | (DIDEVTYPEKEYBOARD_UNKNOWN << 8);
142     MultiByteToWideChar(CP_ACP, 0, "Keyboard", -1, ddi.tszInstanceName, MAX_PATH);
143     MultiByteToWideChar(CP_ACP, 0, "Wine Keyboard", -1, ddi.tszProductName, MAX_PATH);
144
145     memcpy(lpddi, &ddi, (dwSize < sizeof(ddi) ? dwSize : sizeof(ddi)));
146 }
147  
148 static BOOL keyboarddev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi, DWORD version, int id)
149 {
150   if (id != 0)
151     return FALSE;
152
153   if ((dwDevType == 0) ||
154       ((dwDevType == DIDEVTYPE_KEYBOARD) && (version < 0x0800)) ||
155       (((dwDevType == DI8DEVCLASS_KEYBOARD) || (dwDevType == DI8DEVTYPE_KEYBOARD)) && (version >= 0x0800))) {
156     TRACE("Enumerating the Keyboard device\n");
157  
158     fill_keyboard_dideviceinstanceA(lpddi, version);
159     
160     return TRUE;
161   }
162
163   return FALSE;
164 }
165
166 static BOOL keyboarddev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEW lpddi, DWORD version, int id)
167 {
168   if (id != 0)
169     return FALSE;
170
171   if ((dwDevType == 0) ||
172       ((dwDevType == DIDEVTYPE_KEYBOARD) && (version < 0x0800)) ||
173       (((dwDevType == DI8DEVCLASS_KEYBOARD) || (dwDevType == DI8DEVTYPE_KEYBOARD)) && (version >= 0x0800))) {
174     TRACE("Enumerating the Keyboard device\n");
175
176     fill_keyboard_dideviceinstanceW(lpddi, version);
177     
178     return TRUE;
179   }
180
181   return FALSE;
182 }
183
184 static SysKeyboardImpl *alloc_device(REFGUID rguid, const void *kvt, IDirectInputImpl *dinput)
185 {
186     SysKeyboardImpl* newDevice;
187     LPDIDATAFORMAT df = NULL;
188     int i, idx = 0;
189
190     newDevice = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(SysKeyboardImpl));
191     newDevice->base.lpVtbl = kvt;
192     newDevice->base.ref = 1;
193     memcpy(&newDevice->base.guid, rguid, sizeof(*rguid));
194     newDevice->base.dinput = dinput;
195     InitializeCriticalSection(&newDevice->base.crit);
196     newDevice->base.crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": SysKeyboardImpl*->base.crit");
197
198     /* Create copy of default data format */
199     if (!(df = HeapAlloc(GetProcessHeap(), 0, c_dfDIKeyboard.dwSize))) goto failed;
200     memcpy(df, &c_dfDIKeyboard, c_dfDIKeyboard.dwSize);
201     if (!(df->rgodf = HeapAlloc(GetProcessHeap(), 0, df->dwNumObjs * df->dwObjSize))) goto failed;
202
203     for (i = 0; i < df->dwNumObjs; i++)
204     {
205         char buf[MAX_PATH];
206
207         if (!GetKeyNameTextA(((i & 0x7f) << 16) | ((i & 0x80) << 17), buf, sizeof(buf)))
208             continue;
209
210         memcpy(&df->rgodf[idx], &c_dfDIKeyboard.rgodf[i], df->dwObjSize);
211         df->rgodf[idx++].dwType = DIDFT_MAKEINSTANCE(i) | DIDFT_PSHBUTTON;
212     }
213     df->dwNumObjs = idx;
214
215     newDevice->base.data_format.wine_df = df;
216     IDirectInput_AddRef((LPDIRECTINPUTDEVICE8A)newDevice->base.dinput);
217     return newDevice;
218
219 failed:
220     if (df) HeapFree(GetProcessHeap(), 0, df->rgodf);
221     HeapFree(GetProcessHeap(), 0, df);
222     HeapFree(GetProcessHeap(), 0, newDevice);
223     return NULL;
224 }
225
226
227 static HRESULT keyboarddev_create_deviceA(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEA* pdev)
228 {
229   if ((IsEqualGUID(&GUID_SysKeyboard,rguid)) ||          /* Generic Keyboard */
230       (IsEqualGUID(&DInput_Wine_Keyboard_GUID,rguid))) { /* Wine Keyboard */
231     if ((riid == NULL) ||
232         IsEqualGUID(&IID_IDirectInputDeviceA,riid) ||
233         IsEqualGUID(&IID_IDirectInputDevice2A,riid) ||
234         IsEqualGUID(&IID_IDirectInputDevice7A,riid) ||
235         IsEqualGUID(&IID_IDirectInputDevice8A,riid)) {
236       *pdev = (IDirectInputDeviceA*) alloc_device(rguid, &SysKeyboardAvt, dinput);
237       TRACE("Creating a Keyboard device (%p)\n", *pdev);
238       if (!*pdev) return DIERR_OUTOFMEMORY;
239       return DI_OK;
240     } else
241       return DIERR_NOINTERFACE;
242   }
243   return DIERR_DEVICENOTREG;
244 }
245
246 static HRESULT keyboarddev_create_deviceW(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEW* pdev)
247 {
248   if ((IsEqualGUID(&GUID_SysKeyboard,rguid)) ||          /* Generic Keyboard */
249       (IsEqualGUID(&DInput_Wine_Keyboard_GUID,rguid))) { /* Wine Keyboard */
250     if ((riid == NULL) ||
251         IsEqualGUID(&IID_IDirectInputDeviceW,riid) ||
252         IsEqualGUID(&IID_IDirectInputDevice2W,riid) ||
253         IsEqualGUID(&IID_IDirectInputDevice7W,riid) ||
254         IsEqualGUID(&IID_IDirectInputDevice8W,riid)) {
255       *pdev = (IDirectInputDeviceW*) alloc_device(rguid, &SysKeyboardWvt, dinput);
256       TRACE("Creating a Keyboard device (%p)\n", *pdev);
257       if (!*pdev) return DIERR_OUTOFMEMORY;
258       return DI_OK;
259     } else
260       return DIERR_NOINTERFACE;
261   }
262   return DIERR_DEVICENOTREG;
263 }
264
265 const struct dinput_device keyboard_device = {
266   "Wine keyboard driver",
267   keyboarddev_enum_deviceA,
268   keyboarddev_enum_deviceW,
269   keyboarddev_create_deviceA,
270   keyboarddev_create_deviceW
271 };
272
273 static HRESULT WINAPI SysKeyboardAImpl_GetDeviceState(
274         LPDIRECTINPUTDEVICE8A iface,DWORD len,LPVOID ptr
275 )
276 {
277     SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
278     TRACE("(%p)->(%d,%p)\n", This, len, ptr);
279
280     if (!This->base.acquired) return DIERR_NOTACQUIRED;
281
282     if (len != WINE_DINPUT_KEYBOARD_MAX_KEYS)
283         return DIERR_INVALIDPARAM;
284
285     EnterCriticalSection(&This->base.crit);
286
287     if (TRACE_ON(dinput)) {
288         int i;
289         for (i = 0; i < WINE_DINPUT_KEYBOARD_MAX_KEYS; i++) {
290             if (This->DInputKeyState[i] != 0x00)
291                 TRACE(" - %02X: %02x\n", i, This->DInputKeyState[i]);
292         }
293     }
294     
295     memcpy(ptr, This->DInputKeyState, WINE_DINPUT_KEYBOARD_MAX_KEYS);
296     LeaveCriticalSection(&This->base.crit);
297
298     return DI_OK;
299 }
300
301 static HRESULT WINAPI SysKeyboardAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface);
302
303 static HRESULT WINAPI SysKeyboardAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
304 {
305     SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
306     HRESULT res;
307
308     TRACE("(%p)\n",This);
309
310     if ((res = IDirectInputDevice2AImpl_Acquire(iface)) != DI_OK) return res;
311
312     if (current_lock != NULL) {
313         FIXME("Not more than one keyboard can be acquired at the same time.\n");
314         SysKeyboardAImpl_Unacquire((LPDIRECTINPUTDEVICE8A)current_lock);
315     }
316     current_lock = This;
317
318     set_dinput_hook(WH_KEYBOARD_LL, KeyboardCallback);
319
320     return DI_OK;
321 }
322
323 static HRESULT WINAPI SysKeyboardAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface)
324 {
325     SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
326     HRESULT res;
327
328     TRACE("(this=%p)\n",This);
329
330     if ((res = IDirectInputDevice2AImpl_Unacquire(iface)) != DI_OK) return res;
331
332     set_dinput_hook(WH_KEYBOARD_LL, NULL);
333
334     /* No more locks */
335     if (current_lock == This)
336         current_lock = NULL;
337     else
338         ERR("this != current_lock\n");
339
340     return DI_OK;
341 }
342
343 /******************************************************************************
344   *     GetCapabilities : get the device capablitites
345   */
346 static HRESULT WINAPI SysKeyboardAImpl_GetCapabilities(
347         LPDIRECTINPUTDEVICE8A iface,
348         LPDIDEVCAPS lpDIDevCaps)
349 {
350     SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
351     DIDEVCAPS devcaps;
352
353     TRACE("(this=%p,%p)\n",This,lpDIDevCaps);
354
355     if ((lpDIDevCaps->dwSize != sizeof(DIDEVCAPS)) && (lpDIDevCaps->dwSize != sizeof(DIDEVCAPS_DX3))) {
356         WARN("invalid parameter\n");
357         return DIERR_INVALIDPARAM;
358     }
359     
360     devcaps.dwSize = lpDIDevCaps->dwSize;
361     devcaps.dwFlags = DIDC_ATTACHED;
362     if (This->base.dinput->dwVersion >= 0x0800)
363         devcaps.dwDevType = DI8DEVTYPE_KEYBOARD | (DI8DEVTYPEKEYBOARD_UNKNOWN << 8);
364     else
365         devcaps.dwDevType = DIDEVTYPE_KEYBOARD | (DIDEVTYPEKEYBOARD_UNKNOWN << 8);
366     devcaps.dwAxes = 0;
367     devcaps.dwButtons = This->base.data_format.wine_df->dwNumObjs;
368     devcaps.dwPOVs = 0;
369     devcaps.dwFFSamplePeriod = 0;
370     devcaps.dwFFMinTimeResolution = 0;
371     devcaps.dwFirmwareRevision = 100;
372     devcaps.dwHardwareRevision = 100;
373     devcaps.dwFFDriverVersion = 0;
374
375     memcpy(lpDIDevCaps, &devcaps, lpDIDevCaps->dwSize);
376     
377     return DI_OK;
378 }
379
380 /******************************************************************************
381   *     GetObjectInfo : get information about a device object such as a button
382   *                     or axis
383   */
384 static HRESULT WINAPI
385 SysKeyboardAImpl_GetObjectInfo(
386         LPDIRECTINPUTDEVICE8A iface,
387         LPDIDEVICEOBJECTINSTANCEA pdidoi,
388         DWORD dwObj,
389         DWORD dwHow)
390 {
391     HRESULT res;
392
393     res = IDirectInputDevice2AImpl_GetObjectInfo(iface, pdidoi, dwObj, dwHow);
394     if (res != DI_OK) return res;
395
396     if (!GetKeyNameTextA((DIDFT_GETINSTANCE(pdidoi->dwType) & 0x80) << 17 |
397                          (DIDFT_GETINSTANCE(pdidoi->dwType) & 0x7f) << 16,
398                          pdidoi->tszName, sizeof(pdidoi->tszName)))
399         return DIERR_OBJECTNOTFOUND;
400
401     _dump_OBJECTINSTANCEA(pdidoi);
402     return res;
403 }
404
405 static HRESULT WINAPI SysKeyboardWImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface,
406                                                      LPDIDEVICEOBJECTINSTANCEW pdidoi,
407                                                      DWORD dwObj,
408                                                      DWORD dwHow)
409 {
410     HRESULT res;
411
412     res = IDirectInputDevice2WImpl_GetObjectInfo(iface, pdidoi, dwObj, dwHow);
413     if (res != DI_OK) return res;
414
415     if (!GetKeyNameTextW((DIDFT_GETINSTANCE(pdidoi->dwType) & 0x80) << 17 |
416                          (DIDFT_GETINSTANCE(pdidoi->dwType) & 0x7f) << 16,
417                          pdidoi->tszName, sizeof(pdidoi->tszName)))
418         return DIERR_OBJECTNOTFOUND;
419
420     _dump_OBJECTINSTANCEW(pdidoi);
421     return res;
422 }
423
424 /******************************************************************************
425   *     GetDeviceInfo : get information about a device's identity
426   */
427 static HRESULT WINAPI SysKeyboardAImpl_GetDeviceInfo(
428         LPDIRECTINPUTDEVICE8A iface,
429         LPDIDEVICEINSTANCEA pdidi)
430 {
431     SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
432     TRACE("(this=%p,%p)\n", This, pdidi);
433
434     if (pdidi->dwSize != sizeof(DIDEVICEINSTANCEA)) {
435         WARN(" dinput3 not supported yet...\n");
436         return DI_OK;
437     }
438
439     fill_keyboard_dideviceinstanceA(pdidi, This->base.dinput->dwVersion);
440     
441     return DI_OK;
442 }
443
444 static HRESULT WINAPI SysKeyboardWImpl_GetDeviceInfo(LPDIRECTINPUTDEVICE8W iface, LPDIDEVICEINSTANCEW pdidi) 
445 {
446     SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
447     TRACE("(this=%p,%p)\n", This, pdidi);
448
449     if (pdidi->dwSize != sizeof(DIDEVICEINSTANCEW)) {
450         WARN(" dinput3 not supported yet...\n");
451         return DI_OK;
452     }
453
454     fill_keyboard_dideviceinstanceW(pdidi, This->base.dinput->dwVersion);
455     
456     return DI_OK;
457 }
458
459 static const IDirectInputDevice8AVtbl SysKeyboardAvt =
460 {
461         IDirectInputDevice2AImpl_QueryInterface,
462         IDirectInputDevice2AImpl_AddRef,
463         IDirectInputDevice2AImpl_Release,
464         SysKeyboardAImpl_GetCapabilities,
465         IDirectInputDevice2AImpl_EnumObjects,
466         IDirectInputDevice2AImpl_GetProperty,
467         IDirectInputDevice2AImpl_SetProperty,
468         SysKeyboardAImpl_Acquire,
469         SysKeyboardAImpl_Unacquire,
470         SysKeyboardAImpl_GetDeviceState,
471         IDirectInputDevice2AImpl_GetDeviceData,
472         IDirectInputDevice2AImpl_SetDataFormat,
473         IDirectInputDevice2AImpl_SetEventNotification,
474         IDirectInputDevice2AImpl_SetCooperativeLevel,
475         SysKeyboardAImpl_GetObjectInfo,
476         SysKeyboardAImpl_GetDeviceInfo,
477         IDirectInputDevice2AImpl_RunControlPanel,
478         IDirectInputDevice2AImpl_Initialize,
479         IDirectInputDevice2AImpl_CreateEffect,
480         IDirectInputDevice2AImpl_EnumEffects,
481         IDirectInputDevice2AImpl_GetEffectInfo,
482         IDirectInputDevice2AImpl_GetForceFeedbackState,
483         IDirectInputDevice2AImpl_SendForceFeedbackCommand,
484         IDirectInputDevice2AImpl_EnumCreatedEffectObjects,
485         IDirectInputDevice2AImpl_Escape,
486         IDirectInputDevice2AImpl_Poll,
487         IDirectInputDevice2AImpl_SendDeviceData,
488         IDirectInputDevice7AImpl_EnumEffectsInFile,
489         IDirectInputDevice7AImpl_WriteEffectToFile,
490         IDirectInputDevice8AImpl_BuildActionMap,
491         IDirectInputDevice8AImpl_SetActionMap,
492         IDirectInputDevice8AImpl_GetImageInfo
493 };
494
495 #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
496 # define XCAST(fun)     (typeof(SysKeyboardWvt.fun))
497 #else
498 # define XCAST(fun)     (void*)
499 #endif
500
501 static const IDirectInputDevice8WVtbl SysKeyboardWvt =
502 {
503         IDirectInputDevice2WImpl_QueryInterface,
504         XCAST(AddRef)IDirectInputDevice2AImpl_AddRef,
505         XCAST(Release)IDirectInputDevice2AImpl_Release,
506         XCAST(GetCapabilities)SysKeyboardAImpl_GetCapabilities,
507         IDirectInputDevice2WImpl_EnumObjects,
508         XCAST(GetProperty)IDirectInputDevice2AImpl_GetProperty,
509         XCAST(SetProperty)IDirectInputDevice2AImpl_SetProperty,
510         XCAST(Acquire)SysKeyboardAImpl_Acquire,
511         XCAST(Unacquire)SysKeyboardAImpl_Unacquire,
512         XCAST(GetDeviceState)SysKeyboardAImpl_GetDeviceState,
513         XCAST(GetDeviceData)IDirectInputDevice2AImpl_GetDeviceData,
514         XCAST(SetDataFormat)IDirectInputDevice2AImpl_SetDataFormat,
515         XCAST(SetEventNotification)IDirectInputDevice2AImpl_SetEventNotification,
516         XCAST(SetCooperativeLevel)IDirectInputDevice2AImpl_SetCooperativeLevel,
517         SysKeyboardWImpl_GetObjectInfo,
518         SysKeyboardWImpl_GetDeviceInfo,
519         XCAST(RunControlPanel)IDirectInputDevice2AImpl_RunControlPanel,
520         XCAST(Initialize)IDirectInputDevice2AImpl_Initialize,
521         XCAST(CreateEffect)IDirectInputDevice2AImpl_CreateEffect,
522         IDirectInputDevice2WImpl_EnumEffects,
523         IDirectInputDevice2WImpl_GetEffectInfo,
524         XCAST(GetForceFeedbackState)IDirectInputDevice2AImpl_GetForceFeedbackState,
525         XCAST(SendForceFeedbackCommand)IDirectInputDevice2AImpl_SendForceFeedbackCommand,
526         XCAST(EnumCreatedEffectObjects)IDirectInputDevice2AImpl_EnumCreatedEffectObjects,
527         XCAST(Escape)IDirectInputDevice2AImpl_Escape,
528         XCAST(Poll)IDirectInputDevice2AImpl_Poll,
529         XCAST(SendDeviceData)IDirectInputDevice2AImpl_SendDeviceData,
530         IDirectInputDevice7WImpl_EnumEffectsInFile,
531         IDirectInputDevice7WImpl_WriteEffectToFile,
532         IDirectInputDevice8WImpl_BuildActionMap,
533         IDirectInputDevice8WImpl_SetActionMap,
534         IDirectInputDevice8WImpl_GetImageInfo
535 };
536 #undef XCAST