19#define DIRECTINPUT_VERSION 0x0700
53 trace(
"Loading keyboard layout %s\n", hkl_name);
57 win_skip(
"Unable to load keyboard layout %s\n", hkl_name);
61 ok(*hkl_orig != 0,
"Unable to activate keyboard layout %s\n", hkl_name);
62 if (!*hkl_orig)
return 0;
83 IDirectInputDeviceA *pKeyboard;
96 UINT prev_raw_devices_count, raw_devices_count;
113 ok(
SUCCEEDED(
hr),
"IDirectInputDevice_SetDataFormat() failed: %08x\n",
hr);
115 ok(
SUCCEEDED(
hr),
"IDirectInputDevice_SetCooperativeLevel() failed: %08x\n",
hr);
121 ok(
hr ==
S_FALSE,
"IDirectInputDevice_Unacquire() should have failed: %08x\n",
hr);
125 ok(
hr ==
S_FALSE,
"IDirectInputDevice_Acquire() should have failed: %08x\n",
hr);
129 ok(
SUCCEEDED(
hr),
"IDirectInputDevice_GetDeviceState() failed: %08x\n",
hr);
133 ok(
SUCCEEDED(
hr),
"IDirectInputDevice_SetDataFormat() failed: %08x\n",
hr);
137 ok(
SUCCEEDED(
hr),
"IDirectInputDevice_GetDeviceState(4,) failed: %08x\n",
hr);
141 memset(custom_state, 0x56,
sizeof(custom_state));
144 ok(custom_state[
i] == 0,
"Should be zeroed, got 0x%08x\n", custom_state[
i]);
152 ok(
SUCCEEDED(
hr),
"IDirectInputDevice_GetDeviceState() failed: %08x\n",
hr);
153 if (!custom_state[0])
154 win_skip(
"Keyboard event not processed, skipping test\n");
159 ok(
SUCCEEDED(
hr),
"IDirectInputDevice_Unacquire() failed: %08x\n",
hr);
163 ok(
SUCCEEDED(
hr),
"IDirectInputDevice_GetDeviceState failed: %08x\n",
hr);
165 ok(custom_state[
i] == 0,
"Should be zeroed, got 0x%08x\n", custom_state[
i]);
169 prev_raw_devices_count = 0;
171 ok(prev_raw_devices_count == 0 ||
broken(prev_raw_devices_count == 1) ,
172 "Unexpected raw devices registered: %d\n", prev_raw_devices_count);
177 raw_devices_count = 0;
179 ok(raw_devices_count == prev_raw_devices_count,
180 "Unexpected raw devices registered: %d\n", raw_devices_count);
183 ok(
SUCCEEDED(
hr),
"IDirectInputDevice_Unacquire() failed: %08x\n",
hr);
185 if (pKeyboard) IUnknown_Release(pKeyboard);
218 IDirectInputDeviceA *pKeyboard =
NULL;
253 if (pKeyboard) IUnknown_Release(pKeyboard);
259 IDirectInputDeviceA *pKeyboard =
NULL;
266 memset(&diprg, 0,
sizeof(diprg));
275 if (pKeyboard) IUnknown_Release(pKeyboard);
281 IDirectInputDeviceA *pKeyboard =
NULL;
283 int kbd_type, kbd_subtype, dev_subtype;
289 caps.
dwSize =
sizeof(caps);
295 "GetCapabilities invalid device type for dwDevType: 0x%08x\n", caps.
dwDevType);
299 if (kbd_type == 4 || (kbd_type == 7 && kbd_subtype == 0))
301 "GetCapabilities invalid device subtype for dwDevType: 0x%08x (%04x:%04x)\n",
303 else if (kbd_type == 7 && kbd_subtype == 2)
305 "GetCapabilities invalid device subtype for dwDevType: 0x%08x (%04x:%04x)\n",
309 "GetCapabilities invalid device subtype for dwDevType: 0x%08x (%04x:%04x)\n",
312 IUnknown_Release(pKeyboard);
317 static const struct key2dik
322 {
'Q',
DIK_Q}, {
'W',
DIK_W}, {
'E',
DIK_E}, {
'R',
DIK_R}, {
'T',
DIK_T}, {
'Y',
DIK_Y},
327 {
'A',
DIK_Q}, {
'Z',
DIK_W}, {
'E',
DIK_E}, {
'R',
DIK_R}, {
'T',
DIK_T}, {
'Y',
DIK_Y},
332 {
'Q',
DIK_Q}, {
'W',
DIK_W}, {
'E',
DIK_E}, {
'R',
DIK_R}, {
'T',
DIK_T}, {
'Z',
DIK_Y},
337 {
'Q',
DIK_Q}, {
'W',
DIK_W}, {
'E',
DIK_E}, {
'R',
DIK_R}, {
'T',
DIK_T}, {
'Y',
DIK_Y},
343 const struct key2dik *
map;
356 const struct key2dik *
map =
NULL;
359 IDirectInputDeviceA *
device;
376 ok(
hr ==
S_OK,
"CreateDevice() failed: %08x\n",
hr);
378 ok(
hr ==
S_OK,
"SetDataFormat() failed: %08x\n",
hr);
380 ok(
hr ==
S_OK,
"Acquire() failed: %08x\n",
hr);
381 caps.
dwSize =
sizeof( caps );
383 ok(
hr ==
S_OK,
"GetDeviceInstance() failed: %08x\n",
hr);
385 skip(
"Keyboard type(%u) doesn't match for lang %04x\n",
405 ok(
n != 0xffff,
"%u: failed to get virtual key value for %c(%02x)\n",
i,
map[
i].
key,
map[
i].
key);
414 ok(scan ==
map[
i].dik,
"%u: expected %02x, got %02x\n",
i,
map[
i].dik,
n);
417 ok(scan,
"%u: fail to get scan code value, expected %02x (vkey=%02x)\n",
418 i,
map[
i].dik, vkey);
422 U(
in).ki.wScan = scan;
423 U(
in).ki.dwFlags = 0;
424 U(
in).ki.dwExtraInfo = 0;
427 ok(
n == 1,
"got %u\n",
n);
433 win_skip(
"failed to queue keyboard event\n");
440 trace(
"keydown wParam: %#08lx (%c) lParam: %#08lx, MapVirtualKey(MAPVK_VK_TO_CHAR) = %c\n",
447 ok(
hr ==
S_OK,
"GetDeviceState() failed: %08x\n",
hr);
450 if (
i == 0 && kbd_state[
map[0].dik] != 0x80)
452 win_skip(
"dinput failed to handle keyboard event\n");
457 ok(kbd_state[
map[
i].dik] == 0x80,
"DI key %#x has state %#x\n",
map[
i].dik, kbd_state[
map[
i].dik]);
461 ok(
n == 1,
"got %u\n",
n);
484 instA.
dwSize =
sizeof(instA);
488 inst3A.
dwSize =
sizeof(inst3A);
499 IUnknown_Release(
pKey);
505 IDirectInputA *pDI =
NULL;
513 skip(
"Tests require a newer dinput version\n");
541 if (pDI)
ref = IUnknown_Release(pDI);
542 ok(!
ref,
"IDirectInput_Release() reference count = %d\n",
ref);
#define GetProcAddress(x, y)
static const WCHAR version[]
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
GLuint GLuint GLsizei GLenum type
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define sprintf(buf, format,...)
#define todo_wine_if(is_todo)
#define WS_OVERLAPPEDWINDOW
#define IsEqualGUID(rguid1, rguid2)
#define SUBLANG_JAPANESE_JAPAN
static __inline const char * wine_dbgstr_guid(const GUID *id)
TW_UINT32 TW_UINT16 TW_UINT16 MSG
UINT WINAPI DECLSPEC_HOTPATCH GetRegisteredRawInputDevices(PRAWINPUTDEVICE pRawInputDevices, PUINT puiNumDevices, UINT cbSize)
UINT WINAPI SendInput(UINT, LPINPUT, int)
DWORD WINAPI GetLastError(void)
LRESULT WINAPI DispatchMessageA(_In_ const MSG *)
HKL WINAPI GetKeyboardLayout(_In_ DWORD)
BOOL WINAPI UnloadKeyboardLayout(_In_ HKL)
BOOL WINAPI TranslateMessage(_In_ const MSG *)
UINT WINAPI MapVirtualKeyExA(_In_ UINT, _In_ UINT, _In_opt_ HKL)
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
BOOL WINAPI SetForegroundWindow(_In_ HWND)
HWND WINAPI SetFocus(_In_opt_ HWND)
HKL WINAPI LoadKeyboardLayoutA(_In_ LPCSTR, _In_ UINT)
SHORT WINAPI VkKeyScanExW(_In_ WCHAR, _In_ HKL)
VOID WINAPI keybd_event(_In_ BYTE, _In_ BYTE, _In_ DWORD, _In_ ULONG_PTR)
BOOL WINAPI PeekMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
int WINAPI GetKeyboardType(_In_ int)
HKL WINAPI ActivateKeyboardLayout(_In_ HKL, _In_ UINT)
BOOL WINAPI DestroyWindow(_In_ HWND)