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
69834a30
Commit
69834a30
authored
Jul 18, 2023
by
Jacek Caban
Committed by
Alexandre Julliard
Jul 31, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
win32u: Use user message packing for WM_COPYDATA.
parent
b8fa6de2
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
108 additions
and
20 deletions
+108
-20
winproc.c
dlls/user32/winproc.c
+7
-19
message.c
dlls/win32u/message.c
+33
-0
win32u.c
dlls/win32u/tests/win32u.c
+54
-1
user.c
dlls/wow64win/user.c
+14
-0
No files found.
dlls/user32/winproc.c
View file @
69834a30
...
...
@@ -831,6 +831,12 @@ BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lparam,
ncp
->
lppos
=
(
WINDOWPOS
*
)((
NCCALCSIZE_PARAMS
*
)
ncp
+
1
);
}
break
;
case
WM_COPYDATA
:
{
COPYDATASTRUCT
*
cds
=
*
buffer
;
if
(
cds
->
lpData
)
cds
->
lpData
=
cds
+
1
;
break
;
}
case
WM_GETTEXT
:
case
WM_ASKCBFORMATNAME
:
case
WM_WININICHANGE
:
...
...
@@ -848,25 +854,6 @@ BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lparam,
case
WM_WINDOWPOSCHANGING
:
case
WM_WINDOWPOSCHANGED
:
break
;
case
WM_COPYDATA
:
{
COPYDATASTRUCT
cds
;
if
(
size
<
sizeof
(
ps
->
cds
))
return
FALSE
;
cds
.
dwData
=
(
ULONG_PTR
)
unpack_ptr
(
ps
->
cds
.
dwData
);
if
(
ps
->
cds
.
lpData
)
{
cds
.
cbData
=
ps
->
cds
.
cbData
;
cds
.
lpData
=
&
ps
->
cds
+
1
;
minsize
=
sizeof
(
ps
->
cds
)
+
cds
.
cbData
;
}
else
{
cds
.
cbData
=
0
;
cds
.
lpData
=
0
;
}
memcpy
(
&
ps
->
cds
,
&
cds
,
sizeof
(
cds
)
);
break
;
}
case
WM_NOTIFY
:
/* WM_NOTIFY cannot be sent across processes (MSDN) */
return
FALSE
;
...
...
@@ -1126,6 +1113,7 @@ BOOL WINAPI User32CallWindowProc( struct win_proc_params *params, ULONG size )
case
WM_COMPAREITEM
:
case
WM_WINDOWPOSCHANGING
:
case
WM_WINDOWPOSCHANGED
:
case
WM_COPYDATA
:
{
LRESULT
*
result_ptr
=
(
LRESULT
*
)
buffer
-
1
;
*
result_ptr
=
result
;
...
...
dlls/win32u/message.c
View file @
69834a30
...
...
@@ -504,6 +504,25 @@ static BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lpa
memcpy
(
*
buffer
,
&
wp
,
sizeof
(
wp
)
);
break
;
}
case
WM_COPYDATA
:
{
COPYDATASTRUCT
cds
;
if
(
size
<
sizeof
(
ps
->
cds
))
return
FALSE
;
cds
.
dwData
=
(
ULONG_PTR
)
unpack_ptr
(
ps
->
cds
.
dwData
);
if
(
ps
->
cds
.
lpData
)
{
cds
.
cbData
=
ps
->
cds
.
cbData
;
cds
.
lpData
=
&
ps
->
cds
+
1
;
minsize
=
sizeof
(
ps
->
cds
)
+
cds
.
cbData
;
}
else
{
cds
.
cbData
=
0
;
cds
.
lpData
=
0
;
}
memcpy
(
&
ps
->
cds
,
&
cds
,
sizeof
(
cds
)
);
break
;
}
case
WM_WINE_SETWINDOWPOS
:
{
WINDOWPOS
wp
;
...
...
@@ -1307,6 +1326,12 @@ size_t user_message_size( UINT message, WPARAM wparam, LPARAM lparam, BOOL other
case
WM_WINDOWPOSCHANGED
:
size
=
sizeof
(
WINDOWPOS
);
break
;
case
WM_COPYDATA
:
{
const
COPYDATASTRUCT
*
cds
=
lparam_ptr
;
size
=
sizeof
(
*
cds
)
+
cds
->
cbData
;
break
;
}
}
return
size
;
...
...
@@ -1358,6 +1383,14 @@ void pack_user_message( void *buffer, size_t size, UINT message,
case
WM_ASKCBFORMATNAME
:
if
(
wparam
)
memset
(
buffer
,
0
,
char_size
(
ansi
));
return
;
case
WM_COPYDATA
:
{
const
COPYDATASTRUCT
*
cds
=
lparam_ptr
;
if
(
cds
->
lpData
&&
cds
->
cbData
)
memcpy
(
(
char
*
)
buffer
+
sizeof
(
*
cds
),
cds
->
lpData
,
cds
->
cbData
);
size
=
sizeof
(
*
cds
);
break
;
}
}
if
(
size
)
memcpy
(
buffer
,
lparam_ptr
,
size
);
...
...
dlls/win32u/tests/win32u.c
View file @
69834a30
...
...
@@ -1386,9 +1386,31 @@ static void check_params( const struct lparam_hook_test *test, UINT message,
ok
((
LPARAM
)
&
message
<
lparam
&&
lparam
<
(
LPARAM
)
NtCurrentTeb
()
->
Tib
.
StackBase
,
"lparam is not on the stack
\n
"
);
switch
(
test
->
message
)
{
case
WM_COPYDATA
:
{
const
COPYDATASTRUCT
*
cds
=
(
const
COPYDATASTRUCT
*
)
lparam
;
const
COPYDATASTRUCT
*
cds_in
=
(
const
COPYDATASTRUCT
*
)
lparam_buffer
;
ok
(
cds
->
dwData
==
cds_in
->
dwData
,
"cds->dwData != cds_in->dwData
\n
"
);
ok
(
cds
->
cbData
==
cds_in
->
cbData
,
"cds->dwData != cds_in->dwData
\n
"
);
if
(
cds_in
->
lpData
)
{
ok
(
cds
->
lpData
!=
cds_in
->
lpData
,
"cds->lpData == cds_in->lpData
\n
"
);
if
(
cds
->
cbData
)
ok
(
!
memcmp
(
cds
->
lpData
,
cds_in
->
lpData
,
cds
->
cbData
),
"unexpected pvData %s
\n
"
,
wine_dbgstr_an
(
cds
->
lpData
,
cds
->
cbData
));
}
else
ok
(
!
cds
->
lpData
,
"cds->lpData = %p
\n
"
,
cds
->
lpData
);
}
break
;
default:
if
(
test
->
check_size
)
{
const
void
*
expected
=
is_ret
&&
test
->
change_lparam
?
test
->
change_lparam
:
test
->
lparam
;
ok
(
!
memcmp
(
(
const
void
*
)
lparam
,
expected
,
test
->
check_size
),
"unexpected lparam content
\n
"
);
ok
(
!
memcmp
(
(
const
void
*
)
lparam
,
expected
,
test
->
check_size
),
"unexpected lparam content
\n
"
);
}
}
}
...
...
@@ -1628,6 +1650,12 @@ static void test_wndproc_hook(void)
static
const
COMPAREITEMSTRUCT
cis_in
=
{
.
itemID1
=
1
};
static
const
WINDOWPOS
winpos_in
=
{
.
x
=
1
,
.
cy
=
2
};
static
const
WINDOWPOS
winpos_out
=
{
.
x
=
10
,
.
cy
=
22
};
static
const
COPYDATASTRUCT
cds_in
=
{
.
dwData
=
1
};
static
WORD
data_word
=
3
;
static
const
COPYDATASTRUCT
cds2_in
=
{
.
cbData
=
2
,
.
lpData
=
&
data_word
};
static
const
COPYDATASTRUCT
cds3_in
=
{
.
dwData
=
2
,
.
lpData
=
(
void
*
)
0xdeadbeef
};
static
const
COPYDATASTRUCT
cds4_in
=
{
.
cbData
=
2
};
static
const
COPYDATASTRUCT
cds5_in
=
{
.
lpData
=
(
void
*
)
0xdeadbeef
};
static
const
struct
lparam_hook_test
lparam_hook_tests
[]
=
{
...
...
@@ -1742,6 +1770,31 @@ static void test_wndproc_hook(void)
.
lparam_size
=
sizeof
(
WINDOWPOS
),
.
lparam
=
&
winpos_in
,
.
poison_lparam
=
TRUE
,
.
check_size
=
sizeof
(
WINDOWPOS
),
},
{
"WM_COPYDATA"
,
WM_COPYDATA
,
.
wparam
=
0xdeadbeef
,
.
lparam_size
=
sizeof
(
cds_in
),
.
lparam
=
&
cds_in
,
.
poison_lparam
=
TRUE
,
.
check_size
=
sizeof
(
cds_in
),
},
{
"WM_COPYDATA-2"
,
WM_COPYDATA
,
.
wparam
=
0xdeadbeef
,
.
lparam_size
=
sizeof
(
cds2_in
),
.
lparam
=
&
cds2_in
,
.
poison_lparam
=
TRUE
,
.
check_size
=
sizeof
(
cds2_in
),
},
{
"WM_COPYDATA-3"
,
WM_COPYDATA
,
.
wparam
=
0xdeadbeef
,
.
lparam_size
=
sizeof
(
cds3_in
),
.
lparam
=
&
cds3_in
,
.
poison_lparam
=
TRUE
,
.
check_size
=
sizeof
(
cds3_in
),
},
{
"WM_COPYDATA-4"
,
WM_COPYDATA
,
.
wparam
=
0xdeadbeef
,
.
lparam_size
=
sizeof
(
cds4_in
),
.
lparam
=
&
cds4_in
,
.
poison_lparam
=
TRUE
,
.
check_size
=
sizeof
(
cds4_in
),
},
{
"WM_COPYDATA-5"
,
WM_COPYDATA
,
.
wparam
=
0xdeadbeef
,
.
lparam_size
=
sizeof
(
cds5_in
),
.
lparam
=
&
cds5_in
,
.
poison_lparam
=
TRUE
,
.
check_size
=
sizeof
(
cds5_in
),
},
/* messages that don't change lparam */
{
"WM_USER"
,
WM_USER
},
{
"WM_NOTIFY"
,
WM_NOTIFY
},
...
...
dlls/wow64win/user.c
View file @
69834a30
...
...
@@ -720,6 +720,20 @@ static size_t packed_message_64to32( UINT message, WPARAM wparam,
case
WM_WINDOWPOSCHANGED
:
winpos_64to32
(
params64
,
params32
);
return
sizeof
(
WINDOWPOS32
);
case
WM_COPYDATA
:
{
COPYDATASTRUCT32
cds32
;
const
COPYDATASTRUCT
*
cds64
=
params64
;
cds32
.
dwData
=
cds64
->
dwData
;
cds32
.
cbData
=
cds64
->
cbData
;
cds32
.
lpData
=
PtrToUlong
(
cds64
->
lpData
);
memcpy
(
params32
,
&
cds32
,
sizeof
(
cds32
)
);
size
-=
sizeof
(
cds32
);
if
(
size
)
memmove
(
(
char
*
)
params32
+
sizeof
(
cds32
),
cds64
+
1
,
size
);
return
sizeof
(
cds32
)
+
size
;
}
}
memmove
(
params32
,
params64
,
size
);
...
...
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