Added patch for additional tests of CoWaitForMultipleHandles with WM_QUIT.

This commit is contained in:
Sebastian Lackner 2014-12-12 04:43:59 +01:00
parent 5db9d0a105
commit 824469b329
3 changed files with 212 additions and 0 deletions

1
debian/changelog vendored
View File

@ -8,6 +8,7 @@ wine-compholio (1.7.33) UNRELEASED; urgency=low
* Added patch to allow Accept-Encoding for HTTP/1.0 in wininet.
* Added patch for combase HSTRING objects.
* Added patch to implement stubs for MFStartup and MFShutdown.
* Added patch for additional tests of CoWaitForMultipleHandles with WM_QUIT.
* Removed patch to fix copy and paste errors in ws2_32 tests (accepted upstream).
* Removed patch to fix ordering of IP addresses by metric if two addresses have the same metric (accepted upstream).
* Removed patch to reset data->pWintrustData->u.pFile->hFile after closing handle (accepted upstream).

View File

@ -80,6 +80,7 @@ PATCHLIST := \
ntoskrnl-KeSetSystemAffinityThread.ok \
ntoskrnl-Stub_FileObject.ok \
ntoskrnl-Write_CR4.ok \
ole32-CoWaitForMultipleHandles.ok \
psapi-K32EnumProcessModulesEx.ok \
quartz-MediaSeeking_Positions.ok \
riched20-IText_Interface.ok \
@ -1204,6 +1205,18 @@ ntoskrnl-Write_CR4.ok:
echo '+ { "Stefan Leichter", "ntoskrnl.exe: Emulate write to CR4 register.", 1 },'; \
) > ntoskrnl-Write_CR4.ok
# Patchset ole32-CoWaitForMultipleHandles
# |
# | Modified files:
# | * dlls/ole32/tests/compobj.c
# |
.INTERMEDIATE: ole32-CoWaitForMultipleHandles.ok
ole32-CoWaitForMultipleHandles.ok:
$(call APPLY_FILE,ole32-CoWaitForMultipleHandles/0001-ole32-tests-Add-additional-tests-for-CoWaitForMultip.patch)
@( \
echo '+ { "Sebastian Lackner", "ole32/tests: Add additional tests for CoWaitForMultipleHandles and WM_QUIT.", 1 },'; \
) > ole32-CoWaitForMultipleHandles.ok
# Patchset psapi-K32EnumProcessModulesEx
# |
# | This patchset fixes the following Wine bugs:

View File

