win32u: Expose public parts of user_thread_info in ntuser.h.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2022-04-19 15:31:01 +02:00 committed by Alexandre Julliard
parent aae5430120
commit 356f37466f
9 changed files with 39 additions and 28 deletions

View File

@ -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;
}

View File

@ -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();

View File

@ -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" );

View File

@ -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 );

View File

@ -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 */
};

View File

@ -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();

View File

@ -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)
{

View File

@ -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;

View File

@ -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
{