Fix https://github.com/ValveSoftware/Proton/issues/2040.
Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- dlls/user32/rawinput.c | 3 +++ dlls/user32/tests/input.c | 11 +++++++++++ 2 files changed, 14 insertions(+)
diff --git a/dlls/user32/rawinput.c b/dlls/user32/rawinput.c index cf3028a4ec..4bfccdfb84 100644 --- a/dlls/user32/rawinput.c +++ b/dlls/user32/rawinput.c @@ -281,6 +281,9 @@ UINT WINAPI GetRawInputData(HRAWINPUT rawinput, UINT command, void *data, UINT * TRACE("rawinput %p, command %#x, data %p, data_size %p, header_size %u.\n", rawinput, command, data, data_size, header_size);
+ if (!ri) + return ~0U; + if (header_size != sizeof(RAWINPUTHEADER)) { WARN("Invalid structure size %u.\n", header_size); diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c index 14fd5f8f77..ffdd4b7137 100644 --- a/dlls/user32/tests/input.c +++ b/dlls/user32/tests/input.c @@ -1530,6 +1530,16 @@ static void test_GetRawInputDeviceList(void) ok(odevcount == oret, "expected %d, got %d\n", oret, odevcount); }
+static void test_GetRawInputData(void) +{ + UINT size; + UINT ret; + + /* Null raw input handle */ + ret = GetRawInputData(NULL, RID_INPUT, NULL, &size, sizeof(RAWINPUTHEADER)); + ok(ret == ~0U, "Expect ret %u, got %u\n", ~0U, ret); +} + static void test_key_map(void) { HKL kl = GetKeyboardLayout(0); @@ -2697,6 +2707,7 @@ START_TEST(input) test_attach_input(); test_GetKeyState(); test_OemKeyScan(); + test_GetRawInputData();
if(pGetMouseMovePointsEx) test_GetMouseMovePointsEx();
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=46088
Your paranoid android.
=== debian9 (32 bit report) ===
user32: menu.c:2354: Test failed: test 30 menu: Timeout
=== debian9 (32 bit Japanese:Japan report) ===
user32: input.c:2576: Test failed: 200: wrong originId 1/2 input.c:2585: Test failed: 200: wrong originId 1/2
=== debian9 (32 bit Chinese:China report) ===
user32: menu.c:2354: Test failed: test 27 menu: Timeout
=== debian9 (32 bit WoW report) ===
user32: msg.c:8713: Test failed: WaitForSingleObject failed 102 msg.c:8719: Test failed: destroy child on thread exit: 0: the msg 0x0082 was expected, but got msg 0x000f instead msg.c:8719: Test failed: destroy child on thread exit: 1: the msg 0x000f was expected, but got msg 0x0014 instead msg.c:8719: Test failed: destroy child on thread exit: 2: the msg sequence is not complete: expected 0014 - actual 0000