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
49 struct IDirectInputDevice2AImpl base;
51 IDirectInputImpl* dinput;
53 /* SysKeyboardAImpl */
56 LPDIDEVICEOBJECTDATA data_queue; /* buffer for 'GetDeviceData'. Alloc at
57 'Acquire', Free at 'Unacquire' */
58 int queue_len; /* size of the queue - set in 'SetProperty' */
59 int queue_head; /* position to write new event into queue */
60 int queue_tail; /* next event to read from queue */
61 BOOL overflow; /* return DI_BUFFEROVERFLOW in 'GetDeviceData' */
62 CRITICAL_SECTION crit;
65 static SysKeyboardImpl* current_lock = NULL;
66 /* Today's acquired device
67 * FIXME: currently this can be only one.
68 * Maybe this should be a linked list or st.
69 * I don't know what the rules are for multiple acquired keyboards,
70 * but 'DI_LOSTFOCUS' and 'DI_UNACQUIRED' exist for a reason.
73 static BYTE DInputKeyState[WINE_DINPUT_KEYBOARD_MAX_KEYS]; /* array for 'GetDeviceState' */
75 LRESULT CALLBACK KeyboardCallback( int code, WPARAM wparam, LPARAM lparam )
77 SysKeyboardImpl *This = (SysKeyboardImpl *)current_lock;
79 KBDLLHOOKSTRUCT *hook = (KBDLLHOOKSTRUCT *)lparam;
82 TRACE("(%d,%d,%ld)\n", code, wparam, lparam);
84 /* returns now if not HC_ACTION */
85 if (code != HC_ACTION) return CallNextHookEx(0, code, wparam, lparam);
87 dik_code = hook->scanCode & 0xff;
88 if (hook->flags & LLKHF_EXTENDED) dik_code |= 0x80;
90 new_diks = hook->flags & LLKHF_UP ? 0 : 0x80;
92 /* returns now if key event already known */
93 if (new_diks == DInputKeyState[dik_code])
94 return CallNextHookEx(0, code, wparam, lparam);
96 DInputKeyState[dik_code] = new_diks;
97 TRACE(" setting %02X to %02X\n", dik_code, DInputKeyState[dik_code]);
99 EnterCriticalSection(&This->crit);
100 GEN_EVENT(dik_code, new_diks, hook->time, This->dinput->evsequence++);
101 LeaveCriticalSection(&This->crit);
103 if (This->base.hEvent) SetEvent(This->base.hEvent);
105 return CallNextHookEx(0, code, wparam, lparam);
108 static GUID DInput_Wine_Keyboard_GUID = { /* 0ab8648a-7735-11d2-8c73-71df54a96441 */
112 {0x8c, 0x73, 0x71, 0xdf, 0x54, 0xa9, 0x64, 0x41}
115 static void fill_keyboard_dideviceinstanceA(LPDIDEVICEINSTANCEA lpddi, DWORD version) {
117 DIDEVICEINSTANCEA ddi;
119 dwSize = lpddi->dwSize;
121 TRACE("%d %p\n", dwSize, lpddi);
123 memset(lpddi, 0, dwSize);
124 memset(&ddi, 0, sizeof(ddi));
127 ddi.guidInstance = GUID_SysKeyboard;/* DInput's GUID */
128 ddi.guidProduct = DInput_Wine_Keyboard_GUID; /* Vendor's GUID */
129 if (version >= 0x0800)
130 ddi.dwDevType = DI8DEVTYPE_KEYBOARD | (DI8DEVTYPEKEYBOARD_UNKNOWN << 8);
132 ddi.dwDevType = DIDEVTYPE_KEYBOARD | (DIDEVTYPEKEYBOARD_UNKNOWN << 8);
133 strcpy(ddi.tszInstanceName, "Keyboard");
134 strcpy(ddi.tszProductName, "Wine Keyboard");
136 memcpy(lpddi, &ddi, (dwSize < sizeof(ddi) ? dwSize : sizeof(ddi)));
139 static void fill_keyboard_dideviceinstanceW(LPDIDEVICEINSTANCEW lpddi, DWORD version) {
141 DIDEVICEINSTANCEW ddi;
143 dwSize = lpddi->dwSize;
145 TRACE("%d %p\n", dwSize, lpddi);
147 memset(lpddi, 0, dwSize);
148 memset(&ddi, 0, sizeof(ddi));
151 ddi.guidInstance = GUID_SysKeyboard;/* DInput's GUID */
152 ddi.guidProduct = DInput_Wine_Keyboard_GUID; /* Vendor's GUID */
153 if (version >= 0x0800)
154 ddi.dwDevType = DI8DEVTYPE_KEYBOARD | (DI8DEVTYPEKEYBOARD_UNKNOWN << 8);
156 ddi.dwDevType = DIDEVTYPE_KEYBOARD | (DIDEVTYPEKEYBOARD_UNKNOWN << 8);
157 MultiByteToWideChar(CP_ACP, 0, "Keyboard", -1, ddi.tszInstanceName, MAX_PATH);
158 MultiByteToWideChar(CP_ACP, 0, "Wine Keyboard", -1, ddi.tszProductName, MAX_PATH);
160 memcpy(lpddi, &ddi, (dwSize < sizeof(ddi) ? dwSize : sizeof(ddi)));
163 static BOOL keyboarddev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi, DWORD version, int id)
168 if ((dwDevType == 0) ||
169 ((dwDevType == DIDEVTYPE_KEYBOARD) && (version < 0x0800)) ||
170 (((dwDevType == DI8DEVCLASS_KEYBOARD) || (dwDevType == DI8DEVTYPE_KEYBOARD)) && (version >= 0x0800))) {
171 TRACE("Enumerating the Keyboard device\n");
173 fill_keyboard_dideviceinstanceA(lpddi, version);
181 static BOOL keyboarddev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEW lpddi, DWORD version, int id)
186 if ((dwDevType == 0) ||
187 ((dwDevType == DIDEVTYPE_KEYBOARD) && (version < 0x0800)) ||
188 (((dwDevType == DI8DEVCLASS_KEYBOARD) || (dwDevType == DI8DEVTYPE_KEYBOARD)) && (version >= 0x0800))) {
189 TRACE("Enumerating the Keyboard device\n");
191 fill_keyboard_dideviceinstanceW(lpddi, version);
199 static SysKeyboardImpl *alloc_device(REFGUID rguid, const void *kvt, IDirectInputImpl *dinput)
201 SysKeyboardImpl* newDevice;
203 newDevice = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(SysKeyboardImpl));
204 newDevice->base.lpVtbl = kvt;
205 newDevice->base.ref = 1;
206 memcpy(&newDevice->base.guid, rguid, sizeof(*rguid));
207 newDevice->dinput = dinput;
208 InitializeCriticalSection(&(newDevice->crit));
214 static HRESULT keyboarddev_create_deviceA(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEA* pdev)
216 if ((IsEqualGUID(&GUID_SysKeyboard,rguid)) || /* Generic Keyboard */
217 (IsEqualGUID(&DInput_Wine_Keyboard_GUID,rguid))) { /* Wine Keyboard */
218 if ((riid == NULL) ||
219 IsEqualGUID(&IID_IDirectInputDeviceA,riid) ||
220 IsEqualGUID(&IID_IDirectInputDevice2A,riid) ||
221 IsEqualGUID(&IID_IDirectInputDevice7A,riid) ||
222 IsEqualGUID(&IID_IDirectInputDevice8A,riid)) {
223 *pdev = (IDirectInputDeviceA*) alloc_device(rguid, &SysKeyboardAvt, dinput);
224 TRACE("Creating a Keyboard device (%p)\n", *pdev);
227 return DIERR_NOINTERFACE;
229 return DIERR_DEVICENOTREG;
232 static HRESULT keyboarddev_create_deviceW(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEW* pdev)
234 if ((IsEqualGUID(&GUID_SysKeyboard,rguid)) || /* Generic Keyboard */
235 (IsEqualGUID(&DInput_Wine_Keyboard_GUID,rguid))) { /* Wine Keyboard */
236 if ((riid == NULL) ||
237 IsEqualGUID(&IID_IDirectInputDeviceW,riid) ||
238 IsEqualGUID(&IID_IDirectInputDevice2W,riid) ||
239 IsEqualGUID(&IID_IDirectInputDevice7W,riid) ||
240 IsEqualGUID(&IID_IDirectInputDevice8W,riid)) {
241 *pdev = (IDirectInputDeviceW*) alloc_device(rguid, &SysKeyboardWvt, dinput);
242 TRACE("Creating a Keyboard device (%p)\n", *pdev);
245 return DIERR_NOINTERFACE;
247 return DIERR_DEVICENOTREG;
250 const struct dinput_device keyboard_device = {
251 "Wine keyboard driver",
252 keyboarddev_enum_deviceA,
253 keyboarddev_enum_deviceW,
254 keyboarddev_create_deviceA,
255 keyboarddev_create_deviceW
258 static ULONG WINAPI SysKeyboardAImpl_Release(LPDIRECTINPUTDEVICE8A iface)
260 SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
263 ref = InterlockedDecrement(&This->base.ref);
266 set_dinput_hook(WH_KEYBOARD_LL, NULL);
268 /* Free the data queue */
269 HeapFree(GetProcessHeap(), 0, This->data_queue);
271 DeleteCriticalSection(&(This->crit));
273 HeapFree(GetProcessHeap(),0,This);
277 static HRESULT WINAPI SysKeyboardAImpl_SetProperty(
278 LPDIRECTINPUTDEVICE8A iface,REFGUID rguid,LPCDIPROPHEADER ph
281 SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
283 TRACE("(this=%p,%s,%p)\n",This,debugstr_guid(rguid),ph);
284 TRACE("(size=%d,headersize=%d,obj=%d,how=%d\n",
285 ph->dwSize, ph->dwHeaderSize, ph->dwObj, ph->dwHow);
286 if (!HIWORD(rguid)) {
287 switch (LOWORD(rguid)) {
288 case (DWORD) DIPROP_BUFFERSIZE: {
289 LPCDIPROPDWORD pd = (LPCDIPROPDWORD)ph;
291 TRACE("(buffersize=%d)\n", pd->dwData);
294 return DIERR_INVALIDPARAM;
296 This->queue_len = pd->dwData;
301 WARN("Unknown type %p\n",rguid);
308 static HRESULT WINAPI SysKeyboardAImpl_GetProperty(
309 LPDIRECTINPUTDEVICE8A iface,REFGUID rguid,LPDIPROPHEADER ph
312 SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
314 TRACE("(this=%p,%s,%p)\n",This,debugstr_guid(rguid),ph);
315 TRACE("(size=%d,headersize=%d,obj=%d,how=%d\n",
316 ph->dwSize, ph->dwHeaderSize, ph->dwObj, ph->dwHow);
317 if (!HIWORD(rguid)) {
318 switch (LOWORD(rguid)) {
319 case (DWORD) DIPROP_BUFFERSIZE: {
320 LPDIPROPDWORD pd = (LPDIPROPDWORD)ph;
322 TRACE("(buffersize=%d)\n", pd->dwData);
325 return DIERR_INVALIDPARAM;
327 pd->dwData = This->queue_len;
332 WARN("Unknown type %p\n",rguid);
339 static HRESULT WINAPI SysKeyboardAImpl_GetDeviceState(
340 LPDIRECTINPUTDEVICE8A iface,DWORD len,LPVOID ptr
343 SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
344 TRACE("(%p)->(%d,%p)\n", This, len, ptr);
346 if (This->acquired == 0) return DIERR_NOTACQUIRED;
348 if (len != WINE_DINPUT_KEYBOARD_MAX_KEYS)
349 return DIERR_INVALIDPARAM;
351 MsgWaitForMultipleObjectsEx(0, NULL, 0, QS_ALLINPUT, 0);
353 EnterCriticalSection(&(This->crit));
355 if (TRACE_ON(dinput)) {
357 for (i = 0; i < WINE_DINPUT_KEYBOARD_MAX_KEYS; i++) {
358 if (DInputKeyState[i] != 0x00) {
359 TRACE(" - %02X: %02x\n", i, DInputKeyState[i]);
364 memcpy(ptr, DInputKeyState, WINE_DINPUT_KEYBOARD_MAX_KEYS);
365 LeaveCriticalSection(&(This->crit));
370 static HRESULT WINAPI SysKeyboardAImpl_GetDeviceData(
371 LPDIRECTINPUTDEVICE8A iface,DWORD dodsize,LPDIDEVICEOBJECTDATA dod,
372 LPDWORD entries,DWORD flags
375 SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
379 TRACE("(%p) %p -> %p(%d) x%d, 0x%08x\n",
380 This, dod, entries, entries ? *entries : 0, dodsize, flags);
383 return DIERR_NOTACQUIRED;
385 if (!This->data_queue)
386 return DIERR_NOTBUFFERED;
388 if (dodsize < sizeof(DIDEVICEOBJECTDATA_DX3))
389 return DIERR_INVALIDPARAM;
391 MsgWaitForMultipleObjectsEx(0, NULL, 0, QS_ALLINPUT, 0);
392 EnterCriticalSection(&This->crit);
394 len = ((This->queue_head < This->queue_tail) ? This->queue_len : 0) +
395 This->queue_head - This->queue_tail;
396 if ((*entries != INFINITE) && (len > *entries)) len = *entries;
401 for(i = 0; i < len; i++)
403 int n = (This->queue_tail + i) % This->queue_len;
404 memcpy((char *)dod + dodsize * i, This->data_queue + n, dodsize);
410 ret = DI_BUFFEROVERFLOW;
412 if (!(flags & DIGDD_PEEK))
415 This->queue_tail = (This->queue_tail + len) % This->queue_len;
416 This->overflow = FALSE;
419 LeaveCriticalSection(&This->crit);
421 TRACE("Returning %d events queued\n", *entries);
425 static HRESULT WINAPI SysKeyboardAImpl_EnumObjects(
426 LPDIRECTINPUTDEVICE8A iface,
427 LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback,
431 SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
432 DIDEVICEOBJECTINSTANCEA ddoi;
435 TRACE("(this=%p,%p,%p,%08x)\n", This, lpCallback, lpvRef, dwFlags);
436 if (TRACE_ON(dinput)) {
437 TRACE(" - flags = ");
438 _dump_EnumObjects_flags(dwFlags);
442 /* Only the fields till dwFFMaxForce are relevant */
443 memset(&ddoi, 0, sizeof(ddoi));
444 ddoi.dwSize = FIELD_OFFSET(DIDEVICEOBJECTINSTANCEA, dwFFMaxForce);
446 for (i = 0; i < WINE_DINPUT_KEYBOARD_MAX_KEYS; i++) {
447 /* Report 255 keys :-) */
448 ddoi.guidType = GUID_Key;
450 ddoi.dwType = DIDFT_MAKEINSTANCE(i) | DIDFT_BUTTON;
451 GetKeyNameTextA(((i & 0x7f) << 16) | ((i & 0x80) << 17), ddoi.tszName, sizeof(ddoi.tszName));
452 _dump_OBJECTINSTANCEA(&ddoi);
453 if (lpCallback(&ddoi, lpvRef) != DIENUM_CONTINUE) return DI_OK;
459 static HRESULT WINAPI SysKeyboardWImpl_EnumObjects(LPDIRECTINPUTDEVICE8W iface,
460 LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback,
464 SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
466 device_enumobjects_AtoWcb_data data;
468 data.lpCallBack = lpCallback;
469 data.lpvRef = lpvRef;
471 return SysKeyboardAImpl_EnumObjects((LPDIRECTINPUTDEVICE8A) This, (LPDIENUMDEVICEOBJECTSCALLBACKA) DIEnumDevicesCallbackAtoW, (LPVOID) &data, dwFlags);
474 static HRESULT WINAPI SysKeyboardAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface);
476 static HRESULT WINAPI SysKeyboardAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
478 SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
480 TRACE("(%p)\n",This);
482 if (This->acquired) return DI_NOEFFECT;
485 if (current_lock != NULL) {
486 FIXME("Not more than one keyboard can be acquired at the same time.\n");
487 SysKeyboardAImpl_Unacquire((LPDIRECTINPUTDEVICE8A)current_lock);
491 if (This->queue_len > 0)
493 This->data_queue = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
494 This->queue_len * sizeof(*(This->data_queue)));
495 This->queue_head = 0;
496 This->queue_tail = 0;
497 This->overflow = FALSE;
499 This->data_queue = NULL;
501 set_dinput_hook(WH_KEYBOARD_LL, KeyboardCallback);
506 static HRESULT WINAPI SysKeyboardAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface)
508 SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
509 TRACE("(this=%p)\n",This);
511 if (This->acquired == 0)
514 set_dinput_hook(WH_KEYBOARD_LL, NULL);
517 if (current_lock == This)
520 ERR("this != current_lock\n");
522 /* Unacquire device */
525 if (This->queue_len >= 0) {
526 HeapFree(GetProcessHeap(), 0, This->data_queue);
527 This->data_queue = NULL;
533 /******************************************************************************
534 * GetCapabilities : get the device capablitites
536 static HRESULT WINAPI SysKeyboardAImpl_GetCapabilities(
537 LPDIRECTINPUTDEVICE8A iface,
538 LPDIDEVCAPS lpDIDevCaps)
540 SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
543 TRACE("(this=%p,%p)\n",This,lpDIDevCaps);
545 if ((lpDIDevCaps->dwSize != sizeof(DIDEVCAPS)) && (lpDIDevCaps->dwSize != sizeof(DIDEVCAPS_DX3))) {
546 WARN("invalid parameter\n");
547 return DIERR_INVALIDPARAM;
550 devcaps.dwSize = lpDIDevCaps->dwSize;
551 devcaps.dwFlags = DIDC_ATTACHED;
552 if (This->dinput->dwVersion >= 0x0800)
553 devcaps.dwDevType = DI8DEVTYPE_KEYBOARD | (DI8DEVTYPEKEYBOARD_UNKNOWN << 8);
555 devcaps.dwDevType = DIDEVTYPE_KEYBOARD | (DIDEVTYPEKEYBOARD_UNKNOWN << 8);
557 devcaps.dwButtons = WINE_DINPUT_KEYBOARD_MAX_KEYS;
559 devcaps.dwFFSamplePeriod = 0;
560 devcaps.dwFFMinTimeResolution = 0;
561 devcaps.dwFirmwareRevision = 100;
562 devcaps.dwHardwareRevision = 100;
563 devcaps.dwFFDriverVersion = 0;
565 memcpy(lpDIDevCaps, &devcaps, lpDIDevCaps->dwSize);
570 /******************************************************************************
571 * GetObjectInfo : get information about a device object such as a button
574 static HRESULT WINAPI
575 SysKeyboardAImpl_GetObjectInfo(
576 LPDIRECTINPUTDEVICE8A iface,
577 LPDIDEVICEOBJECTINSTANCEA pdidoi,
581 SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
582 DIDEVICEOBJECTINSTANCEA ddoi;
583 DWORD dwSize = pdidoi->dwSize;
585 TRACE("(this=%p,%p,%d,0x%08x)\n", This, pdidoi, dwObj, dwHow);
587 if (dwHow == DIPH_BYID) {
588 WARN(" querying by id not supported yet...\n");
592 memset(pdidoi, 0, dwSize);
593 memset(&ddoi, 0, sizeof(ddoi));
595 ddoi.dwSize = dwSize;
596 ddoi.guidType = GUID_Key;
598 ddoi.dwType = DIDFT_MAKEINSTANCE(dwObj) | DIDFT_BUTTON;
599 GetKeyNameTextA(((dwObj & 0x7f) << 16) | ((dwObj & 0x80) << 17), ddoi.tszName, sizeof(ddoi.tszName));
601 /* And return our just filled device object instance structure */
602 memcpy(pdidoi, &ddoi, (dwSize < sizeof(ddoi) ? dwSize : sizeof(ddoi)));
604 _dump_OBJECTINSTANCEA(pdidoi);
609 static HRESULT WINAPI SysKeyboardWImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface,
610 LPDIDEVICEOBJECTINSTANCEW pdidoi,
614 SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
615 DIDEVICEOBJECTINSTANCEW ddoi;
616 DWORD dwSize = pdidoi->dwSize;
618 TRACE("(this=%p,%p,%d,0x%08x)\n", This, pdidoi, dwObj, dwHow);
620 if (dwHow == DIPH_BYID) {
621 WARN(" querying by id not supported yet...\n");
625 memset(pdidoi, 0, dwSize);
626 memset(&ddoi, 0, sizeof(ddoi));
628 ddoi.dwSize = dwSize;
629 ddoi.guidType = GUID_Key;
631 ddoi.dwType = DIDFT_MAKEINSTANCE(dwObj) | DIDFT_BUTTON;
632 GetKeyNameTextW(((dwObj & 0x7f) << 16) | ((dwObj & 0x80) << 17), ddoi.tszName, sizeof(ddoi.tszName));
634 /* And return our just filled device object instance structure */
635 memcpy(pdidoi, &ddoi, (dwSize < sizeof(ddoi) ? dwSize : sizeof(ddoi)));
637 _dump_OBJECTINSTANCEW(pdidoi);
642 /******************************************************************************
643 * GetDeviceInfo : get information about a device's identity
645 static HRESULT WINAPI SysKeyboardAImpl_GetDeviceInfo(
646 LPDIRECTINPUTDEVICE8A iface,
647 LPDIDEVICEINSTANCEA pdidi)
649 SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
650 TRACE("(this=%p,%p)\n", This, pdidi);
652 if (pdidi->dwSize != sizeof(DIDEVICEINSTANCEA)) {
653 WARN(" dinput3 not supported yet...\n");
657 fill_keyboard_dideviceinstanceA(pdidi, This->dinput->dwVersion);
662 static HRESULT WINAPI SysKeyboardWImpl_GetDeviceInfo(LPDIRECTINPUTDEVICE8W iface, LPDIDEVICEINSTANCEW pdidi)
664 SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
665 TRACE("(this=%p,%p)\n", This, pdidi);
667 if (pdidi->dwSize != sizeof(DIDEVICEINSTANCEW)) {
668 WARN(" dinput3 not supported yet...\n");
672 fill_keyboard_dideviceinstanceW(pdidi, This->dinput->dwVersion);
677 static const IDirectInputDevice8AVtbl SysKeyboardAvt =
679 IDirectInputDevice2AImpl_QueryInterface,
680 IDirectInputDevice2AImpl_AddRef,
681 SysKeyboardAImpl_Release,
682 SysKeyboardAImpl_GetCapabilities,
683 SysKeyboardAImpl_EnumObjects,
684 SysKeyboardAImpl_GetProperty,
685 SysKeyboardAImpl_SetProperty,
686 SysKeyboardAImpl_Acquire,
687 SysKeyboardAImpl_Unacquire,
688 SysKeyboardAImpl_GetDeviceState,
689 SysKeyboardAImpl_GetDeviceData,
690 IDirectInputDevice2AImpl_SetDataFormat,
691 IDirectInputDevice2AImpl_SetEventNotification,
692 IDirectInputDevice2AImpl_SetCooperativeLevel,
693 SysKeyboardAImpl_GetObjectInfo,
694 SysKeyboardAImpl_GetDeviceInfo,
695 IDirectInputDevice2AImpl_RunControlPanel,
696 IDirectInputDevice2AImpl_Initialize,
697 IDirectInputDevice2AImpl_CreateEffect,
698 IDirectInputDevice2AImpl_EnumEffects,
699 IDirectInputDevice2AImpl_GetEffectInfo,
700 IDirectInputDevice2AImpl_GetForceFeedbackState,
701 IDirectInputDevice2AImpl_SendForceFeedbackCommand,
702 IDirectInputDevice2AImpl_EnumCreatedEffectObjects,
703 IDirectInputDevice2AImpl_Escape,
704 IDirectInputDevice2AImpl_Poll,
705 IDirectInputDevice2AImpl_SendDeviceData,
706 IDirectInputDevice7AImpl_EnumEffectsInFile,
707 IDirectInputDevice7AImpl_WriteEffectToFile,
708 IDirectInputDevice8AImpl_BuildActionMap,
709 IDirectInputDevice8AImpl_SetActionMap,
710 IDirectInputDevice8AImpl_GetImageInfo
713 #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
714 # define XCAST(fun) (typeof(SysKeyboardWvt.fun))
716 # define XCAST(fun) (void*)
719 static const IDirectInputDevice8WVtbl SysKeyboardWvt =
721 IDirectInputDevice2WImpl_QueryInterface,
722 XCAST(AddRef)IDirectInputDevice2AImpl_AddRef,
723 XCAST(Release)SysKeyboardAImpl_Release,
724 XCAST(GetCapabilities)SysKeyboardAImpl_GetCapabilities,
725 SysKeyboardWImpl_EnumObjects,
726 XCAST(GetProperty)SysKeyboardAImpl_GetProperty,
727 XCAST(SetProperty)SysKeyboardAImpl_SetProperty,
728 XCAST(Acquire)SysKeyboardAImpl_Acquire,
729 XCAST(Unacquire)SysKeyboardAImpl_Unacquire,
730 XCAST(GetDeviceState)SysKeyboardAImpl_GetDeviceState,
731 XCAST(GetDeviceData)SysKeyboardAImpl_GetDeviceData,
732 XCAST(SetDataFormat)IDirectInputDevice2AImpl_SetDataFormat,
733 XCAST(SetEventNotification)IDirectInputDevice2AImpl_SetEventNotification,
734 XCAST(SetCooperativeLevel)IDirectInputDevice2AImpl_SetCooperativeLevel,
735 SysKeyboardWImpl_GetObjectInfo,
736 SysKeyboardWImpl_GetDeviceInfo,
737 XCAST(RunControlPanel)IDirectInputDevice2AImpl_RunControlPanel,
738 XCAST(Initialize)IDirectInputDevice2AImpl_Initialize,
739 XCAST(CreateEffect)IDirectInputDevice2AImpl_CreateEffect,
740 IDirectInputDevice2WImpl_EnumEffects,
741 IDirectInputDevice2WImpl_GetEffectInfo,
742 XCAST(GetForceFeedbackState)IDirectInputDevice2AImpl_GetForceFeedbackState,
743 XCAST(SendForceFeedbackCommand)IDirectInputDevice2AImpl_SendForceFeedbackCommand,
744 XCAST(EnumCreatedEffectObjects)IDirectInputDevice2AImpl_EnumCreatedEffectObjects,
745 XCAST(Escape)IDirectInputDevice2AImpl_Escape,
746 XCAST(Poll)IDirectInputDevice2AImpl_Poll,
747 XCAST(SendDeviceData)IDirectInputDevice2AImpl_SendDeviceData,
748 IDirectInputDevice7WImpl_EnumEffectsInFile,
749 IDirectInputDevice7WImpl_WriteEffectToFile,
750 IDirectInputDevice8WImpl_BuildActionMap,
751 IDirectInputDevice8WImpl_SetActionMap,
752 IDirectInputDevice8WImpl_GetImageInfo