From de8e8a407968682e9ebd77849d28480e74fed55f Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Tue, 17 Mar 2015 04:35:13 +0100 Subject: [PATCH] Added patch with additional tests for server-PeekMessage. --- debian/changelog | 1 + patches/patchinstall.sh | 6 +- ...-tests-for-removing-already-seen-mes.patch | 150 ++++++++++++++++++ ...ng-of-GetMessage-after-previous-Pee.patch} | 58 ++++++- 4 files changed, 210 insertions(+), 5 deletions(-) create mode 100644 patches/server-PeekMessage/0001-user32-tests-Add-tests-for-removing-already-seen-mes.patch rename patches/server-PeekMessage/{0001-server-Fix-handling-of-GetMessage-after-previous-Pee.patch => 0002-server-Fix-handling-of-GetMessage-after-previous-Pee.patch} (62%) diff --git a/debian/changelog b/debian/changelog index 39e11653..7c3970e4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -18,6 +18,7 @@ wine-staging (1.7.39) UNRELEASED; urgency=low * Added patch to fix wrong return values of RtlFindActivationContextSectionString for NULL data (by Mark Jansen). * Added patch to implement _ismbckata and _mbctohira, moreover fix wrong return value of _ismbckata. * Added patch to improve stub for ID3DXEffectImpl_CloneEffect. + * Added patch with additional tests for server-PeekMessage. * Removed patch to avoid hardcoded values for sizeof(GUID) (accepted upstream). * Removed patches for SLGetWindowsInformationDWORD (accepted upstream). * Removed patches for _ismbckata and _mbctohira (fixed upstream). diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 429d4a8e..947127fd 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -3707,11 +3707,13 @@ fi # | * [#28884] GetMessage should remove already seen messages with higher priority # | # | Modified files: -# | * server/queue.c +# | * dlls/user32/tests/msg.c, server/queue.c # | if test "$enable_server_PeekMessage" -eq 1; then - patch_apply server-PeekMessage/0001-server-Fix-handling-of-GetMessage-after-previous-Pee.patch + patch_apply server-PeekMessage/0001-user32-tests-Add-tests-for-removing-already-seen-mes.patch + patch_apply server-PeekMessage/0002-server-Fix-handling-of-GetMessage-after-previous-Pee.patch ( + echo '+ { "Sebastian Lackner", "user32/tests: Add tests for removing already seen messages from the queue.", 1 },'; echo '+ { "Sebastian Lackner", "server: Fix handling of GetMessage after previous PeekMessage call.", 1 },'; ) >> "$patchlist" fi diff --git a/patches/server-PeekMessage/0001-user32-tests-Add-tests-for-removing-already-seen-mes.patch b/patches/server-PeekMessage/0001-user32-tests-Add-tests-for-removing-already-seen-mes.patch new file mode 100644 index 00000000..3767a3fa --- /dev/null +++ b/patches/server-PeekMessage/0001-user32-tests-Add-tests-for-removing-already-seen-mes.patch @@ -0,0 +1,150 @@ +From ad090f56d989fe29223aff05cc4fb26066ba4a49 Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +Date: Tue, 17 Mar 2015 04:26:33 +0100 +Subject: user32/tests: Add tests for removing already seen messages from the + queue. + +--- + dlls/user32/tests/msg.c | 119 ++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 119 insertions(+) + +diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c +index f1236cf..c297e40 100644 +--- a/dlls/user32/tests/msg.c ++++ b/dlls/user32/tests/msg.c +@@ -10440,6 +10440,124 @@ done: + flush_events(); + } + ++static void test_PeekMessage3(void) ++{ ++ HWND hwnd; ++ BOOL ret; ++ MSG msg; ++ ++ hwnd = CreateWindowA("TestWindowClass", "PeekMessage3", WS_OVERLAPPEDWINDOW, ++ 10, 10, 800, 800, NULL, NULL, NULL, NULL); ++ ok(hwnd != NULL, "expected hwnd != NULL\n"); ++ flush_events(); ++ ++ /* GetMessage() and PeekMessage(..., PM_REMOVE) should prefer messages which ++ * were already seen. */ ++ ++ SetTimer(hwnd, 1, 0, NULL); ++ while (!PeekMessageA(&msg, NULL, 0, 0, PM_NOREMOVE)); ++ ok(msg.message == WM_TIMER, "msg.message = %u instead of WM_TIMER\n", msg.message); ++ PostMessageA(hwnd, WM_USER, 0, 0); ++ ret = PeekMessageA(&msg, NULL, 0, 0, PM_NOREMOVE); ++ todo_wine ++ ok(ret && msg.message == WM_TIMER, "msg.message = %u instead of WM_TIMER\n", msg.message); ++ ret = GetMessageA(&msg, NULL, 0, 0); ++ todo_wine ++ ok(ret && msg.message == WM_TIMER, "msg.message = %u instead of WM_TIMER\n", msg.message); ++ ret = GetMessageA(&msg, NULL, 0, 0); ++ todo_wine ++ ok(ret &&msg.message == WM_USER, "msg.message = %u instead of WM_USER\n", msg.message); ++ ret = PeekMessageA(&msg, NULL, 0, 0, 0); ++ ok(!ret, "expected PeekMessage to return FALSE, got %u\n", ret); ++ ++ SetTimer(hwnd, 1, 0, NULL); ++ while (!PeekMessageA(&msg, NULL, 0, 0, PM_NOREMOVE)); ++ ok(msg.message == WM_TIMER, "msg.message = %u instead of WM_TIMER\n", msg.message); ++ PostMessageA(hwnd, WM_USER, 0, 0); ++ ret = PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE); ++ todo_wine ++ ok(ret && msg.message == WM_TIMER, "msg.message = %u instead of WM_TIMER\n", msg.message); ++ ret = PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE); ++ todo_wine ++ ok(ret && msg.message == WM_USER, "msg.message = %u instead of WM_USER\n", msg.message); ++ ret = PeekMessageA(&msg, NULL, 0, 0, 0); ++ ok(!ret, "expected PeekMessage to return FALSE, got %u\n", ret); ++ ++ /* It doesn't matter if a message range is specified or not. */ ++ ++ SetTimer(hwnd, 1, 0, NULL); ++ while (!PeekMessageA(&msg, NULL, WM_TIMER, WM_TIMER, PM_NOREMOVE)); ++ ok(msg.message == WM_TIMER, "msg.message = %u instead of WM_TIMER\n", msg.message); ++ PostMessageA(hwnd, WM_USER, 0, 0); ++ ret = GetMessageA(&msg, NULL, 0, 0); ++ todo_wine ++ ok(ret && msg.message == WM_TIMER, "msg.message = %u instead of WM_TIMER\n", msg.message); ++ ret = GetMessageA(&msg, NULL, 0, 0); ++ todo_wine ++ ok(ret &&msg.message == WM_USER, "msg.message = %u instead of WM_USER\n", msg.message); ++ ret = PeekMessageA(&msg, NULL, 0, 0, 0); ++ ok(!ret, "expected PeekMessage to return FALSE, got %u\n", ret); ++ ++ /* But not if the post messages were added before the PeekMessage() call. */ ++ ++ PostMessageA(hwnd, WM_USER, 0, 0); ++ SetTimer(hwnd, 1, 0, NULL); ++ while (!PeekMessageA(&msg, NULL, WM_TIMER, WM_TIMER, PM_NOREMOVE)); ++ ok(msg.message == WM_TIMER, "msg.message = %u instead of WM_TIMER\n", msg.message); ++ ret = GetMessageA(&msg, NULL, 0, 0); ++ ok(ret && msg.message == WM_USER, "msg.message = %u instead of WM_USER\n", msg.message); ++ ret = GetMessageA(&msg, NULL, 0, 0); ++ ok(ret &&msg.message == WM_TIMER, "msg.message = %u instead of WM_TIMER\n", msg.message); ++ ret = PeekMessageA(&msg, NULL, 0, 0, 0); ++ ok(!ret, "expected PeekMessage to return FALSE, got %u\n", ret); ++ ++ /* More complicated test with multiple messages. */ ++ ++ PostMessageA(hwnd, WM_USER, 0, 0); ++ SetTimer(hwnd, 1, 0, NULL); ++ while (!PeekMessageA(&msg, NULL, WM_TIMER, WM_TIMER, PM_NOREMOVE)); ++ ok(msg.message == WM_TIMER, "msg.message = %u instead of WM_TIMER\n", msg.message); ++ PostMessageA(hwnd, WM_USER + 1, 0, 0); ++ ret = GetMessageA(&msg, NULL, 0, 0); ++ ok(ret && msg.message == WM_USER, "msg.message = %u instead of WM_USER\n", msg.message); ++ ret = GetMessageA(&msg, NULL, 0, 0); ++ todo_wine ++ ok(ret &&msg.message == WM_TIMER, "msg.message = %u instead of WM_TIMER\n", msg.message); ++ ret = GetMessageA(&msg, NULL, 0, 0); ++ todo_wine ++ ok(ret && msg.message == WM_USER + 1, "msg.message = %u instead of WM_USER + 1\n", msg.message); ++ ret = PeekMessageA(&msg, NULL, 0, 0, 0); ++ ok(!ret, "expected PeekMessage to return FALSE, got %u\n", ret); ++ ++ /* Also works for posted messages, but the situation is a bit different, ++ * because both messages are in the same queue. */ ++ ++ PostMessageA(hwnd, WM_TIMER, 0, 0); ++ while (!PeekMessageA(&msg, NULL, WM_TIMER, WM_TIMER, PM_NOREMOVE)); ++ ok(msg.message == WM_TIMER, "msg.message = %u instead of WM_TIMER\n", msg.message); ++ PostMessageA(hwnd, WM_USER, 0, 0); ++ ret = GetMessageA(&msg, NULL, 0, 0); ++ ok(ret && msg.message == WM_TIMER, "msg.message = %u instead of WM_TIMER\n", msg.message); ++ ret = GetMessageA(&msg, NULL, 0, 0); ++ ok(ret &&msg.message == WM_USER, "msg.message = %u instead of WM_USER\n", msg.message); ++ ret = PeekMessageA(&msg, NULL, 0, 0, 0); ++ ok(!ret, "expected PeekMessage to return FALSE, got %u\n", ret); ++ ++ PostMessageA(hwnd, WM_USER, 0, 0); ++ PostMessageA(hwnd, WM_TIMER, 0, 0); ++ while (!PeekMessageA(&msg, NULL, WM_TIMER, WM_TIMER, PM_NOREMOVE)); ++ ok(msg.message == WM_TIMER, "msg.message = %u instead of WM_TIMER\n", msg.message); ++ ret = GetMessageA(&msg, NULL, 0, 0); ++ ok(ret && msg.message == WM_USER, "msg.message = %u instead of WM_USER\n", msg.message); ++ ret = GetMessageA(&msg, NULL, 0, 0); ++ ok(ret &&msg.message == WM_TIMER, "msg.message = %u instead of WM_TIMER\n", msg.message); ++ ret = PeekMessageA(&msg, NULL, 0, 0, 0); ++ ok(!ret, "expected PeekMessage to return FALSE, got %u\n", ret); ++ ++ DestroyWindow(hwnd); ++ flush_events(); ++} ++ + static INT_PTR CALLBACK wm_quit_dlg_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp) + { + struct recvd_message msg; +@@ -14563,6 +14681,7 @@ START_TEST(msg) + test_ShowWindow(); + test_PeekMessage(); + test_PeekMessage2(); ++ test_PeekMessage3(); + test_WaitForInputIdle( test_argv[0] ); + test_scrollwindowex(); + test_messages(); +-- +2.3.2 + diff --git a/patches/server-PeekMessage/0001-server-Fix-handling-of-GetMessage-after-previous-Pee.patch b/patches/server-PeekMessage/0002-server-Fix-handling-of-GetMessage-after-previous-Pee.patch similarity index 62% rename from patches/server-PeekMessage/0001-server-Fix-handling-of-GetMessage-after-previous-Pee.patch rename to patches/server-PeekMessage/0002-server-Fix-handling-of-GetMessage-after-previous-Pee.patch index 79750d39..c8ab160e 100644 --- a/patches/server-PeekMessage/0001-server-Fix-handling-of-GetMessage-after-previous-Pee.patch +++ b/patches/server-PeekMessage/0002-server-Fix-handling-of-GetMessage-after-previous-Pee.patch @@ -1,12 +1,64 @@ -From 70ce4b833309abb3df0751a01d88b3655e77d7a8 Mon Sep 17 00:00:00 2001 +From 514cdcbb66a3123b7f3922a54b16e8aa8ecd387f Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sun, 15 Mar 2015 01:05:48 +0100 Subject: server: Fix handling of GetMessage after previous PeekMessage call. --- - server/queue.c | 31 ++++++++++++++++++++++++++----- - 1 file changed, 26 insertions(+), 5 deletions(-) + dlls/user32/tests/msg.c | 9 --------- + server/queue.c | 31 ++++++++++++++++++++++++++----- + 2 files changed, 26 insertions(+), 14 deletions(-) +diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c +index c297e40..19ddfde 100644 +--- a/dlls/user32/tests/msg.c ++++ b/dlls/user32/tests/msg.c +@@ -10459,13 +10459,10 @@ static void test_PeekMessage3(void) + ok(msg.message == WM_TIMER, "msg.message = %u instead of WM_TIMER\n", msg.message); + PostMessageA(hwnd, WM_USER, 0, 0); + ret = PeekMessageA(&msg, NULL, 0, 0, PM_NOREMOVE); +- todo_wine + ok(ret && msg.message == WM_TIMER, "msg.message = %u instead of WM_TIMER\n", msg.message); + ret = GetMessageA(&msg, NULL, 0, 0); +- todo_wine + ok(ret && msg.message == WM_TIMER, "msg.message = %u instead of WM_TIMER\n", msg.message); + ret = GetMessageA(&msg, NULL, 0, 0); +- todo_wine + ok(ret &&msg.message == WM_USER, "msg.message = %u instead of WM_USER\n", msg.message); + ret = PeekMessageA(&msg, NULL, 0, 0, 0); + ok(!ret, "expected PeekMessage to return FALSE, got %u\n", ret); +@@ -10475,10 +10472,8 @@ static void test_PeekMessage3(void) + ok(msg.message == WM_TIMER, "msg.message = %u instead of WM_TIMER\n", msg.message); + PostMessageA(hwnd, WM_USER, 0, 0); + ret = PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE); +- todo_wine + ok(ret && msg.message == WM_TIMER, "msg.message = %u instead of WM_TIMER\n", msg.message); + ret = PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE); +- todo_wine + ok(ret && msg.message == WM_USER, "msg.message = %u instead of WM_USER\n", msg.message); + ret = PeekMessageA(&msg, NULL, 0, 0, 0); + ok(!ret, "expected PeekMessage to return FALSE, got %u\n", ret); +@@ -10490,10 +10485,8 @@ static void test_PeekMessage3(void) + ok(msg.message == WM_TIMER, "msg.message = %u instead of WM_TIMER\n", msg.message); + PostMessageA(hwnd, WM_USER, 0, 0); + ret = GetMessageA(&msg, NULL, 0, 0); +- todo_wine + ok(ret && msg.message == WM_TIMER, "msg.message = %u instead of WM_TIMER\n", msg.message); + ret = GetMessageA(&msg, NULL, 0, 0); +- todo_wine + ok(ret &&msg.message == WM_USER, "msg.message = %u instead of WM_USER\n", msg.message); + ret = PeekMessageA(&msg, NULL, 0, 0, 0); + ok(!ret, "expected PeekMessage to return FALSE, got %u\n", ret); +@@ -10521,10 +10514,8 @@ static void test_PeekMessage3(void) + ret = GetMessageA(&msg, NULL, 0, 0); + ok(ret && msg.message == WM_USER, "msg.message = %u instead of WM_USER\n", msg.message); + ret = GetMessageA(&msg, NULL, 0, 0); +- todo_wine + ok(ret &&msg.message == WM_TIMER, "msg.message = %u instead of WM_TIMER\n", msg.message); + ret = GetMessageA(&msg, NULL, 0, 0); +- todo_wine + ok(ret && msg.message == WM_USER + 1, "msg.message = %u instead of WM_USER + 1\n", msg.message); + ret = PeekMessageA(&msg, NULL, 0, 0, 0); + ok(!ret, "expected PeekMessage to return FALSE, got %u\n", ret); diff --git a/server/queue.c b/server/queue.c index 3a321cd..ce78e4d 100644 --- a/server/queue.c