Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
4777bd62
Commit
4777bd62
authored
Jul 17, 2023
by
Jacek Caban
Committed by
Alexandre Julliard
Jul 27, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
win32u: Use user message packing for messages passing string.
parent
78a4bad8
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
9 deletions
+43
-9
winproc.c
dlls/user32/winproc.c
+7
-4
hook.c
dlls/win32u/hook.c
+1
-1
message.c
dlls/win32u/message.c
+21
-2
win32u.c
dlls/win32u/tests/win32u.c
+12
-1
win32u_private.h
dlls/win32u/win32u_private.h
+2
-1
No files found.
dlls/user32/winproc.c
View file @
4777bd62
...
...
@@ -833,17 +833,13 @@ BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lparam,
break
;
case
WM_GETTEXT
:
case
WM_ASKCBFORMATNAME
:
break
;
case
WM_WININICHANGE
:
if
(
!*
lparam
)
return
TRUE
;
/* fall through */
case
WM_SETTEXT
:
case
WM_DEVMODECHANGE
:
case
CB_DIR
:
case
LB_DIR
:
case
LB_ADDFILE
:
case
EM_REPLACESEL
:
if
(
!
check_string
(
*
buffer
,
size
))
return
FALSE
;
break
;
case
WM_GETMINMAXINFO
:
minsize
=
sizeof
(
MINMAXINFO
);
...
...
@@ -1184,6 +1180,13 @@ BOOL WINAPI User32CallWindowProc( struct win_proc_params *params, ULONG size )
case
WM_NCCALCSIZE
:
case
WM_GETTEXT
:
case
WM_ASKCBFORMATNAME
:
case
WM_WININICHANGE
:
case
WM_SETTEXT
:
case
WM_DEVMODECHANGE
:
case
CB_DIR
:
case
LB_DIR
:
case
LB_ADDFILE
:
case
EM_REPLACESEL
:
{
LRESULT
*
result_ptr
=
(
LRESULT
*
)
buffer
-
1
;
*
result_ptr
=
result
;
...
...
dlls/win32u/hook.c
View file @
4777bd62
...
...
@@ -246,7 +246,7 @@ static LRESULT call_hook( struct win_hook_params *info, const WCHAR *module, siz
if
(
params
->
id
==
WH_CBT
&&
params
->
code
==
HCBT_CREATEWND
)
{
CBT_CREATEWNDW
*
cbtc
=
(
CBT_CREATEWNDW
*
)
params
->
lparam
;
message_size
=
user_message_size
(
WM_NCCREATE
,
0
,
(
LPARAM
)
cbtc
->
lpcs
,
FALSE
);
message_size
=
user_message_size
(
WM_NCCREATE
,
0
,
(
LPARAM
)
cbtc
->
lpcs
,
TRUE
,
FALSE
);
lparam_size
=
lparam_ret_size
=
0
;
}
...
...
dlls/win32u/message.c
View file @
4777bd62
...
...
@@ -420,6 +420,16 @@ static BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lpa
case
WM_ASKCBFORMATNAME
:
if
(
!
get_buffer_space
(
buffer
,
(
*
wparam
*
sizeof
(
WCHAR
)),
size
))
return
FALSE
;
break
;
case
WM_WININICHANGE
:
if
(
!*
lparam
)
return
TRUE
;
/* fall through */
case
WM_SETTEXT
:
case
WM_DEVMODECHANGE
:
case
CB_DIR
:
case
LB_DIR
:
case
LB_ADDFILE
:
case
EM_REPLACESEL
:
break
;
case
WM_WINE_SETWINDOWPOS
:
{
WINDOWPOS
wp
;
...
...
@@ -1172,7 +1182,7 @@ static size_t copy_string( void *ptr, const void *str, BOOL ansi )
*
* Calculate size of packed message buffer.
*/
size_t
user_message_size
(
UINT
message
,
WPARAM
wparam
,
LPARAM
lparam
,
BOOL
ansi
)
size_t
user_message_size
(
UINT
message
,
WPARAM
wparam
,
LPARAM
lparam
,
BOOL
other_process
,
BOOL
ansi
)
{
const
void
*
lparam_ptr
=
(
const
void
*
)
lparam
;
size_t
size
=
0
;
...
...
@@ -1195,6 +1205,15 @@ size_t user_message_size( UINT message, WPARAM wparam, LPARAM lparam, BOOL ansi
case
WM_ASKCBFORMATNAME
:
size
=
wparam
*
char_size
(
ansi
);
break
;
case
WM_WININICHANGE
:
case
WM_SETTEXT
:
case
WM_DEVMODECHANGE
:
case
CB_DIR
:
case
LB_DIR
:
case
LB_ADDFILE
:
case
EM_REPLACESEL
:
if
(
other_process
&&
lparam
)
size
=
string_size
(
lparam_ptr
,
ansi
);
break
;
}
return
size
;
...
...
@@ -1590,7 +1609,7 @@ static LRESULT call_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpar
if
(
!
needs_unpack
)
size
=
0
;
if
(
!
is_current_thread_window
(
hwnd
))
return
0
;
packed_size
=
user_message_size
(
msg
,
wparam
,
lparam
,
ansi
);
packed_size
=
user_message_size
(
msg
,
wparam
,
lparam
,
needs_unpack
,
ansi
);
if
(
packed_size
)
size
=
packed_size
;
/* first the WH_CALLWNDPROC hook */
...
...
dlls/win32u/tests/win32u.c
View file @
4777bd62
...
...
@@ -1362,6 +1362,7 @@ struct lparam_hook_test
const
void
*
change_lparam
;
const
void
*
check_lparam
;
size_t
lparam_size
;
size_t
lparam_init_size
;
size_t
check_size
;
BOOL
poison_lparam
;
BOOL
todo
;
...
...
@@ -1582,7 +1583,9 @@ static void init_hook_test( const struct lparam_hook_test *test )
if
(
test
->
lparam_size
)
{
if
(
test
->
lparam
)
if
(
test
->
lparam_init_size
)
memcpy
(
lparam_buffer
,
test
->
lparam
,
test
->
lparam_init_size
);
else
if
(
test
->
lparam
)
memcpy
(
lparam_buffer
,
test
->
lparam
,
test
->
lparam_size
);
else
memset
(
lparam_buffer
,
0xcc
,
test
->
lparam_size
);
...
...
@@ -1689,8 +1692,16 @@ static void test_wndproc_hook(void)
.
lparam_size
=
sizeof
(
BOOL
),
.
change_lparam
=
&
false_lparam
,
.
todo
=
TRUE
},
/* messages that don't change lparam */
{
"WM_USER"
,
WM_USER
},
{
"WM_NOTIFY"
,
WM_NOTIFY
},
{
"WM_SETTEXT"
,
WM_SETTEXT
,
.
lparam
=
strbufW
,
.
lparam_init_size
=
sizeof
(
strbufW
)
},
{
"WM_DEVMODECHANGE"
,
WM_DEVMODECHANGE
,
.
lparam
=
strbufW
,
.
lparam_init_size
=
sizeof
(
strbufW
)
},
{
"CB_DIR"
,
CB_DIR
,
.
lparam
=
strbufW
,
.
lparam_init_size
=
sizeof
(
strbufW
)
},
{
"LB_DIR"
,
LB_DIR
,
.
lparam
=
strbufW
,
.
lparam_init_size
=
sizeof
(
strbufW
)
},
{
"LB_ADDFILE"
,
LB_ADDFILE
,
.
lparam
=
strbufW
,
.
lparam_init_size
=
sizeof
(
strbufW
)
},
{
"EM_REPLACESEL"
,
EM_REPLACESEL
,
.
lparam
=
strbufW
,
.
lparam_init_size
=
sizeof
(
strbufW
)
},
{
"WM_WININICHANGE"
,
WM_WININICHANGE
,
.
lparam
=
strbufW
,
.
lparam_init_size
=
sizeof
(
strbufW
)
},
};
cls
.
lpfnWndProc
=
lparam_test_proc
;
...
...
dlls/win32u/win32u_private.h
View file @
4777bd62
...
...
@@ -140,7 +140,8 @@ extern LRESULT send_message( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
extern
BOOL
send_notify_message
(
HWND
hwnd
,
UINT
msg
,
WPARAM
wparam
,
LPARAM
lparam
,
BOOL
ansi
)
DECLSPEC_HIDDEN
;
extern
LRESULT
send_message_timeout
(
HWND
hwnd
,
UINT
msg
,
WPARAM
wparam
,
LPARAM
lparam
,
UINT
flags
,
UINT
timeout
,
BOOL
ansi
)
DECLSPEC_HIDDEN
;
extern
size_t
user_message_size
(
UINT
message
,
WPARAM
wparam
,
LPARAM
lparam
,
BOOL
ansi
)
DECLSPEC_HIDDEN
;
extern
size_t
user_message_size
(
UINT
message
,
WPARAM
wparam
,
LPARAM
lparam
,
BOOL
other_process
,
BOOL
ansi
)
DECLSPEC_HIDDEN
;
extern
void
pack_user_message
(
void
*
buffer
,
size_t
size
,
UINT
message
,
WPARAM
wparam
,
LPARAM
lparam
,
BOOL
ansi
)
DECLSPEC_HIDDEN
;
...
...
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