[PATCH 5/8] dinput: Post messages to the internal window instead of tid.

Rémi Bernon rbernon at codeweavers.com
Wed Jan 5 07:58:39 CST 2022


Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52263
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
 dlls/dinput/dinput_main.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c
index 69a38f9ce65..5ba959e8414 100644
--- a/dlls/dinput/dinput_main.c
+++ b/dlls/dinput/dinput_main.c
@@ -79,7 +79,6 @@ HINSTANCE DINPUT_instance;
 static HWND di_em_win;
 
 static HANDLE dinput_thread;
-static DWORD dinput_thread_id;
 
 static CRITICAL_SECTION dinput_hook_crit;
 static CRITICAL_SECTION_DEBUG dinput_critsect_debug =
@@ -1373,7 +1372,7 @@ static BOOL WINAPI dinput_thread_start_once( INIT_ONCE *once, void *param, void
     start_event = CreateEventW( NULL, FALSE, FALSE, NULL );
     if (!start_event) ERR( "failed to create start event, error %u\n", GetLastError() );
 
-    dinput_thread = CreateThread( NULL, 0, dinput_thread_proc, start_event, 0, &dinput_thread_id );
+    dinput_thread = CreateThread( NULL, 0, dinput_thread_proc, start_event, 0, NULL );
     if (!dinput_thread) ERR( "failed to create internal thread, error %u\n", GetLastError() );
 
     WaitForSingleObject( start_event, INFINITE );
@@ -1390,7 +1389,7 @@ static void dinput_thread_start(void)
 
 static void dinput_thread_stop(void)
 {
-    PostThreadMessageW( dinput_thread_id, WM_USER + 0x10, 0, 0 );
+    PostMessageW( di_em_win, WM_USER + 0x10, 0, 0 );
     WaitForSingleObject( dinput_thread, INFINITE );
     CloseHandle( dinput_thread );
 }
@@ -1449,7 +1448,7 @@ void check_dinput_hooks( IDirectInputDevice8W *iface, BOOL acquired )
     }
 
     hook_change_finished_event = CreateEventW( NULL, FALSE, FALSE, NULL );
-    PostThreadMessageW( dinput_thread_id, WM_USER + 0x10, 1, (LPARAM)hook_change_finished_event );
+    PostMessageW( di_em_win, WM_USER + 0x10, 1, (LPARAM)hook_change_finished_event );
 
     LeaveCriticalSection(&dinput_hook_crit);
 
-- 
2.34.1




More information about the wine-devel mailing list