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
8c6b8bf4
Commit
8c6b8bf4
authored
Dec 08, 2017
by
Huw Davies
Committed by
Alexandre Julliard
Dec 08, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32: Properly align CLIPFORMAT marshal data.
Signed-off-by:
Huw Davies
<
huw@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
d9c9791b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
15 deletions
+20
-15
usrmarshal.c
dlls/ole32/tests/usrmarshal.c
+13
-12
usrmarshal.c
dlls/ole32/usrmarshal.c
+7
-3
No files found.
dlls/ole32/tests/usrmarshal.c
View file @
8c6b8bf4
...
@@ -187,31 +187,32 @@ static void test_marshal_CLIPFORMAT(void)
...
@@ -187,31 +187,32 @@ static void test_marshal_CLIPFORMAT(void)
USER_MARSHAL_CB
umcb
;
USER_MARSHAL_CB
umcb
;
MIDL_STUB_MESSAGE
stub_msg
;
MIDL_STUB_MESSAGE
stub_msg
;
RPC_MESSAGE
rpc_msg
;
RPC_MESSAGE
rpc_msg
;
unsigned
char
*
buffer
;
unsigned
char
*
buffer
,
*
buffer_end
;
ULONG
i
,
size
;
ULONG
i
,
size
;
CLIPFORMAT
cf
=
RegisterClipboardFormatA
(
"MyFormat"
);
CLIPFORMAT
cf
=
RegisterClipboardFormatA
(
"MyFormat"
);
CLIPFORMAT
cf2
;
CLIPFORMAT
cf2
;
init_user_marshal_cb
(
&
umcb
,
&
stub_msg
,
&
rpc_msg
,
NULL
,
0
,
MSHCTX_DIFFERENTMACHINE
);
init_user_marshal_cb
(
&
umcb
,
&
stub_msg
,
&
rpc_msg
,
NULL
,
0
,
MSHCTX_DIFFERENTMACHINE
);
size
=
CLIPFORMAT_UserSize
(
&
umcb
.
Flags
,
0
,
&
cf
);
size
=
CLIPFORMAT_UserSize
(
&
umcb
.
Flags
,
1
,
&
cf
);
ok
(
size
==
8
+
sizeof
(
cf_marshaled
)
||
ok
(
size
==
12
+
sizeof
(
cf_marshaled
)
||
broken
(
size
==
12
+
sizeof
(
cf_marshaled
))
||
/* win64 adds 4 extra (unused) bytes */
broken
(
size
==
16
+
sizeof
(
cf_marshaled
)),
/* win64 adds 4 extra (unused) bytes */
broken
(
size
==
8
+
sizeof
(
cf_marshaled
)
-
2
),
/* win9x and winnt don't include the '\0' */
"CLIPFORMAT: Wrong size %d
\n
"
,
size
);
"CLIPFORMAT: Wrong size %d
\n
"
,
size
);
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
memset
(
buffer
,
0xcc
,
size
);
memset
(
buffer
,
0xcc
,
size
);
init_user_marshal_cb
(
&
umcb
,
&
stub_msg
,
&
rpc_msg
,
buffer
,
size
,
MSHCTX_DIFFERENTMACHINE
);
init_user_marshal_cb
(
&
umcb
,
&
stub_msg
,
&
rpc_msg
,
buffer
,
size
,
MSHCTX_DIFFERENTMACHINE
);
CLIPFORMAT_UserMarshal
(
&
umcb
.
Flags
,
buffer
,
&
cf
);
buffer_end
=
CLIPFORMAT_UserMarshal
(
&
umcb
.
Flags
,
buffer
+
1
,
&
cf
);
ok
(
*
(
LONG
*
)(
buffer
+
0
)
==
WDT_REMOTE_CALL
,
"CLIPFORMAT: Context should be WDT_REMOTE_CALL instead of 0x%08x
\n
"
,
*
(
LONG
*
)(
buffer
+
0
));
ok
(
buffer_end
==
buffer
+
12
+
sizeof
(
cf_marshaled
),
"got %p buffer %p
\n
"
,
buffer_end
,
buffer
);
ok
(
*
(
DWORD
*
)(
buffer
+
4
)
==
cf
,
"CLIPFORMAT: Marshaled value should be 0x%04x instead of 0x%04x
\n
"
,
cf
,
*
(
DWORD
*
)(
buffer
+
4
));
ok
(
*
(
LONG
*
)(
buffer
+
4
)
==
WDT_REMOTE_CALL
,
"CLIPFORMAT: Context should be WDT_REMOTE_CALL instead of 0x%08x
\n
"
,
*
(
LONG
*
)(
buffer
+
0
));
ok
(
!
memcmp
(
buffer
+
8
,
cf_marshaled
,
min
(
sizeof
(
cf_marshaled
),
size
-
8
)),
"Marshaled data differs
\n
"
);
ok
(
*
(
DWORD
*
)(
buffer
+
8
)
==
cf
,
"CLIPFORMAT: Marshaled value should be 0x%04x instead of 0x%04x
\n
"
,
cf
,
*
(
DWORD
*
)(
buffer
+
4
));
if
(
size
>
sizeof
(
cf_marshaled
)
+
8
)
/* make sure the extra bytes are not used */
ok
(
!
memcmp
(
buffer
+
12
,
cf_marshaled
,
min
(
sizeof
(
cf_marshaled
),
size
-
12
)),
"Marshaled data differs
\n
"
);
for
(
i
=
sizeof
(
cf_marshaled
)
+
8
;
i
<
size
;
i
++
)
if
(
size
>
sizeof
(
cf_marshaled
)
+
12
)
/* make sure the extra bytes are not used */
for
(
i
=
sizeof
(
cf_marshaled
)
+
12
;
i
<
size
;
i
++
)
ok
(
buffer
[
i
]
==
0xcc
,
"buffer offset %u has been set to %x
\n
"
,
i
,
buffer
[
i
]
);
ok
(
buffer
[
i
]
==
0xcc
,
"buffer offset %u has been set to %x
\n
"
,
i
,
buffer
[
i
]
);
init_user_marshal_cb
(
&
umcb
,
&
stub_msg
,
&
rpc_msg
,
buffer
,
size
,
MSHCTX_DIFFERENTMACHINE
);
init_user_marshal_cb
(
&
umcb
,
&
stub_msg
,
&
rpc_msg
,
buffer
,
size
,
MSHCTX_DIFFERENTMACHINE
);
CLIPFORMAT_UserUnmarshal
(
&
umcb
.
Flags
,
buffer
,
&
cf2
);
buffer_end
=
CLIPFORMAT_UserUnmarshal
(
&
umcb
.
Flags
,
buffer
+
1
,
&
cf2
);
ok
(
buffer_end
==
buffer
+
12
+
sizeof
(
cf_marshaled
),
"got %p buffer %p
\n
"
,
buffer_end
,
buffer
);
ok
(
cf
==
cf2
,
"CLIPFORMAT: Didn't unmarshal properly
\n
"
);
ok
(
cf
==
cf2
,
"CLIPFORMAT: Didn't unmarshal properly
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
...
...
dlls/ole32/usrmarshal.c
View file @
8c6b8bf4
...
@@ -98,11 +98,11 @@ static const char* debugstr_user_flags(ULONG *pFlags)
...
@@ -98,11 +98,11 @@ static const char* debugstr_user_flags(ULONG *pFlags)
* the first parameter is an unsigned long.
* the first parameter is an unsigned long.
* This function is only intended to be called by the RPC runtime.
* This function is only intended to be called by the RPC runtime.
*/
*/
ULONG
__RPC_USER
CLIPFORMAT_UserSize
(
ULONG
*
pFlags
,
ULONG
StartingS
ize
,
CLIPFORMAT
*
pCF
)
ULONG
__RPC_USER
CLIPFORMAT_UserSize
(
ULONG
*
pFlags
,
ULONG
s
ize
,
CLIPFORMAT
*
pCF
)
{
{
ULONG
size
=
StartingSize
;
TRACE
(
"(%s, %d, %p
\n
"
,
debugstr_user_flags
(
pFlags
),
size
,
pCF
)
;
TRACE
(
"(%s, %d, %p
\n
"
,
debugstr_user_flags
(
pFlags
),
StartingSize
,
pCF
);
ALIGN_LENGTH
(
size
,
3
);
size
+=
8
;
size
+=
8
;
...
@@ -147,6 +147,8 @@ unsigned char * __RPC_USER CLIPFORMAT_UserMarshal(ULONG *pFlags, unsigned char *
...
@@ -147,6 +147,8 @@ unsigned char * __RPC_USER CLIPFORMAT_UserMarshal(ULONG *pFlags, unsigned char *
{
{
TRACE
(
"(%s, %p, &0x%04x
\n
"
,
debugstr_user_flags
(
pFlags
),
pBuffer
,
*
pCF
);
TRACE
(
"(%s, %p, &0x%04x
\n
"
,
debugstr_user_flags
(
pFlags
),
pBuffer
,
*
pCF
);
ALIGN_POINTER
(
pBuffer
,
3
);
/* only need to marshal the name if it is not a pre-defined type and
/* only need to marshal the name if it is not a pre-defined type and
* we are going remote */
* we are going remote */
if
((
*
pCF
>=
0xc000
)
&&
(
LOWORD
(
*
pFlags
)
==
MSHCTX_DIFFERENTMACHINE
))
if
((
*
pCF
>=
0xc000
)
&&
(
LOWORD
(
*
pFlags
)
==
MSHCTX_DIFFERENTMACHINE
))
...
@@ -209,6 +211,8 @@ unsigned char * __RPC_USER CLIPFORMAT_UserUnmarshal(ULONG *pFlags, unsigned char
...
@@ -209,6 +211,8 @@ unsigned char * __RPC_USER CLIPFORMAT_UserUnmarshal(ULONG *pFlags, unsigned char
TRACE
(
"(%s, %p, %p
\n
"
,
debugstr_user_flags
(
pFlags
),
pBuffer
,
pCF
);
TRACE
(
"(%s, %p, %p
\n
"
,
debugstr_user_flags
(
pFlags
),
pBuffer
,
pCF
);
ALIGN_POINTER
(
pBuffer
,
3
);
fContext
=
*
(
DWORD
*
)
pBuffer
;
fContext
=
*
(
DWORD
*
)
pBuffer
;
pBuffer
+=
4
;
pBuffer
+=
4
;
...
...
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