diff --git a/dlls/user32/message.c b/dlls/user32/message.c index 611f603fc1e..446b55876ea 100644 --- a/dlls/user32/message.c +++ b/dlls/user32/message.c @@ -954,7 +954,7 @@ LRESULT WINAPI DECLSPEC_HOTPATCH DispatchMessageW( const MSG* msg ) */ DWORD WINAPI GetMessagePos(void) { - return get_user_thread_info()->GetMessagePosVal; + return NtUserGetThreadInfo()->message_pos; } @@ -975,7 +975,7 @@ DWORD WINAPI GetMessagePos(void) */ LONG WINAPI GetMessageTime(void) { - return get_user_thread_info()->GetMessageTimeVal; + return NtUserGetThreadInfo()->message_time; } @@ -985,7 +985,7 @@ LONG WINAPI GetMessageTime(void) */ LPARAM WINAPI GetMessageExtraInfo(void) { - return get_user_thread_info()->GetMessageExtraInfoVal; + return NtUserGetThreadInfo()->message_extra; } @@ -994,9 +994,9 @@ LPARAM WINAPI GetMessageExtraInfo(void) */ LPARAM WINAPI SetMessageExtraInfo(LPARAM lParam) { - struct user_thread_info *thread_info = get_user_thread_info(); - LONG old_value = thread_info->GetMessageExtraInfoVal; - thread_info->GetMessageExtraInfoVal = lParam; + struct ntuser_thread_info *thread_info = NtUserGetThreadInfo(); + LONG old_value = thread_info->message_extra; + thread_info->message_extra = lParam; return old_value; } diff --git a/dlls/user32/win.c b/dlls/user32/win.c index 8640ad5a473..511aa363af7 100644 --- a/dlls/user32/win.c +++ b/dlls/user32/win.c @@ -113,7 +113,7 @@ static HWND *list_window_children( HDESK desktop, HWND hwnd, UNICODE_STRING *cla */ HWND get_hwnd_message_parent(void) { - struct user_thread_info *thread_info = get_user_thread_info(); + struct ntuser_thread_info *thread_info = NtUserGetThreadInfo(); if (!thread_info->msg_window) GetDesktopWindow(); /* trigger creation */ return thread_info->msg_window; @@ -127,7 +127,7 @@ HWND get_hwnd_message_parent(void) */ BOOL is_desktop_window( HWND hwnd ) { - struct user_thread_info *thread_info = get_user_thread_info(); + struct ntuser_thread_info *thread_info = NtUserGetThreadInfo(); if (!hwnd) return FALSE; if (hwnd == thread_info->top_window) return TRUE; @@ -857,7 +857,7 @@ HWND WINAPI FindWindowW( LPCWSTR className, LPCWSTR title ) */ HWND WINAPI GetDesktopWindow(void) { - struct user_thread_info *thread_info = get_user_thread_info(); + struct ntuser_thread_info *thread_info = NtUserGetThreadInfo(); if (thread_info->top_window) return thread_info->top_window; return NtUserGetDesktopWindow(); diff --git a/dlls/win32u/driver.c b/dlls/win32u/driver.c index 83814ba14f5..37d9333e522 100644 --- a/dlls/win32u/driver.c +++ b/dlls/win32u/driver.c @@ -757,7 +757,7 @@ static BOOL nodrv_CreateWindow( HWND hwnd ) HWND parent = NtUserGetAncestor( hwnd, GA_PARENT ); /* HWND_MESSAGE windows don't need a graphics driver */ - if (!parent || parent == get_user_thread_info()->msg_window) return TRUE; + if (!parent || parent == NtUserGetThreadInfo()->msg_window) return TRUE; if (warned++) return FALSE; ERR_(winediag)( "Application tried to create a window, but no driver could be loaded.\n" ); diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 644e91aed4f..400cc242156 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -1798,9 +1798,9 @@ static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags, continue; /* ignore it */ } *msg = info.msg; - thread_info->GetMessagePosVal = MAKELONG( info.msg.pt.x, info.msg.pt.y ); - thread_info->GetMessageTimeVal = info.msg.time; - thread_info->GetMessageExtraInfoVal = msg_data->hardware.info; + thread_info->client_info.message_pos = MAKELONG( info.msg.pt.x, info.msg.pt.y ); + thread_info->client_info.message_time = info.msg.time; + thread_info->client_info.message_extra = msg_data->hardware.info; free( buffer ); call_hooks( WH_GETMESSAGE, HC_ACTION, flags & PM_REMOVE, (LPARAM)msg, TRUE ); return 1; @@ -1833,9 +1833,9 @@ static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags, } *msg = info.msg; msg->pt = point_phys_to_win_dpi( info.msg.hwnd, info.msg.pt ); - thread_info->GetMessagePosVal = MAKELONG( msg->pt.x, msg->pt.y ); - thread_info->GetMessageTimeVal = info.msg.time; - thread_info->GetMessageExtraInfoVal = 0; + thread_info->client_info.message_pos = MAKELONG( msg->pt.x, msg->pt.y ); + thread_info->client_info.message_time = info.msg.time; + thread_info->client_info.message_extra = 0; thread_info->msg_source = msg_source_unavailable; free( buffer ); call_hooks( WH_GETMESSAGE, HC_ACTION, flags & PM_REMOVE, (LPARAM)msg, TRUE ); diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h index 650380717ab..801bc445b36 100644 --- a/dlls/win32u/ntuser_private.h +++ b/dlls/win32u/ntuser_private.h @@ -138,6 +138,7 @@ static inline BOOL is_broadcast( HWND hwnd ) /* no attempt is made to keep the layout compatible with the Windows one */ struct user_thread_info { + struct ntuser_thread_info client_info; /* Data shared with client */ HANDLE server_queue; /* Handle to server-side queue */ DWORD wake_mask; /* Current queue wake mask */ DWORD changed_mask; /* Current queue changed mask */ @@ -151,14 +152,9 @@ struct user_thread_info INPUT_MESSAGE_SOURCE msg_source; /* Message source for current message */ struct received_message_info *receive_info; /* Message being currently received */ struct wm_char_mapping_data *wmchar_data; /* Data for WM_CHAR mappings */ - DWORD GetMessageTimeVal; /* Value for GetMessageTime */ - DWORD GetMessagePosVal; /* Value for GetMessagePos */ - ULONG_PTR GetMessageExtraInfoVal; /* Value for GetMessageExtraInfo */ struct user_key_state_info *key_state; /* Cache of global key state */ HKL kbd_layout; /* Current keyboard layout */ DWORD kbd_layout_id; /* Current keyboard layout ID */ - HWND top_window; /* Desktop window */ - HWND msg_window; /* HWND_MESSAGE parent window */ struct rawinput_thread_data *rawinput; /* RawInput thread local data / buffer */ UINT spy_indent; /* Current spy indent */ }; diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 66e4558dba9..535f3bdb95b 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -4639,7 +4639,7 @@ ULONG_PTR WINAPI NtUserCallNoParam( ULONG code ) return get_input_state(); case NtUserCallNoParam_GetMessagePos: - return get_user_thread_info()->GetMessagePosVal; + return NtUserGetThreadInfo()->message_pos; case NtUserCallNoParam_ReleaseCapture: return release_capture(); diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 3b8b6b8d42c..1026b706832 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -166,7 +166,7 @@ static WND *next_thread_window_ptr( HWND *hwnd ) */ HWND get_hwnd_message_parent(void) { - struct user_thread_info *thread_info = get_user_thread_info(); + struct ntuser_thread_info *thread_info = NtUserGetThreadInfo(); if (!thread_info->msg_window) get_desktop_window(); /* trigger creation */ return thread_info->msg_window; @@ -218,7 +218,7 @@ HWND get_full_window_handle( HWND hwnd ) */ BOOL is_desktop_window( HWND hwnd ) { - struct user_thread_info *thread_info = get_user_thread_info(); + struct ntuser_thread_info *thread_info = NtUserGetThreadInfo(); if (!hwnd) return FALSE; if (hwnd == thread_info->top_window) return TRUE; @@ -4678,7 +4678,7 @@ static WND *create_window_handle( HWND parent, HWND owner, UNICODE_STRING *name, if (!parent) /* if parent is 0 we don't have a desktop window yet */ { - struct user_thread_info *thread_info = get_user_thread_info(); + struct ntuser_thread_info *thread_info = NtUserGetThreadInfo(); if (name->Buffer == (const WCHAR *)DESKTOP_CLASS_ATOM) { diff --git a/dlls/win32u/winstation.c b/dlls/win32u/winstation.c index 8e47c97510e..4cd223750c2 100644 --- a/dlls/win32u/winstation.c +++ b/dlls/win32u/winstation.c @@ -239,8 +239,8 @@ BOOL WINAPI NtUserSetThreadDesktop( HDESK handle ) { struct user_thread_info *thread_info = get_user_thread_info(); struct user_key_state_info *key_state_info = thread_info->key_state; - thread_info->top_window = 0; - thread_info->msg_window = 0; + thread_info->client_info.top_window = 0; + thread_info->client_info.msg_window = 0; if (key_state_info) key_state_info->time = 0; } return ret; @@ -397,7 +397,7 @@ static inline TEB64 *NtCurrentTeb64(void) { return (TEB64 *)NtCurrentTeb()->GdiB HWND get_desktop_window(void) { - struct user_thread_info *thread_info = get_user_thread_info(); + struct ntuser_thread_info *thread_info = NtUserGetThreadInfo(); if (thread_info->top_window) return thread_info->top_window; diff --git a/include/ntuser.h b/include/ntuser.h index 61ee94f7a5c..2f1f9893ea9 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -42,6 +42,21 @@ enum NtUserCallCount }; +/* TEB thread info, not compatible with Windows */ +struct ntuser_thread_info +{ + DWORD message_time; /* value for GetMessageTime */ + DWORD message_pos; /* value for GetMessagePos */ + ULONG_PTR message_extra; /* value for GetMessageExtraInfo */ + HWND top_window; /* desktop window */ + HWND msg_window; /* HWND_MESSAGE parent window */ +}; + +static inline struct ntuser_thread_info *NtUserGetThreadInfo(void) +{ + return (struct ntuser_thread_info *)NtCurrentTeb()->Win32ClientInfo; +} + /* NtUserCallEnumDisplayMonitor params */ struct enum_display_monitor_params {