ole32:fix CoWaitForMultipleHandles cause RPC hang
Changhui Liu
liuchanghui at linuxdeepin.com
Sat Dec 13 09:15:06 CST 2014
Hi Sebastian,
I tested your current work-in-progress patch:
https://github.com/wine-compholio/wine-staging/blob/master/patches/ole32-CoWaitForMultipleHandles/0001-ole32-tests-Add-additional-tests-for-CoWaitForMultip.patch
I have two puzzles about these code:
> 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());
The first, why use the PeekMessage to check if received a WM_DDE_FIRST message?
Is there an real application do like that way?
In fact CoWaitForMultipleHandles has a message loop, the WM_DDE_FIRST message has been
dispatched to the window's WNDPROC. So the PeekMessageA certainly failed.
I think the correct test should be this:
1, Define a custom WNDPROC function named cowait_test_wnd_proc .
2, Define a global int variable named g_count_of_wm_dde_first.
3, Set the value of g_count_of_wm_dde_first to zero before call CoWaitForMultipleHandles.
4, Increase the value of g_count_of_wm_dde_first by one, once received a WM_DDE_FIRST message in cowait_test_wnd_proc.
5, Check if the value of g_count_of_wm_dde_first is equal to 2 after CoWaitForMultipleHandles returned.
The second is why use todo_wine ?
todo_wine
ok(!success, "PeekMessageA succeeded\n");
why not just write?
ok(!success, "PeekMessageA succeeded\n");
Thank you.
------------------
Regards.
------------------ Original ------------------
From: "Sebastian Lackner"<sebastian at fds-team.de>;
Date: Fri, Dec 12, 2014 11:57 AM
To: "Changhui Liu"<liuchanghui at linuxdeepin.com>;
Cc: "wine-devel"<wine-devel at winehq.org>;
Subject: Re: ole32:fix CoWaitForMultipleHandles cause RPC hang
On 12.12.2014 04:36, Changhui Liu wrote:
> Hi, I modified my patch, it has passed test on
> https://testbot.winehq.org/JobDetails.pl?Key=10745&log_202=1#k202
>
>
> My test aims to reproduce the bug.
>
>
Sorry, but this patch is still not sufficient, it doesn't cover all situations how WM_QUIT messages are handled. As you can easily test with my current work-in-progress patch
https://github.com/wine-compholio/wine-staging/blob/master/patches/ole32-CoWaitForMultipleHandles/0001-ole32-tests-Add-additional-tests-for-CoWaitForMultip.patch
your suggested fix breaks other stuff (which was working fine before), and so is most likely not correct.
I am not even sure if the problem is really in ole32, it might also be possible that the real problem is in the user32 message handling or probably somewhere else - but the only way to find that out is to write additional tests. Just testing this specific use-case will not be enough to justify a change, which might break other apps. ;)
Regards,
Sebastian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20141213/73b0c247/attachment.html>
More information about the wine-devel
mailing list