Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
1e9390e5
Commit
1e9390e5
authored
Jul 30, 2022
by
Jacek Caban
Committed by
Alexandre Julliard
Aug 09, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
win32u: Use platform-independent layout for ntuser_thread_info.
parent
149e7502
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
56 additions
and
46 deletions
+56
-46
imm.c
dlls/imm32/imm.c
+4
-4
message.c
dlls/user32/message.c
+10
-5
user_main.c
dlls/user32/user_main.c
+1
-1
win.c
dlls/user32/win.c
+4
-4
driver.c
dlls/win32u/driver.c
+1
-1
imm.c
dlls/win32u/imm.c
+4
-3
window.c
dlls/win32u/window.c
+10
-7
winstation.c
dlls/win32u/winstation.c
+8
-7
device.c
dlls/wineandroid.drv/device.c
+2
-2
macdrv.h
dlls/winemac.drv/macdrv.h
+1
-1
macdrv_main.c
dlls/winemac.drv/macdrv_main.c
+1
-1
x11drv.h
dlls/winex11.drv/x11drv.h
+1
-1
x11drv_main.c
dlls/winex11.drv/x11drv_main.c
+2
-2
ntuser.h
include/ntuser.h
+7
-7
No files found.
dlls/imm32/imm.c
View file @
1e9390e5
...
...
@@ -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
);
}
...
...
dlls/user32/message.c
View file @
1e9390e5
...
...
@@ -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
)
{
...
...
dlls/user32/user_main.c
View file @
1e9390e5
...
...
@@ -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
);
}
...
...
dlls/user32/win.c
View file @
1e9390e5
...
...
@@ -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
();
}
...
...
dlls/win32u/driver.c
View file @
1e9390e5
...
...
@@ -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
"
);
...
...
dlls/win32u/imm.c
View file @
1e9390e5
...
...
@@ -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
)
...
...
dlls/win32u/window.c
View file @
1e9390e5
...
...
@@ -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
);
}
}
...
...
dlls/win32u/winstation.c
View file @
1e9390e5
...
...
@@ -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
)
...
...
dlls/wineandroid.drv/device.c
View file @
1e9390e5
...
...
@@ -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
);
...
...
dlls/winemac.drv/macdrv.h
View file @
1e9390e5
...
...
@@ -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
;
}
...
...
dlls/winemac.drv/macdrv_main.c
View file @
1e9390e5
...
...
@@ -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
;
...
...
dlls/winex11.drv/x11drv.h
View file @
1e9390e5
...
...
@@ -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 */
...
...
dlls/winex11.drv/x11drv_main.c
View file @
1e9390e5
...
...
@@ -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
();
...
...
include/ntuser.h
View file @
1e9390e5
...
...
@@ -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 */
U
LONG_PTR
message_extra
;
/* value for GetMessageExtraInfo */
U
INT64
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
;
/* D
ata for WM_CHAR mappings */
UINT
default_imc
;
/* default input context */
UINT64
client_imm
;
/* client IMM thread info */
UINT64
wmchar_data
;
/* client d
ata for WM_CHAR mappings */
};
static
inline
struct
ntuser_thread_info
*
NtUserGetThreadInfo
(
void
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment