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
0a5086ab
Commit
0a5086ab
authored
Aug 27, 2012
by
Vincent Povirk
Committed by
Alexandre Julliard
Aug 28, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32: Add support for reading BSTR properties.
parent
58c2462c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
4 deletions
+37
-4
stg_prop.c
dlls/ole32/stg_prop.c
+35
-0
propvariant.c
dlls/ole32/tests/propvariant.c
+2
-4
No files found.
dlls/ole32/stg_prop.c
View file @
0a5086ab
...
...
@@ -58,6 +58,7 @@
#include "dictionary.h"
#include "storage32.h"
#include "enumx.h"
#include "oleauto.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
storage
);
...
...
@@ -1125,6 +1126,40 @@ static HRESULT PropertyStorage_ReadProperty(PROPVARIANT *prop, const BYTE *data,
}
break
;
}
case
VT_BSTR
:
{
DWORD
count
,
wcount
;
StorageUtl_ReadDWord
(
data
,
0
,
&
count
);
if
(
codepage
==
CP_UNICODE
&&
count
%
2
)
{
WARN
(
"Unicode string has odd number of bytes
\n
"
);
hr
=
STG_E_INVALIDHEADER
;
}
else
{
if
(
codepage
==
CP_UNICODE
)
wcount
=
count
/
2
;
else
wcount
=
MultiByteToWideChar
(
codepage
,
0
,
(
LPCSTR
)(
data
+
sizeof
(
DWORD
)),
count
,
NULL
,
0
);
prop
->
u
.
bstrVal
=
SysAllocStringLen
(
NULL
,
wcount
);
/* FIXME: use allocator? */
if
(
prop
->
u
.
bstrVal
)
{
if
(
codepage
==
CP_UNICODE
)
memcpy
(
prop
->
u
.
bstrVal
,
data
+
sizeof
(
DWORD
),
count
);
else
MultiByteToWideChar
(
codepage
,
0
,
(
LPCSTR
)(
data
+
sizeof
(
DWORD
)),
count
,
prop
->
u
.
bstrVal
,
wcount
);
prop
->
u
.
bstrVal
[
wcount
-
1
]
=
'\0'
;
TRACE
(
"Read string value %s
\n
"
,
debugstr_w
(
prop
->
u
.
bstrVal
));
}
else
hr
=
STG_E_INSUFFICIENTMEMORY
;
}
break
;
}
case
VT_BLOB
:
{
DWORD
count
;
...
...
dlls/ole32/tests/propvariant.c
View file @
0a5086ab
...
...
@@ -395,8 +395,7 @@ static void test_propertytovariant(void)
CP_WINUNICODE
,
&
propvar
,
&
allocator
);
ok
(
ret
==
0
,
"StgConvertPropertyToVariant returned %i
\n
"
,
ret
);
todo_wine
ok
(
propvar
.
vt
==
VT_BSTR
,
"unexpected vt %x
\n
"
,
propvar
.
vt
);
if
(
propvar
.
vt
==
VT_BSTR
)
ok
(
propvar
.
vt
==
VT_BSTR
,
"unexpected vt %x
\n
"
,
propvar
.
vt
);
ok
(
!
lstrcmpW
(
U
(
propvar
).
bstrVal
,
test_string
),
"unexpected string value
\n
"
);
PropVariantClear
(
&
propvar
);
...
...
@@ -404,8 +403,7 @@ static void test_propertytovariant(void)
CP_UTF8
,
&
propvar
,
&
allocator
);
ok
(
ret
==
0
,
"StgConvertPropertyToVariant returned %i
\n
"
,
ret
);
todo_wine
ok
(
propvar
.
vt
==
VT_BSTR
,
"unexpected vt %x
\n
"
,
propvar
.
vt
);
if
(
propvar
.
vt
==
VT_BSTR
)
ok
(
propvar
.
vt
==
VT_BSTR
,
"unexpected vt %x
\n
"
,
propvar
.
vt
);
ok
(
!
lstrcmpW
(
U
(
propvar
).
bstrVal
,
test_string
),
"unexpected string value
\n
"
);
PropVariantClear
(
&
propvar
);
}
...
...
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