ReactOS 0.4.16-dev-112-g52265ae
device.c
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011 Lucas Fialho Zawacki
3 * Copyright (c) 2006 Vitaliy Margolen
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18 */
19
20#define DIRECTINPUT_VERSION 0x0800
21
22#define COBJMACROS
23#include <windows.h>
24
25#include "wine/test.h"
26#include "windef.h"
27#include "dinput.h"
28
29struct enum_data {
30 IDirectInput8A *pDI;
32 IDirectInputDevice8A *keyboard;
33 IDirectInputDevice8A *mouse;
34 const char* username;
36};
37
38/* Dummy GUID */
39static const GUID ACTION_MAPPING_GUID = { 0x1, 0x2, 0x3, { 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb } };
40
41static const GUID NULL_GUID = { 0, 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0 } };
42
43enum {
49};
50
52{
53 /* axis */
54 { 0, 0x01008A01 /* DIAXIS_DRIVINGR_STEER */, 0, { "Steer.\0" } },
55 /* button */
56 { 1, 0x01000C01 /* DIBUTTON_DRIVINGR_SHIFTUP */, 0, { "Upshift.\0" } },
57 /* keyboard key */
58 { 2, DIKEYBOARD_SPACE, 0, { "Missile.\0" } },
59 /* mouse button */
60 { 3, DIMOUSE_BUTTON0, 0, { "Select\0" } },
61 /* mouse axis */
62 { 4, DIMOUSE_YAXIS, 0, { "Y Axis\0" } }
63};
64/* By placing the memory pointed to by lptszActionName right before memory with PAGE_NOACCESS
65 * one can find out that the regular ansi string termination is not respected by EnumDevicesBySemantics.
66 * Adding a double termination, making it a valid wide string termination, made the test succeed.
67 * Therefore it looks like ansi version of EnumDevicesBySemantics forwards the string to
68 * the wide variant without conversation. */
69
70static void flush_events(void)
71{
72 int diff = 200;
73 int min_timeout = 100;
74 DWORD time = GetTickCount() + diff;
75
76 while (diff > 0)
77 {
79 break;
80 diff = time - GetTickCount();
81 min_timeout = 50;
82 }
83}
84
85static void test_device_input(IDirectInputDevice8A *lpdid, DWORD event_type, DWORD event, DWORD expected)
86{
87 HRESULT hr;
88 DIDEVICEOBJECTDATA obj_data;
89 DWORD data_size = 1;
90 int i;
91
93 ok (SUCCEEDED(hr), "Failed to acquire device hr=%08x\n", hr);
94
95 if (event_type == INPUT_KEYBOARD)
97
98 if (event_type == INPUT_MOUSE)
99 mouse_event( event, 0, 0, 0, 0);
100
101 flush_events();
103 hr = IDirectInputDevice8_GetDeviceData(lpdid, sizeof(obj_data), &obj_data, &data_size, 0);
104
105 if (data_size != 1)
106 {
107 win_skip("We're not able to inject input into Windows dinput8 with events\n");
109 return;
110 }
111
112 ok (obj_data.uAppData == expected, "Retrieval of action failed uAppData=%lu expected=%d\n", obj_data.uAppData, expected);
113
114 /* Check for buffer overflow */
115 for (i = 0; i < 17; i++)
116 if (event_type == INPUT_KEYBOARD)
117 {
120 }
121 else if (event_type == INPUT_MOUSE)
122 {
124 mouse_event(MOUSEEVENTF_LEFTUP, 1, 1, 0, 0);
125 }
126
127 flush_events();
129
130 data_size = 1;
131 hr = IDirectInputDevice8_GetDeviceData(lpdid, sizeof(obj_data), &obj_data, &data_size, 0);
132 ok(hr == DI_BUFFEROVERFLOW, "GetDeviceData() failed: %08x\n", hr);
133 data_size = 1;
134 hr = IDirectInputDevice8_GetDeviceData(lpdid, sizeof(obj_data), &obj_data, &data_size, 0);
135 ok(hr == DI_OK && data_size == 1, "GetDeviceData() failed: %08x cnt:%d\n", hr, data_size);
136
138}
139
140static void test_build_action_map(IDirectInputDevice8A *lpdid, DIACTIONFORMATA *lpdiaf,
141 int action_index, DWORD expected_type, DWORD expected_inst)
142{
143 HRESULT hr;
144 DIACTIONA *actions;
145 DWORD instance, type, how;
146 GUID assigned_to;
148
149 ddi.dwSize = sizeof(ddi);
151
153 ok (SUCCEEDED(hr), "BuildActionMap failed hr=%08x\n", hr);
154
155 actions = lpdiaf->rgoAction;
156 instance = DIDFT_GETINSTANCE(actions[action_index].dwObjID);
157 type = DIDFT_GETTYPE(actions[action_index].dwObjID);
158 how = actions[action_index].dwHow;
159 assigned_to = actions[action_index].guidInstance;
160
161 ok (how == DIAH_USERCONFIG || how == DIAH_DEFAULT, "Action was not set dwHow=%08x\n", how);
162 ok (instance == expected_inst, "Action not mapped correctly instance=%08x expected=%08x\n", instance, expected_inst);
163 ok (type == expected_type, "Action type not mapped correctly type=%08x expected=%08x\n", type, expected_type);
164 ok (IsEqualGUID(&assigned_to, &ddi.guidInstance), "Action and device GUID do not match action=%d\n", action_index);
165}
166
167static BOOL CALLBACK enumeration_callback(const DIDEVICEINSTANCEA *lpddi, IDirectInputDevice8A *lpdid,
168 DWORD dwFlags, DWORD dwRemaining, LPVOID pvRef)
169{
170 HRESULT hr;
171 DIPROPDWORD dp;
172 DIPROPRANGE dpr;
173 DIPROPSTRING dps;
174 WCHAR usernameW[MAX_PATH];
175 DWORD username_size = MAX_PATH;
176 struct enum_data *data = pvRef;
177 DWORD cnt;
179 IDirectInputDevice8A *lpdid2;
180
181 if (!data) return DIENUM_CONTINUE;
182
183 data->ndevices++;
184
185 /* Convert username to WCHAR */
186 if (data->username != NULL)
187 {
188 username_size = MultiByteToWideChar(CP_ACP, 0, data->username, -1, usernameW, 0);
189 MultiByteToWideChar(CP_ACP, 0, data->username, -1, usernameW, username_size);
190 }
191 else
192 GetUserNameW(usernameW, &username_size);
193
194 /* collect the mouse and keyboard */
195 if (IsEqualGUID(&lpddi->guidInstance, &GUID_SysKeyboard))
196 {
198 data->keyboard = lpdid;
199
200 ok (dwFlags & DIEDBS_MAPPEDPRI1, "Keyboard should be mapped as pri1 dwFlags=%08x\n", dwFlags);
201 }
202
203 if (IsEqualGUID(&lpddi->guidInstance, &GUID_SysMouse))
204 {
206 data->mouse = lpdid;
207
208 ok (dwFlags & DIEDBS_MAPPEDPRI1, "Mouse should be mapped as pri1 dwFlags=%08x\n", dwFlags);
209 }
210
211 /* Creating second device object to check if it has the same username */
212 hr = IDirectInput_CreateDevice(data->pDI, &lpddi->guidInstance, &lpdid2, NULL);
213 ok(SUCCEEDED(hr), "IDirectInput_CreateDevice() failed: %08x\n", hr);
214
215 /* Building and setting an action map */
216 /* It should not use any pre-stored mappings so we use DIDBAM_HWDEFAULTS */
218 ok (SUCCEEDED(hr), "BuildActionMap failed hr=%08x\n", hr);
219
220 /* Device has no data format and thus can't be acquired */
222 ok (hr == DIERR_INVALIDPARAM, "Device was acquired before SetActionMap hr=%08x\n", hr);
223
224 hr = IDirectInputDevice8_SetActionMap(lpdid, data->lpdiaf, data->username, 0);
225 ok (SUCCEEDED(hr), "SetActionMap failed hr=%08x\n", hr);
226
227 /* Some joysticks may have no suitable actions and thus should not be tested */
228 if (hr == DI_NOEFFECT) return DIENUM_CONTINUE;
229
230 /* Test username after SetActionMap */
231 dps.diph.dwSize = sizeof(dps);
232 dps.diph.dwHeaderSize = sizeof(DIPROPHEADER);
233 dps.diph.dwObj = 0;
234 dps.diph.dwHow = DIPH_DEVICE;
235 dps.wsz[0] = '\0';
236
238 ok (SUCCEEDED(hr), "GetProperty failed hr=%08x\n", hr);
239 ok (!lstrcmpW(usernameW, dps.wsz), "Username not set correctly expected=%s, got=%s\n", wine_dbgstr_w(usernameW), wine_dbgstr_w(dps.wsz));
240
241 dps.wsz[0] = '\0';
243 ok (SUCCEEDED(hr), "GetProperty failed hr=%08x\n", hr);
244 ok (!lstrcmpW(usernameW, dps.wsz), "Username not set correctly expected=%s, got=%s\n", wine_dbgstr_w(usernameW), wine_dbgstr_w(dps.wsz));
245
246 /* Test buffer size */
247 memset(&dp, 0, sizeof(dp));
248 dp.diph.dwSize = sizeof(dp);
249 dp.diph.dwHeaderSize = sizeof(DIPROPHEADER);
251
253 ok (SUCCEEDED(hr), "GetProperty failed hr=%08x\n", hr);
254 ok (dp.dwData == data->lpdiaf->dwBufferSize, "SetActionMap must set the buffer, buffersize=%d\n", dp.dwData);
255
256 cnt = 1;
257 hr = IDirectInputDevice_GetDeviceData(lpdid, sizeof(buffer[0]), buffer, &cnt, 0);
258 ok(hr == DIERR_NOTACQUIRED, "GetDeviceData() failed hr=%08x\n", hr);
259
260 /* Test axis range */
261 memset(&dpr, 0, sizeof(dpr));
262 dpr.diph.dwSize = sizeof(dpr);
263 dpr.diph.dwHeaderSize = sizeof(DIPROPHEADER);
264 dpr.diph.dwHow = DIPH_DEVICE;
265
267 /* Only test if device supports the range property */
268 if (SUCCEEDED(hr))
269 {
270 ok (dpr.lMin == data->lpdiaf->lAxisMin, "SetActionMap must set the min axis range expected=%d got=%d\n", data->lpdiaf->lAxisMin, dpr.lMin);
271 ok (dpr.lMax == data->lpdiaf->lAxisMax, "SetActionMap must set the max axis range expected=%d got=%d\n", data->lpdiaf->lAxisMax, dpr.lMax);
272 }
273
274 /* SetActionMap has set the data format so now it should work */
276 ok (SUCCEEDED(hr), "Acquire failed hr=%08x\n", hr);
277
278 cnt = 1;
279 hr = IDirectInputDevice_GetDeviceData(lpdid, sizeof(buffer[0]), buffer, &cnt, 0);
280 ok(hr == DI_OK, "GetDeviceData() failed hr=%08x\n", hr);
281
282 /* SetActionMap should not work on an acquired device */
283 hr = IDirectInputDevice8_SetActionMap(lpdid, data->lpdiaf, NULL, 0);
284 ok (hr == DIERR_ACQUIRED, "SetActionMap succeeded with an acquired device hr=%08x\n", hr);
285
287
288 return DIENUM_CONTINUE;
289}
290
291static void test_action_mapping(void)
292{
293 HRESULT hr;
295 IDirectInput8A *pDI = NULL;
297 DIPROPSTRING dps;
298 struct enum_data data = {pDI, &af, NULL, NULL, NULL, 0};
299 HWND hwnd;
300
301 hr = CoCreateInstance(&CLSID_DirectInput8, 0, CLSCTX_INPROC_SERVER, &IID_IDirectInput8A, (LPVOID*)&pDI);
305 {
306 win_skip("ActionMapping requires dinput8\n");
307 return;
308 }
309 ok(SUCCEEDED(hr), "DirectInput8 Create failed: hr=%08x\n", hr);
310 if (FAILED(hr)) return;
311
314 {
315 win_skip("ActionMapping requires dinput8\n");
316 return;
317 }
318 ok(SUCCEEDED(hr), "DirectInput8 Initialize failed: hr=%08x\n", hr);
319 if (FAILED(hr)) return;
320
321 memset (&af, 0, sizeof(af));
322 af.dwSize = sizeof(af);
323 af.dwActionSize = sizeof(DIACTIONA);
328 af.dwGenre = 0x01000000; /* DIVIRTUAL_DRIVING_RACE */
329 af.dwBufferSize = 32;
330
331 /* This enumeration builds and sets the action map for all devices */
332 data.pDI = pDI;
334 ok (SUCCEEDED(hr), "EnumDevicesBySemantics failed: hr=%08x\n", hr);
335
336 if (data.keyboard)
338
339 if (data.mouse)
341
342 /* Repeat tests with a non NULL user */
343 data.username = "Ninja Brian";
345 ok (SUCCEEDED(hr), "EnumDevicesBySemantics failed: hr=%08x\n", hr);
346
347 hwnd = CreateWindowExA(WS_EX_TOPMOST, "static", "dinput",
348 WS_POPUP | WS_VISIBLE, 0, 0, 100, 100, NULL, NULL, NULL, NULL);
349 ok(hwnd != NULL, "failed to create window\n");
350 SetCursorPos(50, 50);
351
352 if (data.keyboard != NULL)
353 {
354 /* Test keyboard BuildActionMap */
356 /* Test keyboard input */
358
359 /* Test BuildActionMap with no suitable actions for a device */
363
365 ok (hr == DI_NOEFFECT, "BuildActionMap should have no effect with no actions hr=%08x\n", hr);
366
367 hr = IDirectInputDevice8_SetActionMap(data.keyboard, data.lpdiaf, NULL, 0);
368 ok (hr == DI_NOEFFECT, "SetActionMap should have no effect with no actions to map hr=%08x\n", hr);
369
370 /* Test that after changing actionformat SetActionMap has effect and that second
371 * SetActionMap call with same empty actionformat has no effect */
372 af.dwDataSize = 4 * 1;
373 af.dwNumActions = 1;
374
375 hr = IDirectInputDevice8_SetActionMap(data.keyboard, data.lpdiaf, NULL, 0);
376 ok (hr != DI_NOEFFECT, "SetActionMap should have effect as actionformat has changed hr=%08x\n", hr);
377
378 hr = IDirectInputDevice8_SetActionMap(data.keyboard, data.lpdiaf, NULL, 0);
379 ok (hr == DI_NOEFFECT, "SetActionMap should have no effect with no actions to map hr=%08x\n", hr);
380
383
384 /* test DIDSAM_NOUSER */
385 dps.diph.dwSize = sizeof(dps);
386 dps.diph.dwHeaderSize = sizeof(DIPROPHEADER);
387 dps.diph.dwObj = 0;
388 dps.diph.dwHow = DIPH_DEVICE;
389 dps.wsz[0] = '\0';
390
392 ok (SUCCEEDED(hr), "GetProperty failed hr=%08x\n", hr);
393 ok (dps.wsz[0] != 0, "Expected any username, got=%s\n", wine_dbgstr_w(dps.wsz));
394
396 ok (SUCCEEDED(hr), "SetActionMap failed hr=%08x\n", hr);
397
398 dps.diph.dwSize = sizeof(dps);
399 dps.diph.dwHeaderSize = sizeof(DIPROPHEADER);
400 dps.diph.dwObj = 0;
401 dps.diph.dwHow = DIPH_DEVICE;
402 dps.wsz[0] = '\0';
403
405 ok (SUCCEEDED(hr), "GetProperty failed hr=%08x\n", hr);
406 ok (dps.wsz[0] == 0, "Expected empty username, got=%s\n", wine_dbgstr_w(dps.wsz));
407
409 }
410
411 if (data.mouse != NULL)
412 {
413 /* Test mouse BuildActionMap */
416
418
420 }
421
424}
425
426static void test_save_settings(void)
427{
428 HRESULT hr;
430 IDirectInput8A *pDI = NULL;
432 IDirectInputDevice8A *pKey;
433
434 static const GUID mapping_guid = { 0xcafecafe, 0x2, 0x3, { 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb } };
435 static const GUID other_guid = { 0xcafe, 0xcafe, 0x3, { 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb } };
436
437 static DIACTIONA actions[] = {
438 { 0, DIKEYBOARD_A , 0, { "Blam" } },
439 { 1, DIKEYBOARD_B , 0, { "Kapow"} }
440 };
441 static const DWORD results[] = {
444 };
445 static const DWORD other_results[] = {
448 };
449
450 hr = CoCreateInstance(&CLSID_DirectInput8, 0, CLSCTX_INPROC_SERVER, &IID_IDirectInput8A, (LPVOID*)&pDI);
454 {
455 win_skip("ActionMapping requires dinput8\n");
456 return;
457 }
458 ok (SUCCEEDED(hr), "DirectInput8 Create failed: hr=%08x\n", hr);
459 if (FAILED(hr)) return;
460
463 {
464 win_skip("ActionMapping requires dinput8\n");
465 return;
466 }
467 ok (SUCCEEDED(hr), "DirectInput8 Initialize failed: hr=%08x\n", hr);
468 if (FAILED(hr)) return;
469
470 hr = IDirectInput_CreateDevice(pDI, &GUID_SysKeyboard, &pKey, NULL);
471 ok (SUCCEEDED(hr), "IDirectInput_Create device failed hr: 0x%08x\n", hr);
472 if (FAILED(hr)) return;
473
474 memset (&af, 0, sizeof(af));
475 af.dwSize = sizeof(af);
476 af.dwActionSize = sizeof(DIACTIONA);
477 af.dwDataSize = 4 * ARRAY_SIZE(actions);
478 af.dwNumActions = ARRAY_SIZE(actions);
479 af.rgoAction = actions;
480 af.guidActionMap = mapping_guid;
481 af.dwGenre = 0x01000000; /* DIVIRTUAL_DRIVING_RACE */
482 af.dwBufferSize = 32;
483
484 /* Easy case. Ask for default mapping, save, ask for previous map and read it back */
486 ok (SUCCEEDED(hr), "BuildActionMap failed hr=%08x\n", hr);
487 ok (results[0] == af.rgoAction[0].dwObjID,
488 "Mapped incorrectly expected: 0x%08x got: 0x%08x\n", results[0], af.rgoAction[0].dwObjID);
489
490 ok (results[1] == af.rgoAction[1].dwObjID,
491 "Mapped incorrectly expected: 0x%08x got: 0x%08x\n", results[1], af.rgoAction[1].dwObjID);
492
494 ok (SUCCEEDED(hr), "SetActionMap failed hr=%08x\n", hr);
495
496 if (hr == DI_SETTINGSNOTSAVED)
497 {
498 skip ("Can't test saving settings if SetActionMap returns DI_SETTINGSNOTSAVED\n");
499 return;
500 }
501
502 af.rgoAction[0].dwObjID = 0;
503 af.rgoAction[1].dwObjID = 0;
504 memset(&af.rgoAction[0].guidInstance, 0, sizeof(GUID));
505 memset(&af.rgoAction[1].guidInstance, 0, sizeof(GUID));
506
508 ok (SUCCEEDED(hr), "BuildActionMap failed hr=%08x\n", hr);
509
510 ok (results[0] == af.rgoAction[0].dwObjID,
511 "Mapped incorrectly expected: 0x%08x got: 0x%08x\n", results[0], af.rgoAction[0].dwObjID);
512 ok (IsEqualGUID(&GUID_SysKeyboard, &af.rgoAction[0].guidInstance), "Action should be mapped to keyboard\n");
513
514 ok (results[1] == af.rgoAction[1].dwObjID,
515 "Mapped incorrectly expected: 0x%08x got: 0x%08x\n", results[1], af.rgoAction[1].dwObjID);
516 ok (IsEqualGUID(&GUID_SysKeyboard, &af.rgoAction[1].guidInstance), "Action should be mapped to keyboard\n");
517
518 /* Test that a different action map with no pre-stored settings, in spite of the flags,
519 does not try to load mappings and instead applies the default mapping */
520 af.guidActionMap = other_guid;
521
522 af.rgoAction[0].dwObjID = 0;
523 af.rgoAction[1].dwObjID = 0;
524 memset(&af.rgoAction[0].guidInstance, 0, sizeof(GUID));
525 memset(&af.rgoAction[1].guidInstance, 0, sizeof(GUID));
526
528 ok (SUCCEEDED(hr), "BuildActionMap failed hr=%08x\n", hr);
529
530 ok (results[0] == af.rgoAction[0].dwObjID,
531 "Mapped incorrectly expected: 0x%08x got: 0x%08x\n", results[0], af.rgoAction[0].dwObjID);
532 ok (IsEqualGUID(&GUID_SysKeyboard, &af.rgoAction[0].guidInstance), "Action should be mapped to keyboard\n");
533
534 ok (results[1] == af.rgoAction[1].dwObjID,
535 "Mapped incorrectly expected: 0x%08x got: 0x%08x\n", results[1], af.rgoAction[1].dwObjID);
536 ok (IsEqualGUID(&GUID_SysKeyboard, &af.rgoAction[1].guidInstance), "Action should be mapped to keyboard\n");
537
538 af.guidActionMap = mapping_guid;
539 /* Hard case. Customized mapping, save, ask for previous map and read it back */
540 af.rgoAction[0].dwObjID = other_results[0];
542 af.rgoAction[0].guidInstance = GUID_SysKeyboard;
543 af.rgoAction[1].dwObjID = other_results[1];
545 af.rgoAction[1].guidInstance = GUID_SysKeyboard;
546
548 ok (SUCCEEDED(hr), "SetActionMap failed hr=%08x\n", hr);
549
550 if (hr == DI_SETTINGSNOTSAVED)
551 {
552 skip ("Can't test saving settings if SetActionMap returns DI_SETTINGSNOTSAVED\n");
553 return;
554 }
555
556 af.rgoAction[0].dwObjID = 0;
557 af.rgoAction[1].dwObjID = 0;
558 memset(&af.rgoAction[0].guidInstance, 0, sizeof(GUID));
559 memset(&af.rgoAction[1].guidInstance, 0, sizeof(GUID));
560
562 ok (SUCCEEDED(hr), "BuildActionMap failed hr=%08x\n", hr);
563
564 ok (other_results[0] == af.rgoAction[0].dwObjID,
565 "Mapped incorrectly expected: 0x%08x got: 0x%08x\n", other_results[0], af.rgoAction[0].dwObjID);
566 ok (IsEqualGUID(&GUID_SysKeyboard, &af.rgoAction[0].guidInstance), "Action should be mapped to keyboard\n");
567
568 ok (other_results[1] == af.rgoAction[1].dwObjID,
569 "Mapped incorrectly expected: 0x%08x got: 0x%08x\n", other_results[1], af.rgoAction[1].dwObjID);
570 ok (IsEqualGUID(&GUID_SysKeyboard, &af.rgoAction[1].guidInstance), "Action should be mapped to keyboard\n");
571
572 /* Save and load empty mapping */
573 af.rgoAction[0].dwObjID = 0;
574 af.rgoAction[0].dwHow = 0;
575 memset(&af.rgoAction[0].guidInstance, 0, sizeof(GUID));
576 af.rgoAction[1].dwObjID = 0;
577 af.rgoAction[1].dwHow = 0;
578 memset(&af.rgoAction[1].guidInstance, 0, sizeof(GUID));
579
581 ok (SUCCEEDED(hr), "SetActionMap failed hr=%08x\n", hr);
582
583 if (hr == DI_SETTINGSNOTSAVED)
584 {
585 skip ("Can't test saving settings if SetActionMap returns DI_SETTINGSNOTSAVED\n");
586 return;
587 }
588
589 af.rgoAction[0].dwObjID = other_results[0];
591 af.rgoAction[0].guidInstance = GUID_SysKeyboard;
592 af.rgoAction[1].dwObjID = other_results[1];
594 af.rgoAction[1].guidInstance = GUID_SysKeyboard;
595
597 ok (SUCCEEDED(hr), "BuildActionMap failed hr=%08x\n", hr);
598
599 ok (other_results[0] == af.rgoAction[0].dwObjID,
600 "Mapped incorrectly expected: 0x%08x got: 0x%08x\n", other_results[0], af.rgoAction[0].dwObjID);
601 ok (af.rgoAction[0].dwHow == DIAH_UNMAPPED, "dwHow should have been DIAH_UNMAPPED\n");
602 ok (IsEqualGUID(&NULL_GUID, &af.rgoAction[0].guidInstance), "Action should not be mapped\n");
603
604 ok (other_results[1] == af.rgoAction[1].dwObjID,
605 "Mapped incorrectly expected: 0x%08x got: 0x%08x\n", other_results[1], af.rgoAction[1].dwObjID);
606 ok (af.rgoAction[1].dwHow == DIAH_UNMAPPED, "dwHow should have been DIAH_UNMAPPED\n");
607 ok (IsEqualGUID(&NULL_GUID, &af.rgoAction[1].guidInstance), "Action should not be mapped\n");
608
611}
612
613static void test_mouse_keyboard(void)
614{
615 HRESULT hr;
616 HWND hwnd, di_hwnd = INVALID_HANDLE_VALUE;
617 IDirectInput8A *di = NULL;
618 IDirectInputDevice8A *di_mouse, *di_keyboard;
619 UINT raw_devices_count;
620 RAWINPUTDEVICE raw_devices[3];
621
622 hwnd = CreateWindowExA(WS_EX_TOPMOST, "static", "dinput", WS_POPUP | WS_VISIBLE, 0, 0, 100, 100, NULL, NULL, NULL, NULL);
623 ok(hwnd != NULL, "CreateWindowExA failed\n");
624
625 hr = CoCreateInstance(&CLSID_DirectInput8, 0, CLSCTX_INPROC_SERVER, &IID_IDirectInput8A, (LPVOID*)&di);
629 {
630 win_skip("test_mouse_keyboard requires dinput8\n");
631 return;
632 }
633 ok(SUCCEEDED(hr), "DirectInput8Create failed: %08x\n", hr);
634
637 {
638 win_skip("test_mouse_keyboard requires dinput8\n");
639 return;
640 }
641 ok(SUCCEEDED(hr), "IDirectInput8_Initialize failed: %08x\n", hr);
642
643 hr = IDirectInput8_CreateDevice(di, &GUID_SysMouse, &di_mouse, NULL);
644 ok(SUCCEEDED(hr), "IDirectInput8_CreateDevice failed: %08x\n", hr);
646 ok(SUCCEEDED(hr), "IDirectInputDevice8_SetDataFormat failed: %08x\n", hr);
647
648 hr = IDirectInput8_CreateDevice(di, &GUID_SysKeyboard, &di_keyboard, NULL);
649 ok(SUCCEEDED(hr), "IDirectInput8_CreateDevice failed: %08x\n", hr);
651 ok(SUCCEEDED(hr), "IDirectInputDevice8_SetDataFormat failed: %08x\n", hr);
652
653 raw_devices_count = ARRAY_SIZE(raw_devices);
654 GetRegisteredRawInputDevices(NULL, &raw_devices_count, sizeof(RAWINPUTDEVICE));
656 ok(raw_devices_count == 0, "Unexpected raw devices registered: %d\n", raw_devices_count);
657
658 hr = IDirectInputDevice8_Acquire(di_keyboard);
659 ok(SUCCEEDED(hr), "IDirectInputDevice8_Acquire failed: %08x\n", hr);
660 raw_devices_count = ARRAY_SIZE(raw_devices);
661 memset(raw_devices, 0, sizeof(raw_devices));
662 hr = GetRegisteredRawInputDevices(raw_devices, &raw_devices_count, sizeof(RAWINPUTDEVICE));
664 ok(hr == 1, "GetRegisteredRawInputDevices returned %d, raw_devices_count: %d\n", hr, raw_devices_count);
666 ok(raw_devices[0].usUsagePage == 1, "Unexpected raw device usage page: %x\n", raw_devices[0].usUsagePage);
668 ok(raw_devices[0].usUsage == 6, "Unexpected raw device usage: %x\n", raw_devices[0].usUsage);
670 ok(raw_devices[0].dwFlags == RIDEV_INPUTSINK, "Unexpected raw device flags: %x\n", raw_devices[0].dwFlags);
672 ok(raw_devices[0].hwndTarget != NULL, "Unexpected raw device target: %p\n", raw_devices[0].hwndTarget);
673 hr = IDirectInputDevice8_Unacquire(di_keyboard);
674 ok(SUCCEEDED(hr), "IDirectInputDevice8_Acquire failed: %08x\n", hr);
675 raw_devices_count = ARRAY_SIZE(raw_devices);
676 GetRegisteredRawInputDevices(NULL, &raw_devices_count, sizeof(RAWINPUTDEVICE));
678 ok(raw_devices_count == 0, "Unexpected raw devices registered: %d\n", raw_devices_count);
679
680 if (raw_devices[0].hwndTarget != NULL)
681 {
682 WCHAR di_hwnd_class[] = {'D','I','E','m','W','i','n',0};
683 WCHAR str[16];
684 int i;
685
686 di_hwnd = raw_devices[0].hwndTarget;
687 i = GetClassNameW(di_hwnd, str, ARRAY_SIZE(str));
688 ok(i == lstrlenW(di_hwnd_class), "GetClassName returned incorrect length\n");
689 ok(!lstrcmpW(di_hwnd_class, str), "GetClassName returned incorrect name for this window's class\n");
690
691 i = GetWindowTextW(di_hwnd, str, ARRAY_SIZE(str));
692 ok(i == lstrlenW(di_hwnd_class), "GetClassName returned incorrect length\n");
693 ok(!lstrcmpW(di_hwnd_class, str), "GetClassName returned incorrect name for this window's class\n");
694 }
695
697 ok(SUCCEEDED(hr), "IDirectInputDevice8_Acquire failed: %08x\n", hr);
698 raw_devices_count = ARRAY_SIZE(raw_devices);
699 memset(raw_devices, 0, sizeof(raw_devices));
700 hr = GetRegisteredRawInputDevices(raw_devices, &raw_devices_count, sizeof(RAWINPUTDEVICE));
702 ok(hr == 1, "GetRegisteredRawInputDevices returned %d, raw_devices_count: %d\n", hr, raw_devices_count);
704 ok(raw_devices[0].usUsagePage == 1, "Unexpected raw device usage page: %x\n", raw_devices[0].usUsagePage);
706 ok(raw_devices[0].usUsage == 2, "Unexpected raw device usage: %x\n", raw_devices[0].usUsage);
708 ok(raw_devices[0].dwFlags == RIDEV_INPUTSINK, "Unexpected raw device flags: %x\n", raw_devices[0].dwFlags);
710 ok(raw_devices[0].hwndTarget == di_hwnd, "Unexpected raw device target: %p\n", raw_devices[0].hwndTarget);
712 ok(SUCCEEDED(hr), "IDirectInputDevice8_Acquire failed: %08x\n", hr);
713 raw_devices_count = ARRAY_SIZE(raw_devices);
714 GetRegisteredRawInputDevices(NULL, &raw_devices_count, sizeof(RAWINPUTDEVICE));
716 ok(raw_devices_count == 0, "Unexpected raw devices registered: %d\n", raw_devices_count);
717
718 /* expect dinput8 to take over any activated raw input devices */
719 raw_devices[0].usUsagePage = 0x01;
720 raw_devices[0].usUsage = 0x05;
721 raw_devices[0].dwFlags = 0;
722 raw_devices[0].hwndTarget = hwnd;
723 raw_devices[1].usUsagePage = 0x01;
724 raw_devices[1].usUsage = 0x06;
725 raw_devices[1].dwFlags = 0;
726 raw_devices[1].hwndTarget = hwnd;
727 raw_devices[2].usUsagePage = 0x01;
728 raw_devices[2].usUsage = 0x02;
729 raw_devices[2].dwFlags = 0;
730 raw_devices[2].hwndTarget = hwnd;
731 raw_devices_count = ARRAY_SIZE(raw_devices);
732 hr = RegisterRawInputDevices(raw_devices, raw_devices_count, sizeof(RAWINPUTDEVICE));
733 ok(hr == TRUE, "RegisterRawInputDevices failed\n");
734
735 hr = IDirectInputDevice8_Acquire(di_keyboard);
736 ok(SUCCEEDED(hr), "IDirectInputDevice8_Acquire failed: %08x\n", hr);
738 ok(SUCCEEDED(hr), "IDirectInputDevice8_Acquire failed: %08x\n", hr);
739 raw_devices_count = ARRAY_SIZE(raw_devices);
740 memset(raw_devices, 0, sizeof(raw_devices));
741 hr = GetRegisteredRawInputDevices(raw_devices, &raw_devices_count, sizeof(RAWINPUTDEVICE));
743 ok(hr == 3, "GetRegisteredRawInputDevices returned %d, raw_devices_count: %d\n", hr, raw_devices_count);
745 ok(raw_devices[0].usUsagePage == 1, "Unexpected raw device usage page: %x\n", raw_devices[0].usUsagePage);
747 ok(raw_devices[0].usUsage == 2, "Unexpected raw device usage: %x\n", raw_devices[0].usUsage);
749 ok(raw_devices[0].dwFlags == RIDEV_INPUTSINK, "Unexpected raw device flags: %x\n", raw_devices[0].dwFlags);
751 ok(raw_devices[0].hwndTarget == di_hwnd, "Unexpected raw device target: %p\n", raw_devices[0].hwndTarget);
753 ok(raw_devices[1].usUsagePage == 1, "Unexpected raw device usage page: %x\n", raw_devices[1].usUsagePage);
755 ok(raw_devices[1].usUsage == 5, "Unexpected raw device usage: %x\n", raw_devices[1].usUsage);
756 ok(raw_devices[1].dwFlags == 0, "Unexpected raw device flags: %x\n", raw_devices[1].dwFlags);
758 ok(raw_devices[1].hwndTarget == hwnd, "Unexpected raw device target: %p\n", raw_devices[1].hwndTarget);
760 ok(raw_devices[2].usUsagePage == 1, "Unexpected raw device usage page: %x\n", raw_devices[1].usUsagePage);
762 ok(raw_devices[2].usUsage == 6, "Unexpected raw device usage: %x\n", raw_devices[1].usUsage);
764 ok(raw_devices[2].dwFlags == RIDEV_INPUTSINK, "Unexpected raw device flags: %x\n", raw_devices[1].dwFlags);
766 ok(raw_devices[2].hwndTarget == di_hwnd, "Unexpected raw device target: %p\n", raw_devices[1].hwndTarget);
767 hr = IDirectInputDevice8_Unacquire(di_keyboard);
768 ok(SUCCEEDED(hr), "IDirectInputDevice8_Acquire failed: %08x\n", hr);
770 ok(SUCCEEDED(hr), "IDirectInputDevice8_Acquire failed: %08x\n", hr);
771 raw_devices_count = ARRAY_SIZE(raw_devices);
772 GetRegisteredRawInputDevices(NULL, &raw_devices_count, sizeof(RAWINPUTDEVICE));
774 ok(raw_devices_count == 1, "Unexpected raw devices registered: %d\n", raw_devices_count);
775
776 raw_devices_count = ARRAY_SIZE(raw_devices);
777 hr = GetRegisteredRawInputDevices(raw_devices, &raw_devices_count, sizeof(RAWINPUTDEVICE));
779 ok(hr == 1, "GetRegisteredRawInputDevices returned %d, raw_devices_count: %d\n", hr, raw_devices_count);
781 ok(raw_devices[0].usUsagePage == 1, "Unexpected raw device usage page: %x\n", raw_devices[0].usUsagePage);
783 ok(raw_devices[0].usUsage == 5, "Unexpected raw device usage: %x\n", raw_devices[0].usUsage);
784 ok(raw_devices[0].dwFlags == 0, "Unexpected raw device flags: %x\n", raw_devices[0].dwFlags);
786 ok(raw_devices[0].hwndTarget == hwnd, "Unexpected raw device target: %p\n", raw_devices[0].hwndTarget);
787
789 IDirectInputDevice8_Release(di_keyboard);
791
793}
794
796{
798
802
804}
static struct _test_info results[8]
Definition: SetCursorPos.c:31
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define START_TEST(x)
Definition: atltest.h:75
#define ARRAY_SIZE(A)
Definition: main.h:20
const DIDATAFORMAT c_dfDIMouse
Definition: data_formats.c:270
const DIDATAFORMAT c_dfDIKeyboard
Definition: data_formats.c:561
#define WAIT_TIMEOUT
Definition: dderror.h:14
#define DIK_SPACE
Definition: dinput.h:526
#define IDirectInputDevice_AddRef(p)
Definition: dinput.h:1601
#define DIPROP_RANGE
Definition: dinput.h:892
#define DIK_D
Definition: dinput.h:501
#define DIAH_UNMAPPED
Definition: dinput.h:1299
#define DIERR_INVALIDPARAM
Definition: dinput.h:152
#define DIENUM_CONTINUE
Definition: dinput.h:188
#define DIEDBS_MAPPEDPRI1
Definition: dinput.h:445
#define DIDBAM_HWDEFAULTS
Definition: dinput.h:1355
#define DIK_A
Definition: dinput.h:499
#define DIDSAM_FORCESAVE
Definition: dinput.h:1359
#define DIEDBSFL_ATTACHEDONLY
Definition: dinput.h:450
#define IDirectInput8_Initialize(p, a, b)
Definition: dinput.h:2517
#define DIKEYBOARD_A
Definition: dinput.h:640
#define DIDFT_RELAXIS
Definition: dinput.h:751
#define DIDSAM_NOUSER
Definition: dinput.h:1358
#define IDirectInputDevice_GetProperty(p, a, b)
Definition: dinput.h:1606
#define DIERR_NOTACQUIRED
Definition: dinput.h:167
#define IDirectInput8_CreateDevice(p, a, b, c)
Definition: dinput.h:2513
#define IDirectInputDevice_GetDeviceInfo(p, a)
Definition: dinput.h:1616
#define DIK_B
Definition: dinput.h:517
#define DIKEYBOARD_SPACE
Definition: dinput.h:667
#define DIK_C
Definition: dinput.h:515
#define DIDFT_GETTYPE(n)
Definition: dinput.h:763
#define IDirectInput_CreateDevice(p, a, b, c)
Definition: dinput.h:2296
#define DIAH_DEFAULT
Definition: dinput.h:1304
#define IDirectInput8_Release(p)
Definition: dinput.h:2511
#define DIDFT_PSHBUTTON
Definition: dinput.h:754
#define IDirectInputDevice8_Release(p)
Definition: dinput.h:2036
#define DIERR_OLDDIRECTINPUTVERSION
Definition: dinput.h:141
#define DI_OK
Definition: dinput.h:128
#define DIERR_BETADIRECTINPUTVERSION
Definition: dinput.h:143
#define DI_BUFFEROVERFLOW
Definition: dinput.h:130
#define DIPROP_USERNAME
Definition: dinput.h:919
#define DIERR_ACQUIRED
Definition: dinput.h:165
#define IDirectInputDevice8_SetDataFormat(p, a)
Definition: dinput.h:2046
#define IDirectInputDevice8_Poll(p)
Definition: dinput.h:2061
#define DIMOUSE_BUTTON0
Definition: dinput.h:2145
#define DI_NOEFFECT
Definition: dinput.h:132
#define IDirectInput_Release(p)
Definition: dinput.h:2294
#define IDirectInputDevice8_BuildActionMap(p, a, b, c)
Definition: dinput.h:2067
#define DIMOUSE_YAXIS
Definition: dinput.h:2143
#define DIDFT_GETINSTANCE(n)
Definition: dinput.h:764
#define IDirectInputDevice8_Acquire(p)
Definition: dinput.h:2042
#define DI_SETTINGSNOTSAVED
Definition: dinput.h:137
#define DIDFT_MAKEINSTANCE(n)
Definition: dinput.h:762
#define DIKEYBOARD_B
Definition: dinput.h:658
#define IDirectInputDevice_Unacquire(p)
Definition: dinput.h:1609
struct _DIACTIONA DIACTIONA
#define IDirectInputDevice_Release(p)
Definition: dinput.h:1602
#define IDirectInput8_EnumDevicesBySemantics(p, a, b, c, d, e)
Definition: dinput.h:2519
#define DIPH_DEVICE
Definition: dinput.h:835
#define IDirectInputDevice8_SetActionMap(p, a, b, c)
Definition: dinput.h:2068
#define IDirectInputDevice8_Unacquire(p)
Definition: dinput.h:2043
#define DIPROP_BUFFERSIZE
Definition: dinput.h:885
#define DIAH_USERCONFIG
Definition: dinput.h:1300
#define IDirectInputDevice_GetDeviceData(p, a, b, c, d)
Definition: dinput.h:1611
#define IDirectInputDevice8_GetDeviceData(p, a, b, c, d)
Definition: dinput.h:2045
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static HINSTANCE instance
Definition: main.c:40
BOOL WINAPI GetUserNameW(LPWSTR lpszName, LPDWORD lpSize)
Definition: misc.c:291
#define CP_ACP
Definition: compat.h:109
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define MAX_PATH
Definition: compat.h:34
#define CALLBACK
Definition: compat.h:35
#define MultiByteToWideChar
Definition: compat.h:110
#define lstrlenW
Definition: compat.h:750
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:455
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4242
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
FxRegKey * pKey
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
struct _cl_event * event
Definition: glext.h:7739
GLuint buffer
Definition: glext.h:5915
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
Definition: glfuncs.h:248
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define wine_dbgstr_w
Definition: kernel32.h:34
__u16 time
Definition: mkdosfs.c:8
static HINSTANCE hinst
Definition: edit.c:551
BOOL expected
Definition: store.c:2063
static void test_save_settings(void)
Definition: device.c:426
static void test_build_action_map(IDirectInputDevice8A *lpdid, DIACTIONFORMATA *lpdiaf, int action_index, DWORD expected_type, DWORD expected_inst)
Definition: device.c:140
static BOOL CALLBACK enumeration_callback(const DIDEVICEINSTANCEA *lpddi, IDirectInputDevice8A *lpdid, DWORD dwFlags, DWORD dwRemaining, LPVOID pvRef)
Definition: device.c:167
static const GUID ACTION_MAPPING_GUID
Definition: device.c:39
@ DITEST_BUTTON
Definition: device.c:45
@ DITEST_YAXIS
Definition: device.c:48
@ DITEST_AXIS
Definition: device.c:44
@ DITEST_MOUSEBUTTON0
Definition: device.c:47
@ DITEST_KEYBOARDSPACE
Definition: device.c:46
static const GUID NULL_GUID
Definition: device.c:41
static void flush_events(void)
Definition: device.c:70
static void test_action_mapping(void)
Definition: device.c:291
static DIACTIONA actionMapping[]
Definition: device.c:51
static void test_mouse_keyboard(void)
Definition: device.c:613
static void test_device_input(IDirectInputDevice8A *lpdid, DWORD event_type, DWORD event, DWORD expected)
Definition: device.c:85
#define DIRECTINPUT_VERSION
Definition: device.c:19
#define todo_wine
Definition: custom.c:89
unsigned int UINT
Definition: ndis.h:50
#define WS_POPUP
Definition: pedump.c:616
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_EX_TOPMOST
Definition: pedump.c:647
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
const WCHAR * str
#define win_skip
Definition: test.h:163
#define memset(x, y, z)
Definition: compat.h:39
HRESULT hr
Definition: shlfolder.c:183
GUID guidInstance
Definition: dinput.h:413
UINT_PTR uAppData
Definition: dinput.h:795
DIPROPHEADER diph
Definition: dinput.h:843
DWORD dwData
Definition: dinput.h:844
DWORD dwObj
Definition: dinput.h:830
DWORD dwSize
Definition: dinput.h:828
DWORD dwHeaderSize
Definition: dinput.h:829
DWORD dwHow
Definition: dinput.h:831
LONG lMin
Definition: dinput.h:850
LONG lMax
Definition: dinput.h:851
DIPROPHEADER diph
Definition: dinput.h:849
DIPROPHEADER diph
Definition: dinput.h:874
WCHAR wsz[MAX_PATH]
Definition: dinput.h:875
DWORD dwHow
Definition: dinput.h:1271
DWORD dwObjID
Definition: dinput.h:1270
GUID guidInstance
Definition: dinput.h:1269
DWORD dwDataSize
Definition: dinput.h:1310
LPDIACTIONA rgoAction
Definition: dinput.h:1312
DWORD dwBufferSize
Definition: dinput.h:1315
DWORD dwNumActions
Definition: dinput.h:1311
DWORD dwActionSize
Definition: dinput.h:1309
GUID guidActionMap
Definition: dinput.h:1313
Definition: devices.h:37
int ndevices
Definition: device.c:35
IDirectInputA * pDI
Definition: device.c:173
IDirectInputDevice8A * mouse
Definition: device.c:33
IDirectInput8A * pDI
Definition: device.c:30
IDirectInputDevice8A * keyboard
Definition: device.c:32
const char * username
Definition: device.c:34
DIACTIONFORMATA * lpdiaf
Definition: device.c:31
UINT WINAPI DECLSPEC_HOTPATCH GetRegisteredRawInputDevices(PRAWINPUTDEVICE pRawInputDevices, PUINT puiNumDevices, UINT cbSize)
Definition: stubs.c:349
BOOL WINAPI DECLSPEC_HOTPATCH RegisterRawInputDevices(PCRAWINPUTDEVICE pRawInputDevices, UINT uiNumDevices, UINT cbSize)
Definition: stubs.c:364
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1384
#define INPUT_KEYBOARD
Definition: winable.h:10
#define INPUT_MOUSE
Definition: winable.h:9
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define REGDB_E_CLASSNOTREG
Definition: winerror.h:2696
void WINAPI mouse_event(_In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ ULONG_PTR)
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define MOUSEEVENTF_LEFTUP
Definition: winuser.h:1188
#define VK_SPACE
Definition: winuser.h:2222
#define QS_ALLINPUT
Definition: winuser.h:906
BOOL WINAPI SetCursorPos(_In_ int, _In_ int)
Definition: cursoricon.c:2714
DWORD WINAPI MsgWaitForMultipleObjects(_In_ DWORD nCount, _In_reads_opt_(nCount) CONST HANDLE *pHandles, _In_ BOOL fWaitAll, _In_ DWORD dwMilliseconds, _In_ DWORD dwWakeMask)
#define MOUSEEVENTF_LEFTDOWN
Definition: winuser.h:1187
VOID WINAPI keybd_event(_In_ BYTE, _In_ BYTE, _In_ DWORD, _In_ ULONG_PTR)
int WINAPI GetClassNameW(_In_ HWND hWnd, _Out_writes_to_(nMaxCount, return) LPWSTR lpClassName, _In_ int nMaxCount)
BOOL WINAPI DestroyWindow(_In_ HWND)
#define KEYEVENTF_KEYUP
Definition: winuser.h:1105
__wchar_t WCHAR
Definition: xmlstorage.h:180