From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/message.c | 6 +++--- dlls/win32u/ntuser_private.h | 1 - dlls/win32u/sysparams.c | 4 +++- include/ntuser.h | 1 + 4 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 035ab6574e4..aafb46a7cc0 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -3103,10 +3103,10 @@ static void process_sent_messages(void) */ static HANDLE get_server_queue_handle(void) { - struct user_thread_info *thread_info = get_user_thread_info(); + struct ntuser_thread_info *thread_info = NtUserGetThreadInfo(); HANDLE ret;
- if (!(ret = thread_info->server_queue)) + if (!(ret = UlongToHandle( thread_info->server_queue ))) { SERVER_START_REQ( get_msg_queue_handle ) { @@ -3114,7 +3114,7 @@ static HANDLE get_server_queue_handle(void) ret = wine_server_ptr_handle( reply->handle ); } SERVER_END_REQ; - thread_info->server_queue = ret; + thread_info->server_queue = HandleToUlong( ret ); if (!ret) ERR( "Cannot get server thread queue\n" ); } return ret; diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h index f5559c5ca4f..e546703f71b 100644 --- a/dlls/win32u/ntuser_private.h +++ b/dlls/win32u/ntuser_private.h @@ -100,7 +100,6 @@ static inline BOOL is_broadcast( HWND hwnd ) struct user_thread_info { struct ntuser_thread_info client_info; /* Data shared with client */ - HANDLE server_queue; /* Handle to server-side queue */ DWORD last_getmsg_time; /* Get/PeekMessage last request time */ LONGLONG last_driver_time; /* Get/PeekMessage driver event time */ WORD hook_call_depth; /* Number of recursively called hook procs */ diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index a242bc493fa..5f391a50a86 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -7047,6 +7047,7 @@ BOOL is_exiting_thread( DWORD tid ) static void thread_detach(void) { struct user_thread_info *thread_info = get_user_thread_info(); + HANDLE server_queue = UlongToHandle( thread_info->client_info.server_queue );
destroy_thread_windows(); user_driver->pThreadDetach(); @@ -7054,7 +7055,8 @@ static void thread_detach(void) free( thread_info->rawinput );
cleanup_imm_thread(); - NtClose( thread_info->server_queue ); + if (server_queue) NtClose( server_queue ); + thread_info->client_info.server_queue = 0; free( thread_info->session_data );
exiting_thread_id = 0; diff --git a/include/ntuser.h b/include/ntuser.h index ef09d7e97bb..1de2569bade 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -134,6 +134,7 @@ struct ntuser_thread_info UINT default_imc; /* default input context */ UINT64 client_imm; /* client IMM thread info */ UINT64 wmchar_data; /* client data for WM_CHAR mappings */ + UINT server_queue; /* handle of the server-side queue */ };
static inline struct ntuser_thread_info *NtUserGetThreadInfo(void)