Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54194
If the SendMessageTimeout call takes a long time, we can get other messages which also set the observed wparam value. Apparently, this is especially likely on Windows 7.
This also removes the (wParam == 0xbaadbeef) check which may have been intended to serve the same goal but doesn't work because the observed wParam value is still assigned.
From: Esme Povirk esme@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54194
If the SendMessageTimeout call takes a long time, we can get other messages which also set the observed wparam value. Apparently, this is especially likely on Windows 7.
This also removes the (wParam == 0xbaadbeef) check which may have been intended to serve the same goal but doesn't work because the observed wParam value is still assigned. --- dlls/user32/tests/msg.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c index c931ca6a983..b5c4de23bc1 100644 --- a/dlls/user32/tests/msg.c +++ b/dlls/user32/tests/msg.c @@ -17847,14 +17847,13 @@ static void test_PostMessage(void) }
static WPARAM g_broadcast_wparam; +static UINT g_broadcast_msg; static LRESULT WINAPI broadcast_test_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { WNDPROC oldproc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
- if (wParam == 0xbaadbeef) + if (message == g_broadcast_msg) g_broadcast_wparam = wParam; - else - g_broadcast_wparam = 0;
return CallWindowProcA(oldproc, hwnd, message, wParam, lParam); } @@ -17864,7 +17863,8 @@ static LRESULT WINAPI broadcast_test_sub_proc(HWND hwnd, UINT message, WPARAM wP { int sub_index = GetWindowLongPtrA(hwnd, GWLP_USERDATA);
- g_broadcast_sub_wparam[sub_index] = (wParam == 0xbaadbeef) ? wParam : 0; + if (message == g_broadcast_msg) + g_broadcast_sub_wparam[sub_index] = wParam;
return CallWindowProcA(g_oldproc_sub[sub_index], hwnd, message, wParam, lParam); } @@ -17966,6 +17966,7 @@ static void test_broadcast(void) g_broadcast_wparam = 0xdead; for (j = 0; j < ARRAY_SIZE(bcast_expect); j++) g_broadcast_sub_wparam[j] = 0xdead; + g_broadcast_msg = messages[i]; ret = SendMessageTimeoutA(HWND_BROADCAST, messages[i], 0xbaadbeef, 0, SMTO_NORMAL, 2000, NULL); if (!ret && GetLastError() == ERROR_TIMEOUT) win_skip("broadcasting test %d, timeout\n", i);