Connor McAdams : user32/tests: Store thread ID of thread we're watching for winevents.

Alexandre Julliard julliard at winehq.org
Tue Sep 28 16:01:58 CDT 2021


Module: wine
Branch: master
Commit: 5d48747eca66ac7d5b101a54e5b26463940c98ec
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=5d48747eca66ac7d5b101a54e5b26463940c98ec

Author: Connor McAdams <cmcadams at codeweavers.com>
Date:   Mon Sep 27 18:28:09 2021 -0400

user32/tests: Store thread ID of thread we're watching for winevents.

Since we're watching a specific thread ID for winevents, check that the
thread ID passed in the winevent callback function matches the thread
we're watching, instead of the thread currently executing.

Signed-off-by: Connor McAdams <cmcadams at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/user32/tests/msg.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index 66e6069da54..e47bf83c254 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -110,6 +110,7 @@ static HWINEVENTHOOK hEvent_hook;
 static HHOOK hKBD_hook;
 static HHOOK hCBT_hook;
 static DWORD cbt_hook_thread_id;
+static DWORD winevent_hook_thread_id;
 
 static const WCHAR testWindowClassW[] =
 { 'T','e','s','t','W','i','n','d','o','w','C','l','a','s','s','W',0 };
@@ -10378,7 +10379,7 @@ static void CALLBACK win_event_proc(HWINEVENTHOOK hevent,
 				    DWORD thread_id,
 				    DWORD event_time)
 {
-    ok(thread_id == GetCurrentThreadId(), "we didn't ask for events from other threads\n");
+    ok(thread_id == winevent_hook_thread_id, "we didn't ask for events from other threads\n");
 
     /* ignore mouse cursor events */
     if (object_id == OBJID_CURSOR) return;
@@ -18607,7 +18608,7 @@ START_TEST(msg)
     }
     if (!hEvent_hook) win_skip( "no win event hook support\n" );
 
-    cbt_hook_thread_id = GetCurrentThreadId();
+    cbt_hook_thread_id = winevent_hook_thread_id = GetCurrentThreadId();
     hCBT_hook = SetWindowsHookExA(WH_CBT, cbt_hook_proc, 0, GetCurrentThreadId());
     if (!hCBT_hook) win_skip( "cannot set global hook, will skip hook tests\n" );
 




More information about the wine-cvs mailing list