Commit 1e9390e5 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Use platform-independent layout for ntuser_thread_info.

parent 149e7502
......@@ -235,7 +235,7 @@ static DWORD convert_candidatelist_AtoW(
static struct coinit_spy *get_thread_coinit_spy(void)
{
return NtUserGetThreadInfo()->client_imm;
return (struct coinit_spy *)(UINT_PTR)NtUserGetThreadInfo()->client_imm;
}
static void imm_couninit_thread(BOOL cleanup)
......@@ -299,7 +299,7 @@ static ULONG WINAPI InitializeSpy_Release(IInitializeSpy *iface)
if (!ref)
{
HeapFree(GetProcessHeap(), 0, spy);
NtUserGetThreadInfo()->client_imm = NULL;
NtUserGetThreadInfo()->client_imm = 0;
}
return ref;
}
......@@ -373,7 +373,7 @@ static void imm_coinit_thread(void)
spy->ref = 1;
spy->cookie.QuadPart = 0;
spy->apt_flags = 0;
NtUserGetThreadInfo()->client_imm = spy;
NtUserGetThreadInfo()->client_imm = (UINT_PTR)spy;
}
......@@ -440,7 +440,7 @@ static void IMM_FreeThreadData(void)
{
struct coinit_spy *spy;
free_input_context_data(NtUserGetThreadInfo()->default_imc);
free_input_context_data(UlongToHandle(NtUserGetThreadInfo()->default_imc));
if ((spy = get_thread_coinit_spy()))
IInitializeSpy_Release(&spy->IInitializeSpy_iface);
}
......
......@@ -60,10 +60,15 @@ static inline void *unpack_ptr( ULONGLONG ptr64 )
return (void *)(ULONG_PTR)ptr64;
}
static struct wm_char_mapping_data *get_wmchar_data(void)
{
return (struct wm_char_mapping_data *)(UINT_PTR)NtUserGetThreadInfo()->wmchar_data;
}
/* check for pending WM_CHAR message with DBCS trailing byte */
static inline BOOL get_pending_wmchar( MSG *msg, UINT first, UINT last, BOOL remove )
{
struct wm_char_mapping_data *data = NtUserGetThreadInfo()->wmchar_data;
struct wm_char_mapping_data *data = get_wmchar_data();
if (!data || !data->get_msg.message) return FALSE;
if ((first || last) && (first > WM_CHAR || last < WM_CHAR)) return FALSE;
......@@ -119,7 +124,7 @@ BOOL map_wparam_AtoW( UINT message, WPARAM *wparam, enum wm_char_mapping mapping
*/
if (mapping != WMCHAR_MAP_NOMAPPING)
{
struct wm_char_mapping_data *data = NtUserGetThreadInfo()->wmchar_data;
struct wm_char_mapping_data *data = get_wmchar_data();
BYTE low = LOBYTE(*wparam);
cp = get_input_codepage();
......@@ -152,7 +157,7 @@ BOOL map_wparam_AtoW( UINT message, WPARAM *wparam, enum wm_char_mapping mapping
{
if (!(data = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*data) )))
return FALSE;
NtUserGetThreadInfo()->wmchar_data = data;
NtUserGetThreadInfo()->wmchar_data = (UINT_PTR)data;
}
TRACE( "storing lead byte %02x mapping %u\n", low, mapping );
data->lead_byte[mapping] = low;
......@@ -210,11 +215,11 @@ static void map_wparam_WtoA( MSG *msg, BOOL remove )
len = WideCharToMultiByte( cp, 0, wch, 1, (LPSTR)ch, 2, NULL, NULL );
if (len == 2) /* DBCS char */
{
struct wm_char_mapping_data *data = NtUserGetThreadInfo()->wmchar_data;
struct wm_char_mapping_data *data = get_wmchar_data();
if (!data)
{
if (!(data = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*data) ))) return;
NtUserGetThreadInfo()->wmchar_data = data;
NtUserGetThreadInfo()->wmchar_data = (UINT_PTR)data;
}
if (remove)
{
......
......@@ -240,7 +240,7 @@ static void thread_detach(void)
WDML_NotifyThreadDetach();
NtUserCallNoParam( NtUserThreadDetach );
HeapFree( GetProcessHeap(), 0, thread_info->wmchar_data );
HeapFree( GetProcessHeap(), 0, (void *)(UINT_PTR)thread_info->wmchar_data );
}
......
......@@ -95,7 +95,7 @@ HWND get_hwnd_message_parent(void)
struct ntuser_thread_info *thread_info = NtUserGetThreadInfo();
if (!thread_info->msg_window) GetDesktopWindow(); /* trigger creation */
return thread_info->msg_window;
return UlongToHandle( thread_info->msg_window );
}
......@@ -109,8 +109,8 @@ BOOL is_desktop_window( HWND hwnd )
struct ntuser_thread_info *thread_info = NtUserGetThreadInfo();
if (!hwnd) return FALSE;
if (hwnd == thread_info->top_window) return TRUE;
if (hwnd == thread_info->msg_window) return TRUE;
if (hwnd == UlongToHandle( thread_info->top_window )) return TRUE;
if (hwnd == UlongToHandle( thread_info->msg_window )) return TRUE;
if (!HIWORD(hwnd) || HIWORD(hwnd) == 0xffff)
{
......@@ -582,7 +582,7 @@ HWND WINAPI GetDesktopWindow(void)
{
struct ntuser_thread_info *thread_info = NtUserGetThreadInfo();
if (thread_info->top_window) return thread_info->top_window;
if (thread_info->top_window) return UlongToHandle( thread_info->top_window );
return NtUserGetDesktopWindow();
}
......
......@@ -785,7 +785,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 == NtUserGetThreadInfo()->msg_window) return TRUE;
if (!parent || parent == UlongToHandle( NtUserGetThreadInfo()->msg_window )) return TRUE;
if (warned++) return FALSE;
ERR_(winediag)( "Application tried to create a window, but no driver could be loaded.\n" );
......
......@@ -212,8 +212,9 @@ UINT WINAPI NtUserAssociateInputContext( HWND hwnd, HIMC ctx, ULONG flags )
HIMC get_default_input_context(void)
{
struct ntuser_thread_info *thread_info = NtUserGetThreadInfo();
if (!thread_info->default_imc) thread_info->default_imc = NtUserCreateInputContext( 0 );
return thread_info->default_imc;
if (!thread_info->default_imc)
thread_info->default_imc = HandleToUlong( NtUserCreateInputContext( 0 ));
return UlongToHandle( thread_info->default_imc );
}
HIMC get_window_input_context( HWND hwnd )
......@@ -390,7 +391,7 @@ void cleanup_imm_thread(void)
thread_info->imm_thread_data = NULL;
}
NtUserDestroyInputContext( thread_info->client_info.default_imc );
NtUserDestroyInputContext( UlongToHandle( thread_info->client_info.default_imc ));
}
BOOL WINAPI ImmProcessKey( HWND hwnd, HKL hkl, UINT vkey, LPARAM key_data, DWORD unknown )
......
......@@ -173,7 +173,7 @@ HWND get_hwnd_message_parent(void)
struct ntuser_thread_info *thread_info = NtUserGetThreadInfo();
if (!thread_info->msg_window) get_desktop_window(); /* trigger creation */
return thread_info->msg_window;
return UlongToHandle( thread_info->msg_window );
}
/***********************************************************************
......@@ -225,8 +225,8 @@ BOOL is_desktop_window( HWND hwnd )
struct ntuser_thread_info *thread_info = NtUserGetThreadInfo();
if (!hwnd) return FALSE;
if (hwnd == thread_info->top_window) return TRUE;
if (hwnd == thread_info->msg_window) return TRUE;
if (hwnd == UlongToHandle( thread_info->top_window )) return TRUE;
if (hwnd == UlongToHandle( thread_info->msg_window )) return TRUE;
if (!HIWORD(hwnd) || HIWORD(hwnd) == 0xffff)
{
......@@ -4930,15 +4930,18 @@ static WND *create_window_handle( HWND parent, HWND owner, UNICODE_STRING *name,
if (name->Buffer == (const WCHAR *)DESKTOP_CLASS_ATOM)
{
if (!thread_info->top_window) thread_info->top_window = full_parent ? full_parent : handle;
else assert( full_parent == thread_info->top_window );
if (full_parent && !user_driver->pCreateDesktopWindow( thread_info->top_window ))
if (!thread_info->top_window)
thread_info->top_window = HandleToUlong( full_parent ? full_parent : handle );
else assert( full_parent == UlongToHandle( thread_info->top_window ));
if (full_parent &&
!user_driver->pCreateDesktopWindow( UlongToHandle( thread_info->top_window )))
ERR( "failed to create desktop window\n" );
register_builtin_classes();
}
else /* HWND_MESSAGE parent */
{
if (!thread_info->msg_window && !full_parent) thread_info->msg_window = handle;
if (!thread_info->msg_window && !full_parent)
thread_info->msg_window = HandleToUlong( handle );
}
}
......
......@@ -399,7 +399,7 @@ HWND get_desktop_window(void)
{
struct ntuser_thread_info *thread_info = NtUserGetThreadInfo();
if (thread_info->top_window) return thread_info->top_window;
if (thread_info->top_window) return UlongToHandle( thread_info->top_window );
SERVER_START_REQ( get_desktop_window )
......@@ -407,8 +407,8 @@ HWND get_desktop_window(void)
req->force = 0;
if (!wine_server_call( req ))
{
thread_info->top_window = wine_server_ptr_handle( reply->top_window );
thread_info->msg_window = wine_server_ptr_handle( reply->msg_window );
thread_info->top_window = reply->top_window;
thread_info->msg_window = reply->msg_window;
}
}
SERVER_END_REQ;
......@@ -489,18 +489,19 @@ HWND get_desktop_window(void)
req->force = 1;
if (!wine_server_call( req ))
{
thread_info->top_window = wine_server_ptr_handle( reply->top_window );
thread_info->msg_window = wine_server_ptr_handle( reply->msg_window );
thread_info->top_window = reply->top_window;
thread_info->msg_window = reply->msg_window;
}
}
SERVER_END_REQ;
}
if (!thread_info->top_window || !user_driver->pCreateDesktopWindow( thread_info->top_window ))
if (!thread_info->top_window ||
!user_driver->pCreateDesktopWindow( UlongToHandle( thread_info->top_window )))
ERR_(win)( "failed to create desktop window\n" );
register_builtin_classes();
return thread_info->top_window;
return UlongToHandle( thread_info->top_window );
}
static HANDLE get_winstations_dir_handle(void)
......
......@@ -245,7 +245,7 @@ static inline BOOL is_in_desktop_process(void)
static inline DWORD current_client_id(void)
{
DWORD client_id = PtrToUlong( NtUserGetThreadInfo()->driver_data );
DWORD client_id = NtUserGetThreadInfo()->driver_data;
return client_id ? client_id : GetCurrentProcessId();
}
......@@ -1137,7 +1137,7 @@ NTSTATUS android_dispatch_ioctl( void *arg )
if (in_size >= sizeof(*header))
{
irp->IoStatus.Information = 0;
NtUserGetThreadInfo()->driver_data = UlongToHandle( params->client_id );
NtUserGetThreadInfo()->driver_data = params->client_id;
irp->IoStatus.u.Status = func( irp->AssociatedIrp.SystemBuffer, in_size,
irpsp->Parameters.DeviceIoControl.OutputBufferLength,
&irp->IoStatus.Information );
......
......@@ -117,7 +117,7 @@ extern struct macdrv_thread_data *macdrv_init_thread_data(void) DECLSPEC_HIDDEN;
static inline struct macdrv_thread_data *macdrv_thread_data(void)
{
return NtUserGetThreadInfo()->driver_data;
return (struct macdrv_thread_data *)(UINT_PTR)NtUserGetThreadInfo()->driver_data;
}
......
......@@ -536,7 +536,7 @@ struct macdrv_thread_data *macdrv_init_thread_data(void)
macdrv_compute_keyboard_layout(data);
set_queue_display_fd(macdrv_get_event_queue_fd(data->queue));
NtUserGetThreadInfo()->driver_data = data;
NtUserGetThreadInfo()->driver_data = (UINT_PTR)data;
NtUserActivateKeyboardLayout(data->active_keyboard_layout, 0);
return data;
......
......@@ -393,7 +393,7 @@ extern struct x11drv_thread_data *x11drv_init_thread_data(void) DECLSPEC_HIDDEN;
static inline struct x11drv_thread_data *x11drv_thread_data(void)
{
return NtUserGetThreadInfo()->driver_data;
return (struct x11drv_thread_data *)(UINT_PTR)NtUserGetThreadInfo()->driver_data;
}
/* retrieve the thread display, or NULL if not created yet */
......
......@@ -734,7 +734,7 @@ void X11DRV_ThreadDetach(void)
XCloseDisplay( data->display );
free( data );
/* clear data in case we get re-entered from user32 before the thread is truly dead */
NtUserGetThreadInfo()->driver_data = NULL;
NtUserGetThreadInfo()->driver_data = 0;
}
}
......@@ -795,7 +795,7 @@ struct x11drv_thread_data *x11drv_init_thread_data(void)
if (TRACE_ON(synchronous)) XSynchronize( data->display, True );
set_queue_display_fd( data->display );
NtUserGetThreadInfo()->driver_data = data;
NtUserGetThreadInfo()->driver_data = (UINT_PTR)data;
if (use_xim) X11DRV_SetupXIM();
......
......@@ -61,19 +61,19 @@ enum
/* TEB thread info, not compatible with Windows */
struct ntuser_thread_info
{
void *driver_data; /* driver-specific data */
UINT64 driver_data; /* driver-specific data */
DWORD message_time; /* value for GetMessageTime */
DWORD message_pos; /* value for GetMessagePos */
ULONG_PTR message_extra; /* value for GetMessageExtraInfo */
UINT64 message_extra; /* value for GetMessageExtraInfo */
INPUT_MESSAGE_SOURCE msg_source; /* Message source for current message */
WORD recursion_count; /* SendMessage recursion counter */
UINT receive_flags; /* currently received message flags */
HWND top_window; /* desktop window */
HWND msg_window; /* HWND_MESSAGE parent window */
UINT top_window; /* desktop window */
UINT msg_window; /* HWND_MESSAGE parent window */
DPI_AWARENESS dpi_awareness; /* DPI awareness */
HIMC default_imc; /* default input context */
void *client_imm; /* client IMM thread info */
struct wm_char_mapping_data *wmchar_data; /* Data for WM_CHAR mappings */
UINT default_imc; /* default input context */
UINT64 client_imm; /* client IMM thread info */
UINT64 wmchar_data; /* client data for WM_CHAR mappings */
};
static inline struct ntuser_thread_info *NtUserGetThreadInfo(void)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment