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
3a2574e3
Commit
3a2574e3
authored
Aug 25, 2004
by
Jacek Caban
Committed by
Alexandre Julliard
Aug 25, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix handling of VARIANT with VT_BYREF and null pointer in
VariantChangeTypeEx.
parent
5f6e3c88
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
2 deletions
+37
-2
vartype.c
dlls/oleaut32/tests/vartype.c
+30
-0
variant.c
dlls/oleaut32/variant.c
+7
-2
No files found.
dlls/oleaut32/tests/vartype.c
View file @
3a2574e3
...
...
@@ -5249,7 +5249,35 @@ static void test_ClearCustData(void)
ok
(
!
ci
.
cCustData
&&
!
ci
.
prgCustData
,
"ClearCustData didn't clear fields!
\n
"
);
}
static
void
test_NullByRef
()
{
VARIANT
v1
,
v2
;
HRESULT
hRes
;
VariantClear
(
&
v1
);
VariantClear
(
&
v2
);
V_VT
(
&
v1
)
=
VT_BYREF
|
VT_VARIANT
;
V_BYREF
(
&
v1
)
=
0
;
hRes
=
VariantChangeTypeEx
(
&
v2
,
&
v1
,
0
,
0
,
VT_I4
);
ok
(
hRes
==
DISP_E_TYPEMISMATCH
,
"VariantChangeTypeEx should return DISP_E_TYPEMISMATCH
\n
"
);
VariantClear
(
&
v1
);
V_VT
(
&
v1
)
=
VT_BYREF
|
VT_VARIANT
;
V_BYREF
(
&
v1
)
=
0
;
V_VT
(
&
v2
)
=
VT_I4
;
V_I4
(
&
v2
)
=
123
;
hRes
=
VariantChangeTypeEx
(
&
v2
,
&
v1
,
0
,
0
,
VT_VARIANT
);
ok
(
hRes
==
DISP_E_TYPEMISMATCH
,
"VariantChangeTypeEx should return DISP_E_TYPEMISMATCH
\n
"
);
ok
(
V_VT
(
&
v2
)
==
VT_I4
&&
V_I4
(
&
v2
)
==
123
,
"VariantChangeTypeEx shouldn't change pvargDest
\n
"
);
hRes
=
VariantChangeTypeEx
(
&
v2
,
&
v1
,
0
,
0
,
VT_BYREF
|
VT_I4
);
ok
(
hRes
==
DISP_E_TYPEMISMATCH
,
"VariantChangeTypeEx should return DISP_E_TYPEMISMATCH
\n
"
);
hRes
=
VariantChangeTypeEx
(
&
v2
,
&
v1
,
0
,
0
,
0x3847
);
ok
(
hRes
==
DISP_E_BADVARTYPE
,
"VariantChangeTypeEx should return DISP_E_BADVARTYPE
\n
"
);
}
START_TEST
(
vartype
)
{
...
...
@@ -5539,4 +5567,6 @@ START_TEST(vartype)
test_UintChangeTypeEx
();
test_ClearCustData
();
test_NullByRef
();
}
dlls/oleaut32/variant.c
View file @
3a2574e3
...
...
@@ -984,8 +984,13 @@ HRESULT WINAPI VariantChangeTypeEx(VARIANTARG* pvargDest, VARIANTARG* pvargSrc,
{
VARIANTARG
vTmp
;
V_VT
(
&
vTmp
)
=
VT_EMPTY
;
res
=
VariantCopyInd
(
&
vTmp
,
pvargSrc
);
if
(
V_VT
(
pvargSrc
)
&
VT_BYREF
&&
!
V_BYREF
(
pvargSrc
))
res
=
DISP_E_TYPEMISMATCH
;
else
{
V_VT
(
&
vTmp
)
=
VT_EMPTY
;
res
=
VariantCopyInd
(
&
vTmp
,
pvargSrc
);
}
if
(
SUCCEEDED
(
res
))
{
...
...
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