There's already some in dinput, but this is a more appropriate location.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/user32/tests/input.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)
diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c index bab0fd97536..52fd31501f8 100644 --- a/dlls/user32/tests/input.c +++ b/dlls/user32/tests/input.c @@ -1765,6 +1765,7 @@ static void test_RegisterRawInputDevices(void) { HWND hwnd; RAWINPUTDEVICE raw_devices[1]; + UINT count, raw_devices_count; BOOL res;
raw_devices[0].usUsagePage = 0x01; @@ -1791,6 +1792,42 @@ static void test_RegisterRawInputDevices(void) ok(res == TRUE, "RegisterRawInputDevices failed\n"); ok(GetLastError() == 0xdeadbeef, "RegisterRawInputDevices returned %08x\n", GetLastError());
+ SetLastError(0xdeadbeef); + count = GetRegisteredRawInputDevices(NULL, NULL, 0); + todo_wine + ok(count == ~0U, "GetRegisteredRawInputDevices returned %u\n", count); + todo_wine + ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetRegisteredRawInputDevices unexpected error %08x\n", GetLastError()); + + SetLastError(0xdeadbeef); + raw_devices_count = 0; + count = GetRegisteredRawInputDevices(NULL, &raw_devices_count, 0); + todo_wine + ok(count == ~0U, "GetRegisteredRawInputDevices returned %u\n", count); + ok(raw_devices_count == 0, "Unexpected registered devices count: %u\n", raw_devices_count); + todo_wine + ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetRegisteredRawInputDevices unexpected error %08x\n", GetLastError()); + + SetLastError(0xdeadbeef); + raw_devices_count = 0; + count = GetRegisteredRawInputDevices(NULL, &raw_devices_count, sizeof(RAWINPUTDEVICE)); + ok(count == 0, "GetRegisteredRawInputDevices returned %u\n", count); + todo_wine + ok(raw_devices_count == 1, "Unexpected registered devices count: %u\n", raw_devices_count); + ok(GetLastError() == 0xdeadbeef, "GetRegisteredRawInputDevices unexpected error %08x\n", GetLastError()); + + SetLastError(0xdeadbeef); + memset(raw_devices, 0, sizeof(raw_devices)); + raw_devices_count = ARRAY_SIZE(raw_devices); + count = GetRegisteredRawInputDevices(raw_devices, &raw_devices_count, sizeof(RAWINPUTDEVICE)); + todo_wine + ok(count == 1, "GetRegisteredRawInputDevices returned %u\n", count); + ok(raw_devices_count == 1, "Unexpected registered devices count: %u\n", raw_devices_count); + ok(GetLastError() == 0xdeadbeef, "GetRegisteredRawInputDevices unexpected error %08x\n", GetLastError()); + todo_wine + ok(raw_devices[0].usUsagePage == 0x01, "Unexpected usage page: %x\n", raw_devices[0].usUsagePage); + todo_wine + ok(raw_devices[0].usUsage == 0x05, "Unexpected usage: %x\n", raw_devices[0].usUsage);
/* RIDEV_REMOVE requires hwndTarget == NULL */ raw_devices[0].dwFlags = RIDEV_REMOVE;