user32: Check for null handle in GetRawInputData().

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46499
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
stable
Zhiyi Zhang 2019-01-23 23:27:09 +08:00 committed by Alexandre Julliard
parent d32ac5f49f
commit bd730a5f41
2 changed files with 14 additions and 0 deletions

View File

@ -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);

View File

@ -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();