ole32-CoWaitForMultipleHandles: Add additional test to confirm correct behaviour of MsgWaitForMultipleObjectsEx.

This commit is contained in:
Sebastian Lackner 2014-11-06 00:16:47 +01:00
parent 653547070d
commit 6cc9038091
2 changed files with 73 additions and 1 deletions

View File

@ -1048,13 +1048,14 @@ ntoskrnl-Write_CR4.ok:
# | * [#32568] CoWaitForMultipleHandles shouldn't process window events when APC calls are queued
# |
# | Modified files:
# | * dlls/ole32/compobj.c, dlls/ole32/tests/compobj.c, include/objbase.h
# | * dlls/ole32/compobj.c, dlls/ole32/tests/compobj.c, dlls/user32/tests/msg.c, include/objbase.h
# |
.INTERMEDIATE: ole32-CoWaitForMultipleHandles.ok
ole32-CoWaitForMultipleHandles.ok:
$(call APPLY_FILE,ole32-CoWaitForMultipleHandles/0001-ole32-tests-Add-tests-for-CoWaitForMultipleHandles.patch)
$(call APPLY_FILE,ole32-CoWaitForMultipleHandles/0002-ole32-Verify-arguments-for-CoWaitForMultipleHandles-.patch)
$(call APPLY_FILE,ole32-CoWaitForMultipleHandles/0003-ole32-Don-t-process-window-events-when-APC-calls-are.patch)
$(call APPLY_FILE,ole32-CoWaitForMultipleHandles/0004-user32-tests-Add-tests-for-MsgWaitForMultipleObjects.patch)
@( \
echo '+ { "ole32-CoWaitForMultipleHandles", "Sebastian Lackner", "CoWaitForMultipleHandles shouldn'\''t process window events when APC calls are queued." },'; \
) > ole32-CoWaitForMultipleHandles.ok

View File

@ -0,0 +1,71 @@
From 9be421e1e55b0032622a14c371af22046850958e Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Thu, 6 Nov 2014 00:13:42 +0100
Subject: user32/tests: Add tests for MsgWaitForMultipleObjectsEx.
---
dlls/user32/tests/msg.c | 41 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index 90b87cb..82f5bc7 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -4542,6 +4542,11 @@ static const struct message WmZOrder[] = {
{ 0 }
};
+static void CALLBACK apc_test_proc(ULONG_PTR param)
+{
+ /* nothing */
+}
+
static void test_MsgWaitForMultipleObjects(HWND hwnd)
{
DWORD ret;
@@ -4583,6 +4588,42 @@ static void test_MsgWaitForMultipleObjects(HWND hwnd)
ok(msg.message == WM_USER, "got %04x instead of WM_USER\n", msg.message);
ok(PeekMessageA( &msg, 0, 0, 0, PM_REMOVE ), "PeekMessage should succeed\n");
ok(msg.message == WM_USER, "got %04x instead of WM_USER\n", msg.message);
+
+ /* MWMO_INPUTAVAILABLE should succeed even if the message was already seen */
+ PostMessageA( hwnd, WM_USER, 0, 0 );
+ ok(PeekMessageA( &msg, 0, 0, 0, PM_NOREMOVE ), "PeekMessage should succeed\n");
+ ok(msg.message == WM_USER, "got %04x instead of WM_USER\n", msg.message);
+
+ ret = MsgWaitForMultipleObjectsEx(0, NULL, 0, QS_POSTMESSAGE, MWMO_INPUTAVAILABLE);
+ ok(ret == WAIT_OBJECT_0, "MsgWaitForMultipleObjectsEx returned %x\n", ret);
+
+ ok(PeekMessageA( &msg, 0, 0, 0, PM_REMOVE ), "PeekMessage should succeed\n");
+ ok(msg.message == WM_USER, "got %04x instead of WM_USER\n", msg.message);
+
+ /* without MWMO_ALERTABLE the result is never WAIT_IO_COMPLETION */
+ PostMessageA(hwnd, WM_USER, 0, 0);
+
+ ret = QueueUserAPC(apc_test_proc, GetCurrentThread(), 0);
+ ok(ret, "QueueUserAPC failed %u\n", GetLastError());
+
+ ret = MsgWaitForMultipleObjectsEx(0, NULL, 0, QS_POSTMESSAGE, 0);
+ ok(ret == WAIT_OBJECT_0, "MsgWaitForMultipleObjectsEx returned %x\n", ret);
+
+ ok(PeekMessageA( &msg, 0, 0, 0, PM_REMOVE ), "PeekMessage should succeed\n");
+ ok(msg.message == WM_USER, "got %04x instead of WM_USER\n", msg.message);
+
+ /* but even with MWMO_ALERTABLE window events are preferred */
+ PostMessageA(hwnd, WM_USER, 0, 0);
+
+ ret = MsgWaitForMultipleObjectsEx(0, NULL, 0, QS_POSTMESSAGE, MWMO_ALERTABLE);
+ ok(ret == WAIT_OBJECT_0, "MsgWaitForMultipleObjectsEx returned %x\n", ret);
+
+ ok(PeekMessageA( &msg, 0, 0, 0, PM_REMOVE ), "PeekMessage should succeed\n");
+ ok(msg.message == WM_USER, "got %04x instead of WM_USER\n", msg.message);
+
+ /* the APC call is still queued */
+ ret = MsgWaitForMultipleObjectsEx(0, NULL, 0, QS_POSTMESSAGE, MWMO_ALERTABLE);
+ ok(ret == WAIT_IO_COMPLETION, "MsgWaitForMultipleObjectsEx returned %x\n", ret);
}
/* test if we receive the right sequence of messages */
--
2.1.3