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
718fb9de
Commit
718fb9de
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 HMETAFILEPICT marshal data.
Signed-off-by:
Huw Davies
<
huw@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
7c166d67
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
15 deletions
+21
-15
usrmarshal.c
dlls/ole32/tests/usrmarshal.c
+14
-12
usrmarshal.c
dlls/ole32/usrmarshal.c
+7
-3
No files found.
dlls/ole32/tests/usrmarshal.c
View file @
718fb9de
...
...
@@ -502,12 +502,12 @@ static void test_marshal_HMETAFILEPICT(void)
GlobalUnlock
(
hmfp
);
init_user_marshal_cb
(
&
umcb
,
&
stub_msg
,
&
rpc_msg
,
NULL
,
0
,
MSHCTX_DIFFERENTMACHINE
);
size
=
HMETAFILEPICT_UserSize
(
&
umcb
.
Flags
,
0
,
&
hmfp
);
ok
(
size
>
2
0
,
"size should be at least 20
bytes, not %d
\n
"
,
size
);
size
=
HMETAFILEPICT_UserSize
(
&
umcb
.
Flags
,
1
,
&
hmfp
);
ok
(
size
>
2
4
,
"size should be at least 24
bytes, not %d
\n
"
,
size
);
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
init_user_marshal_cb
(
&
umcb
,
&
stub_msg
,
&
rpc_msg
,
buffer
,
size
,
MSHCTX_DIFFERENTMACHINE
);
buffer_end
=
HMETAFILEPICT_UserMarshal
(
&
umcb
.
Flags
,
buffer
,
&
hmfp
);
wirehmfp
=
buffer
;
buffer_end
=
HMETAFILEPICT_UserMarshal
(
&
umcb
.
Flags
,
buffer
+
1
,
&
hmfp
);
wirehmfp
=
buffer
+
4
;
ok
(
*
(
DWORD
*
)
wirehmfp
==
WDT_REMOTE_CALL
,
"wirestgm + 0x0 should be WDT_REMOTE_CALL instead of 0x%08x
\n
"
,
*
(
DWORD
*
)
wirehmfp
);
wirehmfp
+=
sizeof
(
DWORD
);
ok
(
*
(
DWORD
*
)
wirehmfp
==
(
DWORD
)(
DWORD_PTR
)
hmfp
,
"wirestgm + 0x4 should be hmf instead of 0x%08x
\n
"
,
*
(
DWORD
*
)
wirehmfp
);
...
...
@@ -528,16 +528,16 @@ static void test_marshal_HMETAFILEPICT(void)
wirehmfp
+=
sizeof
(
DWORD
);
/* Note use (buffer_end - buffer) instead of size here, because size is an
* overestimate with native */
ok
(
*
(
DWORD
*
)
wirehmfp
==
(
buffer_end
-
buffer
-
0x2
8
),
"wirestgm + 0x20 should be size - 0x34 instead of 0x%08x
\n
"
,
*
(
DWORD
*
)
wirehmfp
);
ok
(
*
(
DWORD
*
)
wirehmfp
==
(
buffer_end
-
buffer
-
0x2
c
),
"wirestgm + 0x20 should be size - 0x34 instead of 0x%08x
\n
"
,
*
(
DWORD
*
)
wirehmfp
);
wirehmfp
+=
sizeof
(
DWORD
);
ok
(
*
(
DWORD
*
)
wirehmfp
==
(
buffer_end
-
buffer
-
0x2
8
),
"wirestgm + 0x24 should be size - 0x34 instead of 0x%08x
\n
"
,
*
(
DWORD
*
)
wirehmfp
);
ok
(
*
(
DWORD
*
)
wirehmfp
==
(
buffer_end
-
buffer
-
0x2
c
),
"wirestgm + 0x24 should be size - 0x34 instead of 0x%08x
\n
"
,
*
(
DWORD
*
)
wirehmfp
);
wirehmfp
+=
sizeof
(
DWORD
);
ok
(
*
(
WORD
*
)
wirehmfp
==
1
,
"wirehmfp + 0x28 should be 1 instead of 0x%08x
\n
"
,
*
(
DWORD
*
)
wirehmfp
);
/* ... rest of data not tested - refer to tests for GetMetaFileBits
* at this point */
init_user_marshal_cb
(
&
umcb
,
&
stub_msg
,
&
rpc_msg
,
buffer
,
size
,
MSHCTX_DIFFERENTMACHINE
);
HMETAFILEPICT_UserUnmarshal
(
&
umcb
.
Flags
,
buffer
,
&
hmfp2
);
HMETAFILEPICT_UserUnmarshal
(
&
umcb
.
Flags
,
buffer
+
1
,
&
hmfp2
);
ok
(
hmfp2
!=
NULL
,
"HMETAFILEPICT didn't unmarshal
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
init_user_marshal_cb
(
&
umcb
,
&
stub_msg
,
&
rpc_msg
,
NULL
,
0
,
MSHCTX_DIFFERENTMACHINE
);
...
...
@@ -551,12 +551,13 @@ static void test_marshal_HMETAFILEPICT(void)
hmfp
=
NULL
;
init_user_marshal_cb
(
&
umcb
,
&
stub_msg
,
&
rpc_msg
,
NULL
,
0
,
MSHCTX_DIFFERENTMACHINE
);
size
=
HMETAFILEPICT_UserSize
(
&
umcb
.
Flags
,
0
,
&
hmfp
);
ok
(
size
==
8
,
"size should be 8
bytes, not %d
\n
"
,
size
);
size
=
HMETAFILEPICT_UserSize
(
&
umcb
.
Flags
,
1
,
&
hmfp
);
ok
(
size
==
12
,
"size should be 12
bytes, not %d
\n
"
,
size
);
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
init_user_marshal_cb
(
&
umcb
,
&
stub_msg
,
&
rpc_msg
,
buffer
,
size
,
MSHCTX_DIFFERENTMACHINE
);
HMETAFILEPICT_UserMarshal
(
&
umcb
.
Flags
,
buffer
,
&
hmfp
);
wirehmfp
=
buffer
;
buffer_end
=
HMETAFILEPICT_UserMarshal
(
&
umcb
.
Flags
,
buffer
+
1
,
&
hmfp
);
ok
(
buffer_end
==
buffer
+
size
,
"got %p buffer %p
\n
"
,
buffer_end
,
buffer
);
wirehmfp
=
buffer
+
4
;
ok
(
*
(
DWORD
*
)
wirehmfp
==
WDT_REMOTE_CALL
,
"wirestgm + 0x0 should be WDT_REMOTE_CALL instead of 0x%08x
\n
"
,
*
(
DWORD
*
)
wirehmfp
);
wirehmfp
+=
sizeof
(
DWORD
);
ok
(
*
(
DWORD
*
)
wirehmfp
==
(
DWORD
)(
DWORD_PTR
)
hmfp
,
"wirestgm + 0x4 should be hmf instead of 0x%08x
\n
"
,
*
(
DWORD
*
)
wirehmfp
);
...
...
@@ -564,7 +565,8 @@ static void test_marshal_HMETAFILEPICT(void)
hmfp2
=
NULL
;
init_user_marshal_cb
(
&
umcb
,
&
stub_msg
,
&
rpc_msg
,
buffer
,
size
,
MSHCTX_DIFFERENTMACHINE
);
HMETAFILEPICT_UserUnmarshal
(
&
umcb
.
Flags
,
buffer
,
&
hmfp2
);
buffer_end
=
HMETAFILEPICT_UserUnmarshal
(
&
umcb
.
Flags
,
buffer
+
1
,
&
hmfp2
);
ok
(
buffer_end
==
buffer
+
size
,
"got %p buffer %p
\n
"
,
buffer_end
,
buffer
);
ok
(
hmfp2
==
NULL
,
"NULL HMETAFILE didn't unmarshal
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
init_user_marshal_cb
(
&
umcb
,
&
stub_msg
,
&
rpc_msg
,
NULL
,
0
,
MSHCTX_DIFFERENTMACHINE
);
...
...
dlls/ole32/usrmarshal.c
View file @
718fb9de
...
...
@@ -1291,11 +1291,11 @@ void __RPC_USER HENHMETAFILE_UserFree(ULONG *pFlags, HENHMETAFILE *phEmf)
* the first parameter is a ULONG.
* This function is only intended to be called by the RPC runtime.
*/
ULONG
__RPC_USER
HMETAFILEPICT_UserSize
(
ULONG
*
pFlags
,
ULONG
StartingS
ize
,
HMETAFILEPICT
*
phMfp
)
ULONG
__RPC_USER
HMETAFILEPICT_UserSize
(
ULONG
*
pFlags
,
ULONG
s
ize
,
HMETAFILEPICT
*
phMfp
)
{
ULONG
size
=
StartingSize
;
TRACE
(
"(%s, %d, &%p)
\n
"
,
debugstr_user_flags
(
pFlags
),
size
,
*
phMfp
)
;
TRACE
(
"(%s, %d, &%p)
\n
"
,
debugstr_user_flags
(
pFlags
),
StartingSize
,
*
phMfp
);
ALIGN_LENGTH
(
size
,
3
);
size
+=
sizeof
(
ULONG
);
...
...
@@ -1345,6 +1345,8 @@ unsigned char * __RPC_USER HMETAFILEPICT_UserMarshal(ULONG *pFlags, unsigned cha
{
TRACE
(
"(%s, %p, &%p)
\n
"
,
debugstr_user_flags
(
pFlags
),
pBuffer
,
*
phMfp
);
ALIGN_POINTER
(
pBuffer
,
3
);
if
(
LOWORD
(
*
pFlags
)
==
MSHCTX_INPROC
)
{
if
(
sizeof
(
HMETAFILEPICT
)
==
8
)
...
...
@@ -1408,6 +1410,8 @@ unsigned char * __RPC_USER HMETAFILEPICT_UserUnmarshal(ULONG *pFlags, unsigned c
TRACE
(
"(%s, %p, %p)
\n
"
,
debugstr_user_flags
(
pFlags
),
pBuffer
,
phMfp
);
ALIGN_POINTER
(
pBuffer
,
3
);
fContext
=
*
(
ULONG
*
)
pBuffer
;
pBuffer
+=
sizeof
(
ULONG
);
...
...
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