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
6e92fca9
Commit
6e92fca9
authored
Sep 06, 2004
by
Robert Shearman
Committed by
Alexandre Julliard
Sep 06, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Fix PropVariantCopy for VT_LPSTR and VT_LPWSTR.
- Test case VT_BSTR, VT_LPSTR and VT_LPWSTR.
parent
ab1866be
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
8 deletions
+52
-8
ole2.c
dlls/ole32/ole2.c
+9
-7
Makefile.in
dlls/ole32/tests/Makefile.in
+1
-1
propvariant.c
dlls/ole32/tests/propvariant.c
+42
-0
No files found.
dlls/ole32/ole2.c
View file @
6e92fca9
/*
* OLE2 library
*
...
...
@@ -2426,8 +2425,11 @@ HRESULT WINAPI PropVariantClear(PROPVARIANT * pvar) /* [in/out] */
CoTaskMemFree
(
pvar
->
u
.
blob
.
pBlobData
);
break
;
case
VT_BSTR
:
FIXME
(
"Need to load OLEAUT32 for SysFreeString
\n
"
);
/* SysFreeString(pvar->u.bstrVal); */
if
(
pvar
->
u
.
bstrVal
)
{
FIXME
(
"Need to load OLEAUT32 for SysFreeString
\n
"
);
/* SysFreeString(pvar->u.bstrVal); */
}
break
;
case
VT_CF
:
if
(
pvar
->
u
.
pclipdata
)
...
...
@@ -2496,13 +2498,13 @@ HRESULT WINAPI PropVariantCopy(PROPVARIANT *pvarDest, /* [out] */
break
;
case
VT_LPSTR
:
len
=
strlen
(
pvarSrc
->
u
.
pszVal
);
pvarDest
->
u
.
pszVal
=
CoTaskMemAlloc
(
len
);
CopyMemory
(
pvarDest
->
u
.
pszVal
,
pvarSrc
->
u
.
pszVal
,
len
);
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
);
CopyMemory
(
pvarDest
->
u
.
pwszVal
,
pvarSrc
->
u
.
pwszVal
,
len
);
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/Makefile.in
View file @
6e92fca9
...
...
@@ -3,7 +3,7 @@ TOPOBJDIR = ../../..
SRCDIR
=
@srcdir@
VPATH
=
@srcdir@
TESTDLL
=
ole32.dll
IMPORTS
=
ole32 kernel32 ntdll
IMPORTS
=
ole
aut32 ole
32 kernel32 ntdll
EXTRALIBS
=
-luuid
CTESTS
=
\
...
...
dlls/ole32/tests/propvariant.c
View file @
6e92fca9
...
...
@@ -18,10 +18,13 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "windows.h"
/* not present in Wine yet */
/*#include "propidl.h"*/
WINOLEAPI
PropVariantClear
(
PROPVARIANT
*
);
WINOLEAPI
PropVariantCopy
(
PROPVARIANT
*
,
const
PROPVARIANT
*
);
#include "wine/test.h"
...
...
@@ -160,7 +163,46 @@ static void test_validtypes()
}
}
static
void
test_copy
()
{
static
const
char
szTestString
[]
=
"Test String"
;
static
const
WCHAR
wszTestString
[]
=
{
'T'
,
'e'
,
's'
,
't'
,
' '
,
'S'
,
't'
,
'r'
,
'i'
,
'n'
,
'g'
,
0
};
PROPVARIANT
propvarSrc
;
PROPVARIANT
propvarDst
;
HRESULT
hr
;
propvarSrc
.
vt
=
VT_BSTR
;
propvarSrc
.
u
.
bstrVal
=
SysAllocString
(
wszTestString
);
hr
=
PropVariantCopy
(
&
propvarDst
,
&
propvarSrc
);
ok
(
hr
==
S_OK
,
"PropVariantCopy(...VT_BSTR...) failed
\n
"
);
ok
(
!
lstrcmpW
(
propvarSrc
.
u
.
bstrVal
,
propvarDst
.
u
.
bstrVal
),
"BSTR not copied properly
\n
"
);
hr
=
PropVariantClear
(
&
propvarSrc
);
ok
(
hr
==
S_OK
,
"PropVariantClear(...VT_BSTR...) failed
\n
"
);
hr
=
PropVariantClear
(
&
propvarDst
);
ok
(
hr
==
S_OK
,
"PropVariantClear(...VT_BSTR...) failed
\n
"
);
propvarSrc
.
vt
=
VT_LPWSTR
;
propvarSrc
.
u
.
pwszVal
=
(
LPWSTR
)
wszTestString
;
hr
=
PropVariantCopy
(
&
propvarDst
,
&
propvarSrc
);
ok
(
hr
==
S_OK
,
"PropVariantCopy(...VT_LPWSTR...) failed
\n
"
);
ok
(
!
lstrcmpW
(
propvarSrc
.
u
.
pwszVal
,
propvarDst
.
u
.
pwszVal
),
"Wide string not copied properly
\n
"
);
hr
=
PropVariantClear
(
&
propvarDst
);
ok
(
hr
==
S_OK
,
"PropVariantClear(...VT_LPWSTR...) failed
\n
"
);
memset
(
&
propvarSrc
,
0
,
sizeof
(
propvarSrc
));
propvarSrc
.
vt
=
VT_LPSTR
;
propvarSrc
.
u
.
pszVal
=
(
LPSTR
)
szTestString
;
hr
=
PropVariantCopy
(
&
propvarDst
,
&
propvarSrc
);
ok
(
hr
==
S_OK
,
"PropVariantCopy(...VT_LPSTR...) failed
\n
"
);
ok
(
!
strcmp
(
propvarSrc
.
u
.
pszVal
,
propvarDst
.
u
.
pszVal
),
"String not copied properly
\n
"
);
hr
=
PropVariantClear
(
&
propvarDst
);
ok
(
hr
==
S_OK
,
"PropVariantClear(...VT_LPSTR...) failed
\n
"
);
memset
(
&
propvarSrc
,
0
,
sizeof
(
propvarSrc
));
}
START_TEST
(
propvariant
)
{
test_validtypes
();
test_copy
();
}
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