--- dlls/user32/rawinput.c | 11 +++++++++++ dlls/user32/tests/rawinput.c | 3 --- 2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/dlls/user32/rawinput.c b/dlls/user32/rawinput.c index 49cf9f73a0d..94cf7a9a5d2 100644 --- a/dlls/user32/rawinput.c +++ b/dlls/user32/rawinput.c @@ -261,9 +261,20 @@ BOOL WINAPI DECLSPEC_HOTPATCH RegisterRawInputDevices(RAWINPUTDEVICE *devices, U if (size != sizeof(*devices)) { WARN("Invalid structure size %u.\n", size); + SetLastError(ERROR_INVALID_PARAMETER); return FALSE; }
+ for (i = 0; i < device_count; ++i) + { + if ((devices[i].dwFlags & RIDEV_REMOVE) && + (devices[i].hwndTarget != NULL)) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + } + if (!(d = HeapAlloc( GetProcessHeap(), 0, device_count * sizeof(*d) ))) return FALSE;
for (i = 0; i < device_count; ++i) diff --git a/dlls/user32/tests/rawinput.c b/dlls/user32/tests/rawinput.c index 4aa2a162f42..f4c8eb6738b 100644 --- a/dlls/user32/tests/rawinput.c +++ b/dlls/user32/tests/rawinput.c @@ -49,7 +49,6 @@ static void test_RegisterRawInputDevices(void) SetLastError(0xdeadbeef); res = RegisterRawInputDevices(raw_devices, ARRAY_SIZE(raw_devices), 0); ok(res == FALSE, "RegisterRawInputDevices succeeded\n"); - todo_wine ok(GetLastError() == ERROR_INVALID_PARAMETER, "RegisterRawInputDevices returned %08x\n", GetLastError());
SetLastError(0xdeadbeef); @@ -64,9 +63,7 @@ static void test_RegisterRawInputDevices(void)
SetLastError(0xdeadbeef); res = RegisterRawInputDevices(raw_devices, ARRAY_SIZE(raw_devices), sizeof(RAWINPUTDEVICE)); - todo_wine ok(res == FALSE, "RegisterRawInputDevices succeeded\n"); - todo_wine ok(GetLastError() == ERROR_INVALID_PARAMETER, "RegisterRawInputDevices returned %08x\n", GetLastError());
raw_devices[0].hwndTarget = 0; -- 2.23.0