From: "Roman Pišl" Subject: [PATCH 1/2] ole32/test: Test reentrancy of QueryContinueDrag. Message-Id: <20200216130536.24231-1-rpisl@seznam.cz> Date: Sun, 16 Feb 2020 14:05:35 +0100 QueryContinueDrag is not reentrant on Windows. Signed-off-by: Roman Pišl --- dlls/ole32/tests/dragdrop.c | 38 ++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/dlls/ole32/tests/dragdrop.c b/dlls/ole32/tests/dragdrop.c index 77e47d723d..82564a620a 100644 --- a/dlls/ole32/tests/dragdrop.c +++ b/dlls/ole32/tests/dragdrop.c @@ -260,6 +260,7 @@ struct method_call call_lists[][30] = }; static int droptarget_refs; +static int test_reentrance; /* helper macros to make tests a bit leaner */ #define ok_ole_success(hr, func) ok(hr == S_OK, func " failed with error 0x%08x\n", hr) @@ -359,7 +360,19 @@ static HRESULT WINAPI DropSource_QueryContinueDrag( BOOL fEscapePressed, DWORD grfKeyState) { - return check_expect(DS_QueryContinueDrag, 0, NULL); + HRESULT hr = check_expect(DS_QueryContinueDrag, 0, NULL); + if (test_reentrance) + { + MSG msg; + Sleep(100); + /* run the message loop for this thread */ + while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE)) + { + TranslateMessage(&msg); + DispatchMessageA(&msg); + } + } + return hr; } static HRESULT WINAPI DropSource_GiveFeedback( @@ -701,17 +714,20 @@ static void test_DoDragDrop(void) GetWindowRect(hwnd, &rect); ok(SetCursorPos(rect.left+50, rect.top+50), "SetCursorPos failed\n"); - for (seq = 0; seq < ARRAY_SIZE(call_lists); seq++) + for (test_reentrance = 0; test_reentrance < 2; test_reentrance++) { - DWORD effect_in; - trace("%d\n", seq); - call_ptr = call_lists[seq]; - effect_in = call_ptr->set_param; - call_ptr++; - - hr = DoDragDrop(&DataObject, &DropSource, effect_in, &effect); - check_expect(DoDragDrop_ret, hr, NULL); - check_expect(DoDragDrop_effect_out, effect, NULL); + for (seq = 0; seq < ARRAY_SIZE(call_lists); seq++) + { + DWORD effect_in; + trace("%d\n", seq); + call_ptr = call_lists[seq]; + effect_in = call_ptr->set_param; + call_ptr++; + + hr = DoDragDrop(&DataObject, &DropSource, effect_in, &effect); + check_expect(DoDragDrop_ret, hr, NULL); + check_expect(DoDragDrop_effect_out, effect, NULL); + } } OleUninitialize(); -- 2.20.1