@ -0,0 +1,198 @@
From d8669776edc7806f4d70adff79b86c1125e23086 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Fri, 12 Dec 2014 01:23:06 +0100
Subject: ole32/tests: Add additional tests for CoWaitForMultipleHandles and
WM_QUIT.
---
dlls/ole32/tests/compobj.c | 153 ++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 152 insertions(+), 1 deletion(-)
diff --git a/dlls/ole32/tests/compobj.c b/dlls/ole32/tests/compobj.c
index eed5ac8..187ea3d 100644
--- a/dlls/ole32/tests/compobj.c
+++ b/dlls/ole32/tests/compobj.c
@@ -2103,6 +2103,22 @@ static DWORD CALLBACK release_semaphore_thread( LPVOID arg )
return 0;
}
+static DWORD CALLBACK send_message_thread(LPVOID arg)
+{
+ HWND hWnd = arg;
+ Sleep(50);
+ SendMessageA(hWnd, WM_DDE_FIRST, 0, 0);
+ return 0;
+}
+
+static DWORD CALLBACK post_message_thread(LPVOID arg)
+{
+ HWND hWnd = arg;
+ Sleep(50);
+ PostMessageA(hWnd, WM_DDE_FIRST, 0, 0);
+ return 0;
+}
+
static void test_CoWaitForMultipleHandles(void)
{
static const char cls_name[] = "cowait_test_class";
@@ -2183,6 +2199,32 @@ static void test_CoWaitForMultipleHandles(void)
success = PeekMessageA(&msg, hWnd, WM_DDE_FIRST, WM_DDE_FIRST, PM_REMOVE);
ok(!success, "CoWaitForMultipleHandles didn't pump any messages\n");
+ /* test PostMessageA/SendMessageA from a different thread */
+
+ index = 0xdeadbeef;
+ thread = CreateThread(NULL, 0, post_message_thread, hWnd, 0, &tid);
+ ok(thread != NULL, "CreateThread failed, error %u\n", GetLastError());
+ hr = CoWaitForMultipleHandles(0, 100, 2, handles, &index);
+ ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08x\n", hr);
+ ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %u\n", index);
+ success = PeekMessageA(&msg, hWnd, WM_DDE_FIRST, WM_DDE_FIRST, PM_REMOVE);
+ ok(!success, "CoWaitForMultipleHandles didn't pump any messages\n");
+ index = WaitForSingleObject(thread, 200);
+ ok(index == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
+ CloseHandle(thread);
+
+ index = 0xdeadbeef;
+ thread = CreateThread(NULL, 0, send_message_thread, hWnd, 0, &tid);
+ ok(thread != NULL, "CreateThread failed, error %u\n", GetLastError());
+ hr = CoWaitForMultipleHandles(0, 100, 2, handles, &index);
+ ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08x\n", hr);
+ ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %u\n", index);
+ success = PeekMessageA(&msg, hWnd, WM_DDE_FIRST, WM_DDE_FIRST, PM_REMOVE);
+ ok(!success, "CoWaitForMultipleHandles didn't pump any messages\n");
+ index = WaitForSingleObject(thread, 200);
+ ok(index == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
+ CloseHandle(thread);
+
ReleaseSemaphore(handles[0], 1, NULL);
ReleaseSemaphore(handles[1], 1, NULL);
@@ -2264,7 +2306,7 @@ static void test_CoWaitForMultipleHandles(void)
hr = CoWaitForMultipleHandles(COWAIT_INPUTAVAILABLE, 50, 2, handles, &index);
ok(hr == RPC_S_CALLPENDING || broken(hr == E_INVALIDARG) || broken(hr == S_OK) /* Win 8 */,
"expected RPC_S_CALLPENDING, got 0x%08x\n", hr);
- ReleaseSemaphore(handles[1], 1, NULL);
+ if (hr != S_OK) ReleaseSemaphore(handles[1], 1, NULL);
ok(index == 0 || broken(index == 1) /* Win 8 */, "expected index 0, got %u\n", index);
success = PeekMessageA(&msg, hWnd, WM_DDE_FIRST, WM_DDE_FIRST, PM_REMOVE);
ok(!success || broken(success && hr == E_INVALIDARG),
@@ -2273,6 +2315,115 @@ static void test_CoWaitForMultipleHandles(void)
ok(index == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
CloseHandle(thread);
+ /* test behaviour of WM_QUIT (semaphores are still locked) */
+
+ PostMessageA(hWnd, WM_QUIT, 40, 0);
+ memset(&msg, 0, sizeof(msg));
+ success = PeekMessageA(&msg, hWnd, WM_QUIT, WM_QUIT, PM_REMOVE);
+ ok(success, "PeekMessageA failed, error %u\n", GetLastError());
+ ok(msg.message == WM_QUIT, "expected msg.message = WM_QUIT, got %u\n", msg.message);
+ ok(msg.wParam == 40, "expected msg.wParam = 40, got %lu\n", msg.wParam);
+ success = PeekMessageA(&msg, hWnd, WM_QUIT, WM_QUIT, PM_REMOVE);
+ ok(!success, "PeekMessageA succeeded\n");
+
+ index = 0xdeadbeef;
+ PostMessageA(hWnd, WM_DDE_FIRST, 0, 0);
+ PostMessageA(hWnd, WM_QUIT, 41, 0);
+ thread = CreateThread(NULL, 0, post_message_thread, hWnd, 0, &tid);
+ ok(thread != NULL, "CreateThread failed, error %u\n", GetLastError());
+ hr = CoWaitForMultipleHandles(0, 100, 2, handles, &index);
+ ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08x\n", hr);
+ ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %u\n", index);
+ success = PeekMessageA(&msg, hWnd, WM_DDE_FIRST, WM_DDE_FIRST, PM_REMOVE);
+ todo_wine
+ ok(success || broken(!success) /* Win 2000/XP/8 */, "PeekMessageA failed, error %u\n", GetLastError());
+ success = PeekMessageA(&msg, hWnd, WM_DDE_FIRST, WM_DDE_FIRST, PM_REMOVE);
+ ok(!success, "PeekMessageA succeeded\n");
+ memset(&msg, 0, sizeof(msg));
+ success = PeekMessageA(&msg, hWnd, WM_QUIT, WM_QUIT, PM_REMOVE);
+ todo_wine
+ ok(!success || broken(success) /* Win 2000/XP/8 */, "PeekMessageA succeeded\n");
+ if (success)
+ {
+ ok(msg.message == WM_QUIT, "expected msg.message = WM_QUIT, got %u\n", msg.message);
+ ok(msg.wParam == 41, "expected msg.wParam = 41, got %lu\n", msg.wParam);
+ }
+ index = WaitForSingleObject(thread, 200);
+ ok(index == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
+ CloseHandle(thread);
+
+ index = 0xdeadbeef;
+ PostMessageA(hWnd, WM_DDE_FIRST, 0, 0);
+ PostMessageA(hWnd, WM_QUIT, 42, 0);
+ thread = CreateThread(NULL, 0, send_message_thread, hWnd, 0, &tid);
+ ok(thread != NULL, "CreateThread failed, error %u\n", GetLastError());
+ hr = CoWaitForMultipleHandles(0, 100, 2, handles, &index);
+ ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08x\n", hr);
+ ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %u\n", index);
+ success = PeekMessageA(&msg, hWnd, WM_DDE_FIRST, WM_DDE_FIRST, PM_REMOVE);
+ ok(!success, "CoWaitForMultipleHandles didn't pump all WM_DDE_FIRST messages\n");
+ memset(&msg, 0, sizeof(msg));
+ success = PeekMessageA(&msg, hWnd, WM_QUIT, WM_QUIT, PM_REMOVE);
+ ok(success, "PeekMessageA failed, error %u\n", GetLastError());
+ ok(msg.message == WM_QUIT, "expected msg.message = WM_QUIT, got %u\n", msg.message);
+ ok(msg.wParam == 42, "expected msg.wParam = 42, got %lu\n", msg.wParam);
+ index = WaitForSingleObject(thread, 200);
+ ok(index == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
+ CloseHandle(thread);
+
+ PostQuitMessage(43);
+ memset(&msg, 0, sizeof(msg));
+ success = PeekMessageA(&msg, hWnd, WM_QUIT, WM_QUIT, PM_REMOVE);
+ ok(success || broken(!success) /* Win 8 */, "PeekMessageA failed, error %u\n", GetLastError());
+ if (!success)
+ win_skip("PostQuitMessage didn't queue a WM_QUIT message, skipping tests\n");
+ else
+ {
+ ok(msg.message == WM_QUIT, "expected msg.message = WM_QUIT, got %u\n", msg.message);
+ ok(msg.wParam == 43, "expected msg.wParam = 43, got %lu\n", msg.wParam);
+ success = PeekMessageA(&msg, hWnd, WM_QUIT, WM_QUIT, PM_REMOVE);
+ ok(!success, "PeekMessageA succeeded\n");
+
+ index = 0xdeadbeef;
+ PostMessageA(hWnd, WM_DDE_FIRST, 0, 0);
+ PostQuitMessage(44);
+ thread = CreateThread(NULL, 0, post_message_thread, hWnd, 0, &tid);
+ ok(thread != NULL, "CreateThread failed, error %u\n", GetLastError());
+ hr = CoWaitForMultipleHandles(0, 100, 2, handles, &index);
+ ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08x\n", hr);
+ ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %u\n", index);
+ success = PeekMessageA(&msg, hWnd, WM_DDE_FIRST, WM_DDE_FIRST, PM_REMOVE);
+ ok(success, "PeekMessageA failed, error %u\n", GetLastError());
+ success = PeekMessageA(&msg, hWnd, WM_DDE_FIRST, WM_DDE_FIRST, PM_REMOVE);
+ todo_wine
+ ok(!success, "PeekMessageA succeeded\n");
+ success = PeekMessageA(&msg, hWnd, WM_QUIT, WM_QUIT, PM_REMOVE);
+ todo_wine
+ ok(!success, "CoWaitForMultipleHandles didn't remove WM_QUIT messages\n");
+ index = WaitForSingleObject(thread, 200);
+ ok(index == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
+ CloseHandle(thread);
+
+ index = 0xdeadbeef;
+ PostMessageA(hWnd, WM_DDE_FIRST, 0, 0);
+ PostQuitMessage(45);
+ thread = CreateThread(NULL, 0, send_message_thread, hWnd, 0, &tid);
+ ok(thread != NULL, "CreateThread failed, error %u\n", GetLastError());
+ hr = CoWaitForMultipleHandles(0, 100, 2, handles, &index);
+ ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08x\n", hr);
+ ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %u\n", index);
+ success = PeekMessageA(&msg, hWnd, WM_DDE_FIRST, WM_DDE_FIRST, PM_REMOVE);
+ ok(success, "PeekMessageA failed, error %u\n", GetLastError());
+ success = PeekMessageA(&msg, hWnd, WM_DDE_FIRST, WM_DDE_FIRST, PM_REMOVE);
+ todo_wine
+ ok(!success, "PeekMessageA succeeded\n");
+ success = PeekMessageA(&msg, hWnd, WM_QUIT, WM_QUIT, PM_REMOVE);
+ ok(!success, "CoWaitForMultipleHandles didn't remove WM_QUIT messages\n");
+ index = WaitForSingleObject(thread, 200);
+ ok(index == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
+ CloseHandle(thread);
+ }
+
CloseHandle(handles[0]);
CloseHandle(handles[1]);
DestroyWindow(hWnd);
--
2.1.3