From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/imm.c | 3 +-- dlls/win32u/ntuser_private.h | 2 +- dlls/win32u/window.c | 8 ++++---- 3 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/dlls/win32u/imm.c b/dlls/win32u/imm.c index 8aeee81c773..85f2b226989 100644 --- a/dlls/win32u/imm.c +++ b/dlls/win32u/imm.c @@ -425,9 +425,8 @@ NTSTATUS WINAPI NtUserBuildHimcList( UINT thread_id, UINT count, HIMC *buffer, U
*size = 0; user_lock(); - while (count && (imc = next_process_user_handle_ptr( &handle, NTUSER_OBJ_IMC ))) + while (count && (imc = next_thread_user_object( thread_id, &handle, NTUSER_OBJ_IMC ))) { - if (thread_id != -1 && imc->thread_id != thread_id) continue; buffer[(*size)++] = handle; count--; } diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h index ae2a8b04d22..83fe682da79 100644 --- a/dlls/win32u/ntuser_private.h +++ b/dlls/win32u/ntuser_private.h @@ -235,7 +235,7 @@ HANDLE alloc_user_handle( struct user_object *ptr, unsigned short type ); void *free_user_handle( HANDLE handle, unsigned short type ); void *get_user_handle_ptr( HANDLE handle, unsigned short type ); void release_user_handle_ptr( void *ptr ); -void *next_process_user_handle_ptr( HANDLE *handle, unsigned short type ); +void *next_thread_user_object( UINT tid, HANDLE *handle, unsigned short type ); UINT win_set_flags( HWND hwnd, UINT set_mask, UINT clear_mask );
static inline UINT win_get_flags( HWND hwnd ) diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 8bd6e7b9aa1..688ece598cd 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -147,11 +147,11 @@ void *get_user_handle_ptr( HANDLE handle, unsigned short type ) }
/*********************************************************************** - * next_process_user_handle_ptr + * next_thread_user_object * * user_lock must be held by caller. */ -void *next_process_user_handle_ptr( HANDLE *handle, unsigned short type ) +void *next_thread_user_object( UINT tid, HANDLE *handle, unsigned short type ) { WORD index = *handle ? USER_HANDLE_TO_INDEX( *handle ) + 1 : 0; struct user_entry entry; @@ -161,6 +161,7 @@ void *next_process_user_handle_ptr( HANDLE *handle, unsigned short type ) { if (!get_user_entry_at( i, type, &entry, handle )) continue; if (entry.pid != GetCurrentProcessId()) continue; + if (tid != -1 && entry.tid != tid) continue; return client_objects[i]; }
@@ -5210,9 +5211,8 @@ void destroy_thread_windows(void) HANDLE handle = 0;
user_lock(); - while ((win = next_process_user_handle_ptr( &handle, NTUSER_OBJ_WINDOW ))) + while ((win = next_thread_user_object( GetCurrentThreadId(), &handle, NTUSER_OBJ_WINDOW ))) { - if (win->tid != GetCurrentThreadId()) continue; free_dce( win->dce, win->obj.handle ); set_user_handle_ptr( handle, NULL ); win->userdata = (UINT_PTR)free_list;