1 /* DirectInput Keyboard device
3 * Copyright 1998 Marcus Meissner
4 * Copyright 1998,1999 Lionel Ulmer
5 * Copyright 2000-2001 TransGaming Technologies Inc.
6 * Copyright 2005 Raphael Junqueira
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.
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.
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
24 #include "wine/port.h"
34 #include "dinput_private.h"
35 #include "device_private.h"
36 #include "wine/debug.h"
37 #include "wine/unicode.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(dinput);
41 #define WINE_DINPUT_KEYBOARD_MAX_KEYS 256
43 static const IDirectInputDevice8AVtbl SysKeyboardAvt;
44 static const IDirectInputDevice8WVtbl SysKeyboardWvt;
46 typedef struct SysKeyboardImpl SysKeyboardImpl;
47 struct SysKeyboardImpl
53 IDirectInputImpl* dinput;
56 /* SysKeyboardAImpl */
59 LPDIDEVICEOBJECTDATA data_queue; /* buffer for 'GetDeviceData'. Alloc at
60 'Acquire', Free at 'Unacquire' */
61 int queue_len; /* size of the queue - set in 'SetProperty' */
62 int queue_head; /* position to write new event into queue */
63 int queue_tail; /* next event to read from queue */
64 BOOL overflow; /* return DI_BUFFEROVERFLOW in 'GetDeviceData' */
65 CRITICAL_SECTION crit;
68 static SysKeyboardImpl* current_lock = NULL;
69 /* Today's acquired device
70 * FIXME: currently this can be only one.
71 * Maybe this should be a linked list or st.
72 * I don't know what the rules are for multiple acquired keyboards,
73 * but 'DI_LOSTFOCUS' and 'DI_UNACQUIRED' exist for a reason.
76 static BYTE DInputKeyState[WINE_DINPUT_KEYBOARD_MAX_KEYS]; /* array for 'GetDeviceState' */
78 LRESULT CALLBACK KeyboardCallback( int code, WPARAM wparam, LPARAM lparam )
80 SysKeyboardImpl *This = (SysKeyboardImpl *)current_lock;
82 KBDLLHOOKSTRUCT *hook = (KBDLLHOOKSTRUCT *)lparam;
85 TRACE("(%d,%d,%ld)\n", code, wparam, lparam);
87 /* returns now if not HC_ACTION */
88 if (code != HC_ACTION) return CallNextHookEx(0, code, wparam, lparam);
90 dik_code = hook->scanCode & 0xff;
91 if (hook->flags & LLKHF_EXTENDED) dik_code |= 0x80;
93 new_diks = hook->flags & LLKHF_UP ? 0 : 0x80;
95 /* returns now if key event already known */
96 if (new_diks == DInputKeyState[dik_code])
97 return CallNextHookEx(0, code, wparam, lparam);
99 DInputKeyState[dik_code] = new_diks;
100 TRACE(" setting %02X to %02X\n", dik_code, DInputKeyState[dik_code]);
102 EnterCriticalSection(&This->crit);
103 GEN_EVENT(dik_code, new_diks, hook->time, This->dinput->evsequence++);
104 LeaveCriticalSection(&This->crit);
106 if (This->hEvent) SetEvent(This->hEvent);
108 return CallNextHookEx(0, code, wparam, lparam);
111 static GUID DInput_Wine_Keyboard_GUID = { /* 0ab8648a-7735-11d2-8c73-71df54a96441 */
115 {0x8c, 0x73, 0x71, 0xdf, 0x54, 0xa9, 0x64, 0x41}
118 static void fill_keyboard_dideviceinstanceA(LPDIDEVICEINSTANCEA lpddi, DWORD version) {
120 DIDEVICEINSTANCEA ddi;
122 dwSize = lpddi->dwSize;
124 TRACE("%ld %p\n", dwSize, lpddi);
126 memset(lpddi, 0, dwSize);
127 memset(&ddi, 0, sizeof(ddi));
130 ddi.guidInstance = GUID_SysKeyboard;/* DInput's GUID */
131 ddi.guidProduct = DInput_Wine_Keyboard_GUID; /* Vendor's GUID */
132 if (version >= 0x0800)
133 ddi.dwDevType = DI8DEVTYPE_KEYBOARD | (DI8DEVTYPEKEYBOARD_UNKNOWN << 8);
135 ddi.dwDevType = DIDEVTYPE_KEYBOARD | (DIDEVTYPEKEYBOARD_UNKNOWN << 8);
136 strcpy(ddi.tszInstanceName, "Keyboard");
137 strcpy(ddi.tszProductName, "Wine Keyboard");
139 memcpy(lpddi, &ddi, (dwSize < sizeof(ddi) ? dwSize : sizeof(ddi)));
142 static void fill_keyboard_dideviceinstanceW(LPDIDEVICEINSTANCEW lpddi, DWORD version) {
144 DIDEVICEINSTANCEW ddi;
146 dwSize = lpddi->dwSize;
148 TRACE("%ld %p\n", dwSize, lpddi);
150 memset(lpddi, 0, dwSize);
151 memset(&ddi, 0, sizeof(ddi));
154 ddi.guidInstance = GUID_SysKeyboard;/* DInput's GUID */
155 ddi.guidProduct = DInput_Wine_Keyboard_GUID; /* Vendor's GUID */
156 if (version >= 0x0800)
157 ddi.dwDevType = DI8DEVTYPE_KEYBOARD | (DI8DEVTYPEKEYBOARD_UNKNOWN << 8);
159 ddi.dwDevType = DIDEVTYPE_KEYBOARD | (DIDEVTYPEKEYBOARD_UNKNOWN << 8);
160 MultiByteToWideChar(CP_ACP, 0, "Keyboard", -1, ddi.tszInstanceName, MAX_PATH);
161 MultiByteToWideChar(CP_ACP, 0, "Wine Keyboard", -1, ddi.tszProductName, MAX_PATH);
163 memcpy(lpddi, &ddi, (dwSize < sizeof(ddi) ? dwSize : sizeof(ddi)));
166 static BOOL keyboarddev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi, DWORD version, int id)
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");
176 fill_keyboard_dideviceinstanceA(lpddi, version);
184 static BOOL keyboarddev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEW lpddi, DWORD version, int id)
189 if ((dwDevType == 0) ||
190 ((dwDevType == DIDEVTYPE_KEYBOARD) && (version < 0x0800)) ||
191 (((dwDevType == DI8DEVCLASS_KEYBOARD) || (dwDevType == DI8DEVTYPE_KEYBOARD)) && (version >= 0x0800))) {
192 TRACE("Enumerating the Keyboard device\n");
194 fill_keyboard_dideviceinstanceW(lpddi, version);
202 static SysKeyboardImpl *alloc_device(REFGUID rguid, const void *kvt, IDirectInputImpl *dinput)
204 SysKeyboardImpl* newDevice;
206 newDevice = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(SysKeyboardImpl));
207 newDevice->lpVtbl = kvt;
209 memcpy(&(newDevice->guid),rguid,sizeof(*rguid));
210 newDevice->dinput = dinput;
211 InitializeCriticalSection(&(newDevice->crit));
217 static HRESULT keyboarddev_create_deviceA(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEA* pdev)
219 if ((IsEqualGUID(&GUID_SysKeyboard,rguid)) || /* Generic Keyboard */
220 (IsEqualGUID(&DInput_Wine_Keyboard_GUID,rguid))) { /* Wine Keyboard */
221 if ((riid == NULL) ||
222 IsEqualGUID(&IID_IDirectInputDeviceA,riid) ||
223 IsEqualGUID(&IID_IDirectInputDevice2A,riid) ||
224 IsEqualGUID(&IID_IDirectInputDevice7A,riid) ||
225 IsEqualGUID(&IID_IDirectInputDevice8A,riid)) {
226 *pdev = (IDirectInputDeviceA*) alloc_device(rguid, &SysKeyboardAvt, dinput);
227 TRACE("Creating a Keyboard device (%p)\n", *pdev);
230 return DIERR_NOINTERFACE;
232 return DIERR_DEVICENOTREG;
235 static HRESULT keyboarddev_create_deviceW(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEW* pdev)
237 if ((IsEqualGUID(&GUID_SysKeyboard,rguid)) || /* Generic Keyboard */
238 (IsEqualGUID(&DInput_Wine_Keyboard_GUID,rguid))) { /* Wine Keyboard */
239 if ((riid == NULL) ||
240 IsEqualGUID(&IID_IDirectInputDeviceW,riid) ||
241 IsEqualGUID(&IID_IDirectInputDevice2W,riid) ||
242 IsEqualGUID(&IID_IDirectInputDevice7W,riid) ||
243 IsEqualGUID(&IID_IDirectInputDevice8W,riid)) {
244 *pdev = (IDirectInputDeviceW*) alloc_device(rguid, &SysKeyboardWvt, dinput);
245 TRACE("Creating a Keyboard device (%p)\n", *pdev);
248 return DIERR_NOINTERFACE;
250 return DIERR_DEVICENOTREG;
253 const struct dinput_device keyboard_device = {
254 "Wine keyboard driver",
255 keyboarddev_enum_deviceA,
256 keyboarddev_enum_deviceW,
257 keyboarddev_create_deviceA,
258 keyboarddev_create_deviceW
261 static ULONG WINAPI SysKeyboardAImpl_Release(LPDIRECTINPUTDEVICE8A iface)
263 SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
266 ref = InterlockedDecrement(&(This->ref));
269 set_dinput_hook(WH_KEYBOARD_LL, NULL);
271 /* Free the data queue */
272 HeapFree(GetProcessHeap(), 0, This->data_queue);
274 DeleteCriticalSection(&(This->crit));
276 HeapFree(GetProcessHeap(),0,This);
280 static HRESULT WINAPI SysKeyboardAImpl_SetProperty(
281 LPDIRECTINPUTDEVICE8A iface,REFGUID rguid,LPCDIPROPHEADER ph
284 SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
286 TRACE("(this=%p,%s,%p)\n",This,debugstr_guid(rguid),ph);
287 TRACE("(size=%ld,headersize=%ld,obj=%ld,how=%ld\n",
288 ph->dwSize,ph->dwHeaderSize,ph->dwObj,ph->dwHow);
289 if (!HIWORD(rguid)) {
290 switch (LOWORD(rguid)) {
291 case (DWORD) DIPROP_BUFFERSIZE: {
292 LPCDIPROPDWORD pd = (LPCDIPROPDWORD)ph;
294 TRACE("(buffersize=%ld)\n",pd->dwData);
297 return DIERR_INVALIDPARAM;
299 This->queue_len = pd->dwData;
304 WARN("Unknown type %p\n",rguid);
311 static HRESULT WINAPI SysKeyboardAImpl_GetProperty(
312 LPDIRECTINPUTDEVICE8A iface,REFGUID rguid,LPDIPROPHEADER ph
315 SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
317 TRACE("(this=%p,%s,%p)\n",This,debugstr_guid(rguid),ph);
318 TRACE("(size=%ld,headersize=%ld,obj=%ld,how=%ld\n",
319 ph->dwSize,ph->dwHeaderSize,ph->dwObj,ph->dwHow);
320 if (!HIWORD(rguid)) {
321 switch (LOWORD(rguid)) {
322 case (DWORD) DIPROP_BUFFERSIZE: {
323 LPDIPROPDWORD pd = (LPDIPROPDWORD)ph;
325 TRACE("(buffersize=%ld)\n",pd->dwData);
328 return DIERR_INVALIDPARAM;
330 pd->dwData = This->queue_len;
335 WARN("Unknown type %p\n",rguid);
342 static HRESULT WINAPI SysKeyboardAImpl_GetDeviceState(
343 LPDIRECTINPUTDEVICE8A iface,DWORD len,LPVOID ptr
346 SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
347 TRACE("(%p)->(%ld,%p)\n", This, len, ptr);
349 if (This->acquired == 0) return DIERR_NOTACQUIRED;
351 if (len != WINE_DINPUT_KEYBOARD_MAX_KEYS)
352 return DIERR_INVALIDPARAM;
354 MsgWaitForMultipleObjectsEx(0, NULL, 0, QS_ALLINPUT, 0);
356 EnterCriticalSection(&(This->crit));
358 if (TRACE_ON(dinput)) {
360 for (i = 0; i < WINE_DINPUT_KEYBOARD_MAX_KEYS; i++) {
361 if (DInputKeyState[i] != 0x00) {
362 TRACE(" - %02X: %02x\n", i, DInputKeyState[i]);
367 memcpy(ptr, DInputKeyState, WINE_DINPUT_KEYBOARD_MAX_KEYS);
368 LeaveCriticalSection(&(This->crit));
373 static HRESULT WINAPI SysKeyboardAImpl_GetDeviceData(
374 LPDIRECTINPUTDEVICE8A iface,DWORD dodsize,LPDIDEVICEOBJECTDATA dod,
375 LPDWORD entries,DWORD flags
378 SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
382 TRACE("(%p) %p -> %p(%ld) x%ld, 0x%08lx\n",
383 This, dod, entries, entries ? *entries : 0, dodsize, flags);
386 return DIERR_NOTACQUIRED;
388 if (!This->data_queue)
389 return DIERR_NOTBUFFERED;
391 if (dodsize < sizeof(DIDEVICEOBJECTDATA_DX3))
392 return DIERR_INVALIDPARAM;
394 MsgWaitForMultipleObjectsEx(0, NULL, 0, QS_ALLINPUT, 0);
395 EnterCriticalSection(&This->crit);
397 len = ((This->queue_head < This->queue_tail) ? This->queue_len : 0) +
398 This->queue_head - This->queue_tail;
399 if ((*entries != INFINITE) && (len > *entries)) len = *entries;
404 for(i = 0; i < len; i++)
406 int n = (This->queue_tail + i) % This->queue_len;
407 memcpy((char *)dod + dodsize * i, This->data_queue + n, dodsize);
413 ret = DI_BUFFEROVERFLOW;
415 if (!(flags & DIGDD_PEEK))
418 This->queue_tail = (This->queue_tail + len) % This->queue_len;
419 This->overflow = FALSE;
422 LeaveCriticalSection(&This->crit);
424 TRACE("Returning %ld events queued\n", *entries);
428 static HRESULT WINAPI SysKeyboardAImpl_EnumObjects(
429 LPDIRECTINPUTDEVICE8A iface,
430 LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback,
434 SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
435 DIDEVICEOBJECTINSTANCEA ddoi;
438 TRACE("(this=%p,%p,%p,%08lx)\n", This, lpCallback, lpvRef, dwFlags);
439 if (TRACE_ON(dinput)) {
440 TRACE(" - flags = ");
441 _dump_EnumObjects_flags(dwFlags);
445 /* Only the fields till dwFFMaxForce are relevant */
446 memset(&ddoi, 0, sizeof(ddoi));
447 ddoi.dwSize = FIELD_OFFSET(DIDEVICEOBJECTINSTANCEA, dwFFMaxForce);
449 for (i = 0; i < WINE_DINPUT_KEYBOARD_MAX_KEYS; i++) {
450 /* Report 255 keys :-) */
451 ddoi.guidType = GUID_Key;
453 ddoi.dwType = DIDFT_MAKEINSTANCE(i) | DIDFT_BUTTON;
454 GetKeyNameTextA(((i & 0x7f) << 16) | ((i & 0x80) << 17), ddoi.tszName, sizeof(ddoi.tszName));
455 _dump_OBJECTINSTANCEA(&ddoi);
456 if (lpCallback(&ddoi, lpvRef) != DIENUM_CONTINUE) return DI_OK;
462 static HRESULT WINAPI SysKeyboardWImpl_EnumObjects(LPDIRECTINPUTDEVICE8W iface,
463 LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback,
467 SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
469 device_enumobjects_AtoWcb_data data;
471 data.lpCallBack = lpCallback;
472 data.lpvRef = lpvRef;
474 return SysKeyboardAImpl_EnumObjects((LPDIRECTINPUTDEVICE8A) This, (LPDIENUMDEVICEOBJECTSCALLBACKA) DIEnumDevicesCallbackAtoW, (LPVOID) &data, dwFlags);
477 static HRESULT WINAPI SysKeyboardAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface);
479 static HRESULT WINAPI SysKeyboardAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
481 SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
483 TRACE("(%p)\n",This);
485 if (This->acquired) return DI_NOEFFECT;
488 if (current_lock != NULL) {
489 FIXME("Not more than one keyboard can be acquired at the same time.\n");
490 SysKeyboardAImpl_Unacquire((LPDIRECTINPUTDEVICE8A)current_lock);
494 if (This->queue_len > 0)
496 This->data_queue = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
497 This->queue_len * sizeof(*(This->data_queue)));
498 This->queue_head = 0;
499 This->queue_tail = 0;
500 This->overflow = FALSE;
502 This->data_queue = NULL;
504 set_dinput_hook(WH_KEYBOARD_LL, KeyboardCallback);
509 static HRESULT WINAPI SysKeyboardAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface)
511 SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
512 TRACE("(this=%p)\n",This);
514 if (This->acquired == 0)
517 set_dinput_hook(WH_KEYBOARD_LL, NULL);
520 if (current_lock == This)
523 ERR("this != current_lock\n");
525 /* Unacquire device */
528 if (This->queue_len >= 0) {
529 HeapFree(GetProcessHeap(), 0, This->data_queue);
530 This->data_queue = NULL;
536 static HRESULT WINAPI SysKeyboardAImpl_SetEventNotification(LPDIRECTINPUTDEVICE8A iface,
538 SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
540 TRACE("(this=%p,%p)\n",This,hnd);
546 /******************************************************************************
547 * GetCapabilities : get the device capablitites
549 static HRESULT WINAPI SysKeyboardAImpl_GetCapabilities(
550 LPDIRECTINPUTDEVICE8A iface,
551 LPDIDEVCAPS lpDIDevCaps)
553 SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
556 TRACE("(this=%p,%p)\n",This,lpDIDevCaps);
558 if ((lpDIDevCaps->dwSize != sizeof(DIDEVCAPS)) && (lpDIDevCaps->dwSize != sizeof(DIDEVCAPS_DX3))) {
559 WARN("invalid parameter\n");
560 return DIERR_INVALIDPARAM;
563 devcaps.dwSize = lpDIDevCaps->dwSize;
564 devcaps.dwFlags = DIDC_ATTACHED;
565 if (This->dinput->dwVersion >= 0x0800)
566 devcaps.dwDevType = DI8DEVTYPE_KEYBOARD | (DI8DEVTYPEKEYBOARD_UNKNOWN << 8);
568 devcaps.dwDevType = DIDEVTYPE_KEYBOARD | (DIDEVTYPEKEYBOARD_UNKNOWN << 8);
570 devcaps.dwButtons = WINE_DINPUT_KEYBOARD_MAX_KEYS;
572 devcaps.dwFFSamplePeriod = 0;
573 devcaps.dwFFMinTimeResolution = 0;
574 devcaps.dwFirmwareRevision = 100;
575 devcaps.dwHardwareRevision = 100;
576 devcaps.dwFFDriverVersion = 0;
578 memcpy(lpDIDevCaps, &devcaps, lpDIDevCaps->dwSize);
583 /******************************************************************************
584 * GetObjectInfo : get information about a device object such as a button
587 static HRESULT WINAPI
588 SysKeyboardAImpl_GetObjectInfo(
589 LPDIRECTINPUTDEVICE8A iface,
590 LPDIDEVICEOBJECTINSTANCEA pdidoi,
594 SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
595 DIDEVICEOBJECTINSTANCEA ddoi;
596 DWORD dwSize = pdidoi->dwSize;
598 TRACE("(this=%p,%p,%ld,0x%08lx)\n", This, pdidoi, dwObj, dwHow);
600 if (dwHow == DIPH_BYID) {
601 WARN(" querying by id not supported yet...\n");
605 memset(pdidoi, 0, dwSize);
606 memset(&ddoi, 0, sizeof(ddoi));
608 ddoi.dwSize = dwSize;
609 ddoi.guidType = GUID_Key;
611 ddoi.dwType = DIDFT_MAKEINSTANCE(dwObj) | DIDFT_BUTTON;
612 GetKeyNameTextA(((dwObj & 0x7f) << 16) | ((dwObj & 0x80) << 17), ddoi.tszName, sizeof(ddoi.tszName));
614 /* And return our just filled device object instance structure */
615 memcpy(pdidoi, &ddoi, (dwSize < sizeof(ddoi) ? dwSize : sizeof(ddoi)));
617 _dump_OBJECTINSTANCEA(pdidoi);
622 static HRESULT WINAPI SysKeyboardWImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface,
623 LPDIDEVICEOBJECTINSTANCEW pdidoi,
627 SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
628 DIDEVICEOBJECTINSTANCEW ddoi;
629 DWORD dwSize = pdidoi->dwSize;
631 TRACE("(this=%p,%p,%ld,0x%08lx)\n", This, pdidoi, dwObj, dwHow);
633 if (dwHow == DIPH_BYID) {
634 WARN(" querying by id not supported yet...\n");
638 memset(pdidoi, 0, dwSize);
639 memset(&ddoi, 0, sizeof(ddoi));
641 ddoi.dwSize = dwSize;
642 ddoi.guidType = GUID_Key;
644 ddoi.dwType = DIDFT_MAKEINSTANCE(dwObj) | DIDFT_BUTTON;
645 GetKeyNameTextW(((dwObj & 0x7f) << 16) | ((dwObj & 0x80) << 17), ddoi.tszName, sizeof(ddoi.tszName));
647 /* And return our just filled device object instance structure */
648 memcpy(pdidoi, &ddoi, (dwSize < sizeof(ddoi) ? dwSize : sizeof(ddoi)));
650 _dump_OBJECTINSTANCEW(pdidoi);
655 /******************************************************************************
656 * GetDeviceInfo : get information about a device's identity
658 static HRESULT WINAPI SysKeyboardAImpl_GetDeviceInfo(
659 LPDIRECTINPUTDEVICE8A iface,
660 LPDIDEVICEINSTANCEA pdidi)
662 SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
663 TRACE("(this=%p,%p)\n", This, pdidi);
665 if (pdidi->dwSize != sizeof(DIDEVICEINSTANCEA)) {
666 WARN(" dinput3 not supported yet...\n");
670 fill_keyboard_dideviceinstanceA(pdidi, This->dinput->dwVersion);
675 static HRESULT WINAPI SysKeyboardWImpl_GetDeviceInfo(LPDIRECTINPUTDEVICE8W iface, LPDIDEVICEINSTANCEW pdidi)
677 SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
678 TRACE("(this=%p,%p)\n", This, pdidi);
680 if (pdidi->dwSize != sizeof(DIDEVICEINSTANCEW)) {
681 WARN(" dinput3 not supported yet...\n");
685 fill_keyboard_dideviceinstanceW(pdidi, This->dinput->dwVersion);
690 static const IDirectInputDevice8AVtbl SysKeyboardAvt =
692 IDirectInputDevice2AImpl_QueryInterface,
693 IDirectInputDevice2AImpl_AddRef,
694 SysKeyboardAImpl_Release,
695 SysKeyboardAImpl_GetCapabilities,
696 SysKeyboardAImpl_EnumObjects,
697 SysKeyboardAImpl_GetProperty,
698 SysKeyboardAImpl_SetProperty,
699 SysKeyboardAImpl_Acquire,
700 SysKeyboardAImpl_Unacquire,
701 SysKeyboardAImpl_GetDeviceState,
702 SysKeyboardAImpl_GetDeviceData,
703 IDirectInputDevice2AImpl_SetDataFormat,
704 SysKeyboardAImpl_SetEventNotification,
705 IDirectInputDevice2AImpl_SetCooperativeLevel,
706 SysKeyboardAImpl_GetObjectInfo,
707 SysKeyboardAImpl_GetDeviceInfo,
708 IDirectInputDevice2AImpl_RunControlPanel,
709 IDirectInputDevice2AImpl_Initialize,
710 IDirectInputDevice2AImpl_CreateEffect,
711 IDirectInputDevice2AImpl_EnumEffects,
712 IDirectInputDevice2AImpl_GetEffectInfo,
713 IDirectInputDevice2AImpl_GetForceFeedbackState,
714 IDirectInputDevice2AImpl_SendForceFeedbackCommand,
715 IDirectInputDevice2AImpl_EnumCreatedEffectObjects,
716 IDirectInputDevice2AImpl_Escape,
717 IDirectInputDevice2AImpl_Poll,
718 IDirectInputDevice2AImpl_SendDeviceData,
719 IDirectInputDevice7AImpl_EnumEffectsInFile,
720 IDirectInputDevice7AImpl_WriteEffectToFile,
721 IDirectInputDevice8AImpl_BuildActionMap,
722 IDirectInputDevice8AImpl_SetActionMap,
723 IDirectInputDevice8AImpl_GetImageInfo
726 #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
727 # define XCAST(fun) (typeof(SysKeyboardWvt.fun))
729 # define XCAST(fun) (void*)
732 static const IDirectInputDevice8WVtbl SysKeyboardWvt =
734 IDirectInputDevice2WImpl_QueryInterface,
735 XCAST(AddRef)IDirectInputDevice2AImpl_AddRef,
736 XCAST(Release)SysKeyboardAImpl_Release,
737 XCAST(GetCapabilities)SysKeyboardAImpl_GetCapabilities,
738 SysKeyboardWImpl_EnumObjects,
739 XCAST(GetProperty)SysKeyboardAImpl_GetProperty,
740 XCAST(SetProperty)SysKeyboardAImpl_SetProperty,
741 XCAST(Acquire)SysKeyboardAImpl_Acquire,
742 XCAST(Unacquire)SysKeyboardAImpl_Unacquire,
743 XCAST(GetDeviceState)SysKeyboardAImpl_GetDeviceState,
744 XCAST(GetDeviceData)SysKeyboardAImpl_GetDeviceData,
745 XCAST(SetDataFormat)IDirectInputDevice2AImpl_SetDataFormat,
746 XCAST(SetEventNotification)SysKeyboardAImpl_SetEventNotification,
747 XCAST(SetCooperativeLevel)IDirectInputDevice2AImpl_SetCooperativeLevel,
748 SysKeyboardWImpl_GetObjectInfo,
749 SysKeyboardWImpl_GetDeviceInfo,
750 XCAST(RunControlPanel)IDirectInputDevice2AImpl_RunControlPanel,
751 XCAST(Initialize)IDirectInputDevice2AImpl_Initialize,
752 XCAST(CreateEffect)IDirectInputDevice2AImpl_CreateEffect,
753 IDirectInputDevice2WImpl_EnumEffects,
754 IDirectInputDevice2WImpl_GetEffectInfo,
755 XCAST(GetForceFeedbackState)IDirectInputDevice2AImpl_GetForceFeedbackState,
756 XCAST(SendForceFeedbackCommand)IDirectInputDevice2AImpl_SendForceFeedbackCommand,
757 XCAST(EnumCreatedEffectObjects)IDirectInputDevice2AImpl_EnumCreatedEffectObjects,
758 XCAST(Escape)IDirectInputDevice2AImpl_Escape,
759 XCAST(Poll)IDirectInputDevice2AImpl_Poll,
760 XCAST(SendDeviceData)IDirectInputDevice2AImpl_SendDeviceData,
761 IDirectInputDevice7WImpl_EnumEffectsInFile,
762 IDirectInputDevice7WImpl_WriteEffectToFile,
763 IDirectInputDevice8WImpl_BuildActionMap,
764 IDirectInputDevice8WImpl_SetActionMap,
765 IDirectInputDevice8WImpl_GetImageInfo