server: Validate the filter window handle in get_message.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
7c768d9052
commit
f5f633e712
|
@ -12173,6 +12173,31 @@ todo_wine {
|
|||
qstatus = GetQueueStatus(qs_all_input);
|
||||
ok(qstatus == 0, "wrong qstatus %08x\n", qstatus);
|
||||
}
|
||||
|
||||
PostThreadMessageA(GetCurrentThreadId(), WM_USER, 0, 0);
|
||||
ret = PeekMessageA(&msg, (HWND)-1, 0, 0, PM_NOREMOVE);
|
||||
ok(ret == TRUE, "wrong ret %d\n", ret);
|
||||
ok(msg.message == WM_USER, "wrong message %u\n", msg.message);
|
||||
ret = GetMessageA(&msg, (HWND)-1, 0, 0);
|
||||
ok(ret == TRUE, "wrong ret %d\n", ret);
|
||||
ok(msg.message == WM_USER, "wrong message %u\n", msg.message);
|
||||
|
||||
PostThreadMessageA(GetCurrentThreadId(), WM_USER, 0, 0);
|
||||
ret = PeekMessageA(&msg, (HWND)1, 0, 0, PM_NOREMOVE);
|
||||
ok(ret == TRUE, "wrong ret %d\n", ret);
|
||||
ok(msg.message == WM_USER, "wrong message %u\n", msg.message);
|
||||
ret = GetMessageA(&msg, (HWND)1, 0, 0);
|
||||
ok(ret == TRUE, "wrong ret %d\n", ret);
|
||||
ok(msg.message == WM_USER, "wrong message %u\n", msg.message);
|
||||
|
||||
PostThreadMessageA(GetCurrentThreadId(), WM_USER, 0, 0);
|
||||
ret = PeekMessageA(&msg, (HWND)0xffff, 0, 0, PM_NOREMOVE);
|
||||
ok(ret == TRUE, "wrong ret %d\n", ret);
|
||||
ok(msg.message == WM_USER, "wrong message %u\n", msg.message);
|
||||
ret = GetMessageA(&msg, (HWND)0xffff, 0, 0);
|
||||
ok(ret == TRUE, "wrong ret %d\n", ret);
|
||||
ok(msg.message == WM_USER, "wrong message %u\n", msg.message);
|
||||
|
||||
done:
|
||||
trace("signalling to exit\n");
|
||||
SetEvent(info.hevent[EV_STOP]);
|
||||
|
@ -17666,6 +17691,22 @@ done:
|
|||
DestroyWindow(hwnd);
|
||||
}
|
||||
|
||||
static void test_invalid_window(void)
|
||||
{
|
||||
MSG msg;
|
||||
BOOL ret;
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = GetMessageA(&msg, (HWND)0xdeadbeef, 0, 0);
|
||||
ok(ret == -1, "wrong ret %d\n", ret);
|
||||
ok(GetLastError() == ERROR_INVALID_WINDOW_HANDLE, "wrong error %u\n", GetLastError());
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = PeekMessageA(&msg, (HWND)0xdeadbeef, 0, 0, PM_REMOVE);
|
||||
ok(!ret, "wrong ret %d\n", ret);
|
||||
ok(GetLastError() == ERROR_INVALID_WINDOW_HANDLE, "wrong error %u\n", GetLastError());
|
||||
}
|
||||
|
||||
static void init_funcs(void)
|
||||
{
|
||||
HMODULE hKernel32 = GetModuleHandleA("kernel32.dll");
|
||||
|
@ -17791,6 +17832,7 @@ START_TEST(msg)
|
|||
test_notify_message();
|
||||
test_SetActiveWindow();
|
||||
test_restore_messages();
|
||||
test_invalid_window();
|
||||
|
||||
if (!pTrackMouseEvent)
|
||||
win_skip("TrackMouseEvent is not available\n");
|
||||
|
|
|
@ -2394,6 +2394,12 @@ DECL_HANDLER(get_message)
|
|||
|
||||
reply->active_hooks = get_active_hooks();
|
||||
|
||||
if (get_win && get_win != 1 && get_win != -1 && !get_user_object( get_win, USER_WINDOW ))
|
||||
{
|
||||
set_win32_error( ERROR_INVALID_WINDOW_HANDLE );
|
||||
return;
|
||||
}
|
||||
|
||||
if (!queue) return;
|
||||
queue->last_get_msg = current_time;
|
||||
if (!filter) filter = QS_ALLINPUT;
|
||||
|
|
Loading…
Reference in New Issue