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
2898b5d9
Commit
2898b5d9
authored
May 05, 2006
by
Huw Davies
Committed by
Alexandre Julliard
May 07, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oleaut32: Remove weird attempt to clear VT_VARIANT.
Add some tests.
parent
696f73a7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
111 additions
and
5 deletions
+111
-5
vartest.c
dlls/oleaut32/tests/vartest.c
+111
-0
variant.c
dlls/oleaut32/variant.c
+0
-5
No files found.
dlls/oleaut32/tests/vartest.c
View file @
2898b5d9
...
...
@@ -273,11 +273,49 @@ static int IsValidVariantClearVT(VARTYPE vt, VARTYPE extraFlags)
return
ret
;
}
typedef
struct
{
const
IUnknownVtbl
*
lpVtbl
;
LONG
ref
;
LONG
events
;
}
test_VariantClearImpl
;
static
HRESULT
WINAPI
VC_QueryInterface
(
LPUNKNOWN
iface
,
REFIID
riid
,
LPVOID
*
ppobj
)
{
test_VariantClearImpl
*
This
=
(
test_VariantClearImpl
*
)
iface
;
This
->
events
|=
0x1
;
return
E_NOINTERFACE
;
}
static
ULONG
WINAPI
VC_AddRef
(
LPUNKNOWN
iface
)
{
test_VariantClearImpl
*
This
=
(
test_VariantClearImpl
*
)
iface
;
This
->
events
|=
0x2
;
return
InterlockedIncrement
(
&
This
->
ref
);
}
static
ULONG
WINAPI
VC_Release
(
LPUNKNOWN
iface
)
{
test_VariantClearImpl
*
This
=
(
test_VariantClearImpl
*
)
iface
;
/* static class, won't be freed */
This
->
events
|=
0x4
;
return
InterlockedDecrement
(
&
This
->
ref
);
}
static
const
IUnknownVtbl
test_VariantClear_vtbl
=
{
VC_QueryInterface
,
VC_AddRef
,
VC_Release
,
};
static
test_VariantClearImpl
test_myVariantClearImpl
=
{
&
test_VariantClear_vtbl
,
1
,
0
};
static
void
test_VariantClear
(
void
)
{
HRESULT
hres
;
VARIANTARG
v
;
VARIANT
v2
;
size_t
i
;
long
i4
;
IUnknown
*
punk
;
#if 0
/* Crashes: Native does not test input for NULL, so neither does Wine */
...
...
@@ -319,6 +357,79 @@ static void test_VariantClear(void)
hExpected
,
hres
,
vt
,
ExtraFlags
[
i
]);
}
}
/* Some BYREF tests with non-NULL ptrs */
/* VARIANT BYREF */
V_VT
(
&
v2
)
=
VT_I4
;
V_I4
(
&
v2
)
=
0x1234
;
V_VT
(
&
v
)
=
VT_VARIANT
|
VT_BYREF
;
V_VARIANTREF
(
&
v
)
=
&
v2
;
hres
=
VariantClear
(
&
v
);
ok
(
hres
==
S_OK
,
"ret %08lx
\n
"
,
hres
);
ok
(
V_VT
(
&
v
)
==
0
,
"vt %04x
\n
"
,
V_VT
(
&
v
));
ok
(
V_VARIANTREF
(
&
v
)
==
&
v2
,
"variant ref %p
\n
"
,
V_VARIANTREF
(
&
v2
));
ok
(
V_VT
(
&
v2
)
==
VT_I4
,
"vt %04x
\n
"
,
V_VT
(
&
v2
));
ok
(
V_I4
(
&
v2
)
==
0x1234
,
"i4 %04lx
\n
"
,
V_I4
(
&
v2
));
/* I4 BYREF */
i4
=
0x4321
;
V_VT
(
&
v
)
=
VT_I4
|
VT_BYREF
;
V_I4REF
(
&
v
)
=
&
i4
;
hres
=
VariantClear
(
&
v
);
ok
(
hres
==
S_OK
,
"ret %08lx
\n
"
,
hres
);
ok
(
V_VT
(
&
v
)
==
0
,
"vt %04x
\n
"
,
V_VT
(
&
v
));
ok
(
V_I4REF
(
&
v
)
==
&
i4
,
"i4 ref %p
\n
"
,
V_I4REF
(
&
v2
));
ok
(
i4
==
0x4321
,
"i4 changed %08lx
\n
"
,
i4
);
/* UNKNOWN */
V_VT
(
&
v
)
=
VT_UNKNOWN
;
V_UNKNOWN
(
&
v
)
=
(
IUnknown
*
)
&
test_myVariantClearImpl
;
test_myVariantClearImpl
.
events
=
0
;
hres
=
VariantClear
(
&
v
);
ok
(
hres
==
S_OK
,
"ret %08lx
\n
"
,
hres
);
ok
(
V_VT
(
&
v
)
==
0
,
"vt %04x
\n
"
,
V_VT
(
&
v
));
ok
(
V_UNKNOWN
(
&
v
)
==
(
IUnknown
*
)
&
test_myVariantClearImpl
,
"unknown %p
\n
"
,
V_UNKNOWN
(
&
v
));
/* Check that Release got called, but nothing else */
ok
(
test_myVariantClearImpl
.
events
==
0x4
,
"Unexpected call. events %08lx
\n
"
,
test_myVariantClearImpl
.
events
);
/* UNKNOWN BYREF */
punk
=
(
IUnknown
*
)
&
test_myVariantClearImpl
;
V_VT
(
&
v
)
=
VT_UNKNOWN
|
VT_BYREF
;
V_UNKNOWNREF
(
&
v
)
=
&
punk
;
test_myVariantClearImpl
.
events
=
0
;
hres
=
VariantClear
(
&
v
);
ok
(
hres
==
S_OK
,
"ret %08lx
\n
"
,
hres
);
ok
(
V_VT
(
&
v
)
==
0
,
"vt %04x
\n
"
,
V_VT
(
&
v
));
ok
(
V_UNKNOWNREF
(
&
v
)
==
&
punk
,
"unknown ref %p
\n
"
,
V_UNKNOWNREF
(
&
v
));
/* Check that nothing got called */
ok
(
test_myVariantClearImpl
.
events
==
0
,
"Unexpected call. events %08lx
\n
"
,
test_myVariantClearImpl
.
events
);
/* DISPATCH */
V_VT
(
&
v
)
=
VT_DISPATCH
;
V_DISPATCH
(
&
v
)
=
(
IDispatch
*
)
&
test_myVariantClearImpl
;
test_myVariantClearImpl
.
events
=
0
;
hres
=
VariantClear
(
&
v
);
ok
(
hres
==
S_OK
,
"ret %08lx
\n
"
,
hres
);
ok
(
V_VT
(
&
v
)
==
0
,
"vt %04x
\n
"
,
V_VT
(
&
v
));
ok
(
V_DISPATCH
(
&
v
)
==
(
IDispatch
*
)
&
test_myVariantClearImpl
,
"dispatch %p
\n
"
,
V_DISPATCH
(
&
v
));
/* Check that Release got called, but nothing else */
ok
(
test_myVariantClearImpl
.
events
==
0x4
,
"Unexpected call. events %08lx
\n
"
,
test_myVariantClearImpl
.
events
);
/* DISPATCH BYREF */
punk
=
(
IUnknown
*
)
&
test_myVariantClearImpl
;
V_VT
(
&
v
)
=
VT_DISPATCH
|
VT_BYREF
;
V_DISPATCHREF
(
&
v
)
=
(
IDispatch
**
)
&
punk
;
test_myVariantClearImpl
.
events
=
0
;
hres
=
VariantClear
(
&
v
);
ok
(
hres
==
S_OK
,
"ret %08lx
\n
"
,
hres
);
ok
(
V_VT
(
&
v
)
==
0
,
"vt %04x
\n
"
,
V_VT
(
&
v
));
ok
(
V_DISPATCHREF
(
&
v
)
==
(
IDispatch
**
)
&
punk
,
"dispatch ref %p
\n
"
,
V_DISPATCHREF
(
&
v
));
/* Check that nothing got called */
ok
(
test_myVariantClearImpl
.
events
==
0
,
"Unexpected call. events %08lx
\n
"
,
test_myVariantClearImpl
.
events
);
}
static
void
test_VariantCopy
(
void
)
...
...
dlls/oleaut32/variant.c
View file @
2898b5d9
...
...
@@ -625,11 +625,6 @@ HRESULT WINAPI VariantClear(VARIANTARG* pVarg)
if
(
V_UNKNOWN
(
pVarg
))
IUnknown_Release
(
V_UNKNOWN
(
pVarg
));
}
else
if
(
V_VT
(
pVarg
)
==
VT_VARIANT
)
{
if
(
V_VARIANTREF
(
pVarg
))
VariantClear
(
V_VARIANTREF
(
pVarg
));
}
}
V_VT
(
pVarg
)
=
VT_EMPTY
;
}
...
...
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