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
522a00e6
Commit
522a00e6
authored
Feb 25, 2010
by
Huw Davies
Committed by
Alexandre Julliard
Feb 25, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oleaut32: Correctly marshal NULL interface ptrs.
parent
10990f58
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
14 deletions
+51
-14
usrmarshal.c
dlls/oleaut32/tests/usrmarshal.c
+24
-0
usrmarshal.c
dlls/oleaut32/usrmarshal.c
+27
-14
No files found.
dlls/oleaut32/tests/usrmarshal.c
View file @
522a00e6
...
...
@@ -1427,6 +1427,30 @@ static void test_marshal_VARIANT(void)
}
HeapFree
(
GetProcessHeap
(),
0
,
oldbuffer
);
/*** NULL UNKNOWN ***/
VariantInit
(
&
v
);
V_VT
(
&
v
)
=
VT_UNKNOWN
;
V_UNKNOWN
(
&
v
)
=
NULL
;
rpcMsg
.
BufferLength
=
stubMsg
.
BufferLength
=
VARIANT_UserSize
(
&
umcb
.
Flags
,
0
,
&
v
);
ok
(
stubMsg
.
BufferLength
>=
24
,
"size %d
\n
"
,
stubMsg
.
BufferLength
);
buffer
=
rpcMsg
.
Buffer
=
stubMsg
.
Buffer
=
stubMsg
.
BufferStart
=
alloc_aligned
(
stubMsg
.
BufferLength
,
&
oldbuffer
);
stubMsg
.
BufferEnd
=
stubMsg
.
Buffer
+
stubMsg
.
BufferLength
;
memset
(
buffer
,
0xcc
,
stubMsg
.
BufferLength
);
next
=
VARIANT_UserMarshal
(
&
umcb
.
Flags
,
buffer
,
&
v
);
wirev
=
(
DWORD
*
)
buffer
;
check_variant_header
(
wirev
,
&
v
,
next
-
buffer
);
wirev
+=
5
;
ok
(
*
wirev
==
0
,
"wv[5] %08x
\n
"
,
*
wirev
);
VariantInit
(
&
v2
);
stubMsg
.
Buffer
=
buffer
;
next
=
VARIANT_UserUnmarshal
(
&
umcb
.
Flags
,
buffer
,
&
v2
);
ok
(
V_VT
(
&
v
)
==
V_VT
(
&
v2
),
"got vt %d expect %d
\n
"
,
V_VT
(
&
v
),
V_VT
(
&
v2
));
ok
(
V_UNKNOWN
(
&
v2
)
==
NULL
,
"got %p expect NULL
\n
"
,
V_UNKNOWN
(
&
v2
));
VARIANT_UserFree
(
&
umcb
.
Flags
,
&
v2
);
HeapFree
(
GetProcessHeap
(),
0
,
oldbuffer
);
/*** UNKNOWN BYREF ***/
heap_unknown
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
heap_unknown
));
heap_unknown
->
lpVtbl
=
&
HeapUnknown_Vtbl
;
...
...
dlls/oleaut32/usrmarshal.c
View file @
522a00e6
...
...
@@ -256,20 +256,21 @@ static unsigned int get_type_alignment(ULONG *pFlags, VARTYPE vt)
static
unsigned
interface_variant_size
(
const
ULONG
*
pFlags
,
REFIID
riid
,
IUnknown
*
punk
)
{
ULONG
size
;
HRESULT
hr
;
/* find the buffer size of the marshalled dispatch interface */
hr
=
CoGetMarshalSizeMax
(
&
size
,
riid
,
punk
,
LOWORD
(
*
pFlags
),
NULL
,
MSHLFLAGS_NORMAL
);
if
(
FAILED
(
hr
))
{
if
(
!
punk
)
WARN
(
"NULL dispatch pointer
\n
"
);
else
ERR
(
"Dispatch variant buffer size calculation failed, HRESULT=0x%x
\n
"
,
hr
);
return
0
;
}
size
+=
sizeof
(
ULONG
);
/* we have to store the buffersize in the stream */
TRACE
(
"wire-size extra of dispatch variant is %d
\n
"
,
size
);
return
size
;
ULONG
size
=
0
;
HRESULT
hr
;
if
(
punk
)
{
hr
=
CoGetMarshalSizeMax
(
&
size
,
riid
,
punk
,
LOWORD
(
*
pFlags
),
NULL
,
MSHLFLAGS_NORMAL
);
if
(
FAILED
(
hr
))
{
ERR
(
"interface variant buffer size calculation failed, HRESULT=0x%x
\n
"
,
hr
);
return
0
;
}
}
size
+=
sizeof
(
ULONG
);
/* we have to store the buffersize in the stream */
TRACE
(
"wire-size extra of interface variant is %d
\n
"
,
size
);
return
size
;
}
static
ULONG
wire_extra_user_size
(
ULONG
*
pFlags
,
ULONG
Start
,
VARIANT
*
pvar
)
...
...
@@ -322,6 +323,12 @@ static unsigned char* interface_variant_marshal(const ULONG *pFlags, unsigned ch
TRACE
(
"pFlags=%d, Buffer=%p, pUnk=%p
\n
"
,
*
pFlags
,
Buffer
,
punk
);
if
(
!
punk
)
{
memset
(
Buffer
,
0
,
sizeof
(
ULONG
));
return
Buffer
+
sizeof
(
ULONG
);
}
oldpos
=
Buffer
;
/* CoMarshalInterface needs a stream, whereas at this level we are operating in terms of buffers.
...
...
@@ -378,6 +385,12 @@ static unsigned char *interface_variant_unmarshal(const ULONG *pFlags, unsigned
memcpy
(
&
size
,
Buffer
,
sizeof
(
ULONG
));
TRACE
(
"buffersize=%d
\n
"
,
size
);
if
(
!
size
)
{
*
ppunk
=
NULL
;
return
Buffer
+
sizeof
(
ULONG
);
}
working_mem
=
GlobalAlloc
(
0
,
size
);
if
(
!
working_mem
)
return
oldpos
;
...
...
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