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
e68c7cf7
Commit
e68c7cf7
authored
Feb 22, 2010
by
Piotr Caban
Committed by
Alexandre Julliard
Feb 23, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oleaut32: Added VT_BSTR handling to ctl2_add_default_value.
parent
f42a73d0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
0 deletions
+46
-0
typelib.c
dlls/oleaut32/tests/typelib.c
+8
-0
typelib2.c
dlls/oleaut32/typelib2.c
+38
-0
No files found.
dlls/oleaut32/tests/typelib.c
View file @
e68c7cf7
...
...
@@ -970,6 +970,7 @@ if(use_midl_tlb) {
static
void
test_CreateTypeLib
(
void
)
{
static
OLECHAR
interface1W
[]
=
{
'i'
,
'n'
,
't'
,
'e'
,
'r'
,
'f'
,
'a'
,
'c'
,
'e'
,
'1'
,
0
};
static
WCHAR
defaultW
[]
=
{
'd'
,
'e'
,
'f'
,
'a'
,
'u'
,
'l'
,
't'
,
0x3213
,
0
};
char
filename
[
MAX_PATH
];
WCHAR
filenameW
[
MAX_PATH
];
...
...
@@ -1075,6 +1076,13 @@ static void test_CreateTypeLib(void) {
hres
=
ICreateTypeInfo_AddFuncDesc
(
createti
,
3
,
&
funcdesc
);
ok
(
hres
==
S_OK
,
"got %08x
\n
"
,
hres
);
elemdesc
[
0
].
tdesc
.
vt
=
VT_BSTR
;
elemdesc
[
1
].
tdesc
.
vt
=
VT_BSTR
;
V_VT
(
&
paramdescex
.
varDefaultValue
)
=
VT_BSTR
;
V_BSTR
(
&
paramdescex
.
varDefaultValue
)
=
SysAllocString
(
defaultW
);
hres
=
ICreateTypeInfo_AddFuncDesc
(
createti
,
3
,
&
funcdesc
);
ok
(
hres
==
S_OK
,
"got %08x
\n
"
,
hres
);
ICreateTypeInfo_Release
(
createti
);
hres
=
ICreateTypeLib_CreateTypeInfo
(
createtl
,
interface1W
,
TKIND_INTERFACE
,
&
createti
);
...
...
dlls/oleaut32/typelib2.c
View file @
e68c7cf7
...
...
@@ -1190,6 +1190,44 @@ static HRESULT ctl2_add_default_value(
memcpy
(
&
This
->
typelib_segment_data
[
MSFT_SEG_CUSTDATA
][
*
encoded_value
],
data
,
8
);
return
S_OK
;
}
case
VT_BSTR
:
{
/* Construct the data */
int
i
,
len
=
(
6
+
SysStringLen
(
V_BSTR
(
&
v
))
+
3
)
&
~
0x3
;
char
*
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
if
(
!
data
)
return
E_OUTOFMEMORY
;
*
((
unsigned
short
*
)
data
)
=
arg_type
;
*
((
unsigned
*
)(
data
+
2
))
=
SysStringLen
(
V_BSTR
(
&
v
));
for
(
i
=
0
;
i
<
SysStringLen
(
V_BSTR
(
&
v
));
i
++
)
{
if
(
V_BSTR
(
&
v
)[
i
]
<=
0x7f
)
data
[
i
+
6
]
=
V_BSTR
(
&
v
)[
i
];
else
data
[
i
+
6
]
=
'?'
;
}
WideCharToMultiByte
(
CP_ACP
,
0
,
V_BSTR
(
&
v
),
SysStringLen
(
V_BSTR
(
&
v
)),
&
data
[
6
],
len
-
6
,
NULL
,
NULL
);
for
(
i
=
6
+
SysStringLen
(
V_BSTR
(
&
v
));
i
<
len
;
i
++
)
data
[
i
]
=
0x57
;
/* Check if the data was already allocated */
for
(
*
encoded_value
=
0
;
*
encoded_value
<=
This
->
typelib_segdir
[
MSFT_SEG_CUSTDATA
].
length
-
len
;
*
encoded_value
+=
4
)
if
(
!
memcmp
(
&
This
->
typelib_segment_data
[
MSFT_SEG_CUSTDATA
][
*
encoded_value
],
data
,
len
))
{
HeapFree
(
GetProcessHeap
(),
0
,
data
);
return
S_OK
;
}
/* Allocate the data */
*
encoded_value
=
ctl2_alloc_segment
(
This
,
MSFT_SEG_CUSTDATA
,
len
,
0
);
if
(
*
encoded_value
==
-
1
)
{
HeapFree
(
GetProcessHeap
(),
0
,
data
);
return
E_OUTOFMEMORY
;
}
memcpy
(
&
This
->
typelib_segment_data
[
MSFT_SEG_CUSTDATA
][
*
encoded_value
],
data
,
len
);
HeapFree
(
GetProcessHeap
(),
0
,
data
);
return
S_OK
;
}
default:
FIXME
(
"Argument type not yet handled
\n
"
);
return
E_NOTIMPL
;
...
...
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