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
d68c13a8
Commit
d68c13a8
authored
Apr 18, 2014
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Apr 18, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32/tests: Add some tests for PropVariantCopy.
parent
5e7251b9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
83 additions
and
15 deletions
+83
-15
ole2.c
dlls/ole32/ole2.c
+14
-7
propvariant.c
dlls/ole32/tests/propvariant.c
+69
-8
No files found.
dlls/ole32/ole2.c
View file @
d68c13a8
...
...
@@ -3062,21 +3062,28 @@ HRESULT WINAPI PropVariantCopy(PROPVARIANT *pvarDest, /* [out] */
case
VT_STREAMED_OBJECT
:
case
VT_STORAGE
:
case
VT_STORED_OBJECT
:
IUnknown_AddRef
((
LPUNKNOWN
)
pvarDest
->
u
.
pStream
);
if
(
pvarDest
->
u
.
pStream
)
IStream_AddRef
(
pvarDest
->
u
.
pStream
);
break
;
case
VT_CLSID
:
pvarDest
->
u
.
puuid
=
CoTaskMemAlloc
(
sizeof
(
CLSID
));
*
pvarDest
->
u
.
puuid
=
*
pvarSrc
->
u
.
puuid
;
break
;
case
VT_LPSTR
:
len
=
strlen
(
pvarSrc
->
u
.
pszVal
);
pvarDest
->
u
.
pszVal
=
CoTaskMemAlloc
((
len
+
1
)
*
sizeof
(
CHAR
));
CopyMemory
(
pvarDest
->
u
.
pszVal
,
pvarSrc
->
u
.
pszVal
,
(
len
+
1
)
*
sizeof
(
CHAR
));
if
(
pvarSrc
->
u
.
pszVal
)
{
len
=
strlen
(
pvarSrc
->
u
.
pszVal
);
pvarDest
->
u
.
pszVal
=
CoTaskMemAlloc
((
len
+
1
)
*
sizeof
(
CHAR
));
CopyMemory
(
pvarDest
->
u
.
pszVal
,
pvarSrc
->
u
.
pszVal
,
(
len
+
1
)
*
sizeof
(
CHAR
));
}
break
;
case
VT_LPWSTR
:
len
=
lstrlenW
(
pvarSrc
->
u
.
pwszVal
);
pvarDest
->
u
.
pwszVal
=
CoTaskMemAlloc
((
len
+
1
)
*
sizeof
(
WCHAR
));
CopyMemory
(
pvarDest
->
u
.
pwszVal
,
pvarSrc
->
u
.
pwszVal
,
(
len
+
1
)
*
sizeof
(
WCHAR
));
if
(
pvarSrc
->
u
.
pwszVal
)
{
len
=
lstrlenW
(
pvarSrc
->
u
.
pwszVal
);
pvarDest
->
u
.
pwszVal
=
CoTaskMemAlloc
((
len
+
1
)
*
sizeof
(
WCHAR
));
CopyMemory
(
pvarDest
->
u
.
pwszVal
,
pvarSrc
->
u
.
pwszVal
,
(
len
+
1
)
*
sizeof
(
WCHAR
));
}
break
;
case
VT_BLOB
:
case
VT_BLOB_OBJECT
:
...
...
dlls/ole32/tests/propvariant.c
View file @
d68c13a8
...
...
@@ -130,7 +130,7 @@ static const char* wine_vtypes[VT_CLSID+1] =
};
static
void
expect
(
HRESULT
hr
,
VARTYPE
vt
)
static
void
expect
(
HRESULT
hr
,
VARTYPE
vt
,
BOOL
copy
)
{
int
idx
=
vt
&
VT_TYPEMASK
;
BYTE
flags
;
...
...
@@ -158,7 +158,7 @@ static void expect(HRESULT hr, VARTYPE vt)
}
if
(
flags
==
PROP_INV
)
ok
(
hr
==
STG_E_INVALIDPARAMETER
,
"%s (%s): got %08x
\n
"
,
wine_vtypes
[
idx
],
modifier
,
hr
);
ok
(
hr
==
copy
?
DISP_E_BADVARTYPE
:
STG_E_INVALIDPARAMETER
,
"%s (%s): got %08x
\n
"
,
wine_vtypes
[
idx
],
modifier
,
hr
);
else
if
(
flags
==
PROP_V0
)
ok
(
hr
==
S_OK
,
"%s (%s): got %08x
\n
"
,
wine_vtypes
[
idx
],
modifier
,
hr
);
else
if
(
flags
&
PROP_TODO
)
...
...
@@ -180,9 +180,11 @@ static void expect(HRESULT hr, VARTYPE vt)
static
void
test_validtypes
(
void
)
{
PROPVARIANT
propvar
;
PROPVARIANT
propvar
,
copy
,
uninit
;
HRESULT
hr
;
unsigned
int
i
;
unsigned
int
i
,
ret
;
memset
(
&
uninit
,
0x77
,
sizeof
(
uninit
));
memset
(
&
propvar
,
0x55
,
sizeof
(
propvar
));
hr
=
PropVariantClear
(
&
propvar
);
...
...
@@ -206,8 +208,23 @@ static void test_validtypes(void)
else
U
(
propvar
).
pszVal
=
NULL
;
vt
=
propvar
.
vt
=
i
;
memset
(
&
copy
,
0x77
,
sizeof
(
copy
));
hr
=
PropVariantCopy
(
&
copy
,
&
propvar
);
expect
(
hr
,
vt
,
TRUE
);
if
(
hr
==
S_OK
)
{
ok
(
copy
.
vt
==
propvar
.
vt
,
"expected %d, got %d
\n
"
,
propvar
.
vt
,
copy
.
vt
);
ok
(
U
(
copy
).
uhVal
.
QuadPart
==
U
(
propvar
).
uhVal
.
QuadPart
,
"%u: expected %#x/%#x, got %#x/%#x
\n
"
,
i
,
U
(
propvar
).
uhVal
.
u
.
LowPart
,
U
(
propvar
).
uhVal
.
u
.
HighPart
,
U
(
copy
).
uhVal
.
u
.
LowPart
,
U
(
copy
).
uhVal
.
u
.
HighPart
);
}
else
{
ret
=
memcmp
(
&
copy
,
&
uninit
,
sizeof
(
copy
));
ok
(
!
ret
||
broken
(
ret
)
/* win2000 */
,
"%d: copy should stay unchanged
\n
"
,
i
);
}
hr
=
PropVariantClear
(
&
propvar
);
expect
(
hr
,
vt
);
expect
(
hr
,
vt
,
FALSE
);
ok
(
propvar
.
vt
==
0
,
"expected 0, got %d
\n
"
,
propvar
.
vt
);
ok
(
U
(
propvar
).
uhVal
.
QuadPart
==
0
,
"%u: expected 0, got %#x/%#x
\n
"
,
i
,
U
(
propvar
).
uhVal
.
u
.
LowPart
,
U
(
propvar
).
uhVal
.
u
.
HighPart
);
...
...
@@ -215,8 +232,22 @@ static void test_validtypes(void)
memset
(
&
propvar
,
0x55
,
sizeof
(
propvar
));
U
(
propvar
).
pszVal
=
NULL
;
vt
=
propvar
.
vt
=
i
|
VT_ARRAY
;
memset
(
&
copy
,
0x77
,
sizeof
(
copy
));
hr
=
PropVariantCopy
(
&
copy
,
&
propvar
);
expect
(
hr
,
vt
,
TRUE
);
if
(
hr
==
S_OK
)
{
ok
(
copy
.
vt
==
propvar
.
vt
,
"expected %d, got %d
\n
"
,
propvar
.
vt
,
copy
.
vt
);
ok
(
U
(
copy
).
uhVal
.
QuadPart
==
0
,
"%u: expected 0, got %#x/%#x
\n
"
,
i
,
U
(
copy
).
uhVal
.
u
.
LowPart
,
U
(
copy
).
uhVal
.
u
.
HighPart
);
}
else
{
ret
=
memcmp
(
&
copy
,
&
uninit
,
sizeof
(
copy
));
ok
(
!
ret
||
broken
(
ret
)
/* win2000 */
,
"%d: copy should stay unchanged
\n
"
,
i
);
}
hr
=
PropVariantClear
(
&
propvar
);
expect
(
hr
,
vt
);
expect
(
hr
,
vt
,
FALSE
);
ok
(
propvar
.
vt
==
0
,
"expected 0, got %d
\n
"
,
propvar
.
vt
);
ok
(
U
(
propvar
).
uhVal
.
QuadPart
==
0
,
"%u: expected 0, got %#x/%#x
\n
"
,
i
,
U
(
propvar
).
uhVal
.
u
.
LowPart
,
U
(
propvar
).
uhVal
.
u
.
HighPart
);
...
...
@@ -225,8 +256,23 @@ static void test_validtypes(void)
U
(
propvar
).
caub
.
cElems
=
0
;
U
(
propvar
).
caub
.
pElems
=
NULL
;
vt
=
propvar
.
vt
=
i
|
VT_VECTOR
;
memset
(
&
copy
,
0x77
,
sizeof
(
copy
));
hr
=
PropVariantCopy
(
&
copy
,
&
propvar
);
expect
(
hr
,
vt
,
TRUE
);
if
(
hr
==
S_OK
)
{
ok
(
copy
.
vt
==
propvar
.
vt
,
"expected %d, got %d
\n
"
,
propvar
.
vt
,
copy
.
vt
);
ok
(
!
U
(
copy
).
caub
.
cElems
,
"%u: expected 0, got %d
\n
"
,
i
,
U
(
copy
).
caub
.
cElems
);
todo_wine
ok
(
!
U
(
copy
).
caub
.
pElems
,
"%u: expected NULL, got %p
\n
"
,
i
,
U
(
copy
).
caub
.
pElems
);
}
else
{
ret
=
memcmp
(
&
copy
,
&
uninit
,
sizeof
(
copy
));
ok
(
!
ret
||
broken
(
ret
)
/* win2000 */
,
"%d: copy should stay unchanged
\n
"
,
i
);
}
hr
=
PropVariantClear
(
&
propvar
);
expect
(
hr
,
vt
);
expect
(
hr
,
vt
,
FALSE
);
ok
(
propvar
.
vt
==
0
,
"expected 0, got %d
\n
"
,
propvar
.
vt
);
ok
(
U
(
propvar
).
uhVal
.
QuadPart
==
0
,
"%u: expected 0, got %#x/%#x
\n
"
,
i
,
U
(
propvar
).
uhVal
.
u
.
LowPart
,
U
(
propvar
).
uhVal
.
u
.
HighPart
);
...
...
@@ -234,8 +280,23 @@ static void test_validtypes(void)
memset
(
&
propvar
,
0x55
,
sizeof
(
propvar
));
U
(
propvar
).
pszVal
=
NULL
;
vt
=
propvar
.
vt
=
i
|
VT_BYREF
;
memset
(
&
copy
,
0x77
,
sizeof
(
copy
));
hr
=
PropVariantCopy
(
&
copy
,
&
propvar
);
expect
(
hr
,
vt
,
TRUE
);
if
(
hr
==
S_OK
)
{
ok
(
copy
.
vt
==
propvar
.
vt
,
"expected %d, got %d
\n
"
,
propvar
.
vt
,
copy
.
vt
);
ok
(
U
(
copy
).
uhVal
.
QuadPart
==
U
(
propvar
).
uhVal
.
QuadPart
,
"%u: expected %#x/%#x, got %#x/%#x
\n
"
,
i
,
U
(
propvar
).
uhVal
.
u
.
LowPart
,
U
(
propvar
).
uhVal
.
u
.
HighPart
,
U
(
copy
).
uhVal
.
u
.
LowPart
,
U
(
copy
).
uhVal
.
u
.
HighPart
);
}
else
{
ret
=
memcmp
(
&
copy
,
&
uninit
,
sizeof
(
copy
));
ok
(
!
ret
||
broken
(
ret
)
/* win2000 */
,
"%d: copy should stay unchanged
\n
"
,
i
);
}
hr
=
PropVariantClear
(
&
propvar
);
expect
(
hr
,
vt
);
expect
(
hr
,
vt
,
FALSE
);
ok
(
propvar
.
vt
==
0
,
"expected 0, got %d
\n
"
,
propvar
.
vt
);
ok
(
U
(
propvar
).
uhVal
.
QuadPart
==
0
,
"%u: expected 0, got %#x/%#x
\n
"
,
i
,
U
(
propvar
).
uhVal
.
u
.
LowPart
,
U
(
propvar
).
uhVal
.
u
.
HighPart
);
...
...
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