614{
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);
624
629 {
630 win_skip(
"test_mouse_keyboard requires dinput8\n");
631 return;
632 }
634
637 {
638 win_skip(
"test_mouse_keyboard requires dinput8\n");
639 return;
640 }
642
646 ok(
SUCCEEDED(
hr),
"IDirectInputDevice8_SetDataFormat failed: %08x\n",
hr);
647
651 ok(
SUCCEEDED(
hr),
"IDirectInputDevice8_SetDataFormat failed: %08x\n",
hr);
652
656 ok(raw_devices_count == 0,
"Unexpected raw devices registered: %d\n", raw_devices_count);
657
661 memset(raw_devices, 0,
sizeof(raw_devices));
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);
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};
685
686 di_hwnd = raw_devices[0].hwndTarget;
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
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
699 memset(raw_devices, 0,
sizeof(raw_devices));
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);
716 ok(raw_devices_count == 0,
"Unexpected raw devices registered: %d\n", raw_devices_count);
717
718
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;
733 ok(
hr ==
TRUE,
"RegisterRawInputDevices failed\n");
734
740 memset(raw_devices, 0,
sizeof(raw_devices));
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);
774 ok(raw_devices_count == 1,
"Unexpected raw devices registered: %d\n", raw_devices_count);
775
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
791
793}
#define INVALID_HANDLE_VALUE
UINT WINAPI DECLSPEC_HOTPATCH GetRegisteredRawInputDevices(PRAWINPUTDEVICE pRawInputDevices, PUINT puiNumDevices, UINT cbSize)
BOOL WINAPI DECLSPEC_HOTPATCH RegisterRawInputDevices(PCRAWINPUTDEVICE pRawInputDevices, UINT uiNumDevices, UINT cbSize)
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
int WINAPI GetClassNameW(_In_ HWND hWnd, _Out_writes_to_(nMaxCount, return) LPWSTR lpClassName, _In_ int nMaxCount)