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
9d3e2f1b
Commit
9d3e2f1b
authored
Aug 18, 2010
by
Andrew Eikum
Committed by
Alexandre Julliard
Aug 19, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oleaut32: Implement ITypeInfo2::GetCustData.
parent
9c53c8e7
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
102 additions
and
11 deletions
+102
-11
typelib.c
dlls/oleaut32/tests/typelib.c
+27
-9
typelib2.c
dlls/oleaut32/typelib2.c
+75
-2
No files found.
dlls/oleaut32/tests/typelib.c
View file @
9d3e2f1b
...
...
@@ -1076,10 +1076,12 @@ static void test_CreateTypeLib(void) {
static
OLECHAR
prop1W
[]
=
{
'P'
,
'r'
,
'o'
,
'p'
,
'1'
,
0
};
static
OLECHAR
param1W
[]
=
{
'p'
,
'a'
,
'r'
,
'a'
,
'm'
,
'1'
,
0
};
static
OLECHAR
param2W
[]
=
{
'p'
,
'a'
,
'r'
,
'a'
,
'm'
,
'2'
,
0
};
static
OLECHAR
asdfW
[]
=
{
'A'
,
's'
,
'd'
,
'f'
,
0
};
static
OLECHAR
*
names1
[]
=
{
func1W
,
param1W
,
param2W
};
static
OLECHAR
*
names2
[]
=
{
func2W
,
param1W
,
param2W
};
static
OLECHAR
*
propname
[]
=
{
prop1W
,
param1W
};
static
const
GUID
custguid
=
{
0xbf611abe
,
0x5b38
,
0x11df
,{
0x91
,
0x5c
,
0x08
,
0x02
,
0x79
,
0x79
,
0x94
,
0x70
}};
static
const
GUID
bogusguid
=
{
0xbf611abe
,
0x5b38
,
0x11df
,{
0x91
,
0x5c
,
0x08
,
0x02
,
0x79
,
0x79
,
0x94
,
0x71
}};
char
filename
[
MAX_PATH
];
WCHAR
filenameW
[
MAX_PATH
];
...
...
@@ -1444,15 +1446,12 @@ static void test_CreateTypeLib(void) {
ok
(
hres
==
S_OK
,
"got %08x
\n
"
,
hres
);
hres
=
ITypeInfo2_GetCustData
(
ti2
,
NULL
,
NULL
);
todo_wine
ok
(
hres
==
E_INVALIDARG
,
"got %08x
\n
"
,
hres
);
hres
=
ITypeInfo2_GetCustData
(
ti2
,
&
custguid
,
NULL
);
todo_wine
ok
(
hres
==
E_INVALIDARG
,
"got %08x
\n
"
,
hres
);
hres
=
ITypeInfo2_GetCustData
(
ti2
,
&
custguid
,
&
cust_data
);
todo_wine
ok
(
hres
==
S_OK
,
"got %08x
\n
"
,
hres
);
hres
=
ICreateTypeInfo2_SetCustData
(
createti2
,
NULL
,
NULL
);
...
...
@@ -1474,12 +1473,9 @@ static void test_CreateTypeLib(void) {
V_VT
(
&
cust_data
)
=
VT_EMPTY
;
hres
=
ITypeInfo2_GetCustData
(
ti2
,
&
custguid
,
&
cust_data
);
todo_wine
ok
(
hres
==
S_OK
,
"got %08x
\n
"
,
hres
);
todo_wine
ok
(
V_VT
(
&
cust_data
)
==
VT_UI4
,
"got %d
\n
"
,
V_VT
(
&
cust_data
));
todo_wine
ok
(
V_I4
(
&
cust_data
)
==
0xdeadbeef
,
"got 0x%08x
\n
"
,
V_I4
(
&
cust_data
));
V_VT
(
&
cust_data
)
=
VT_UI4
;
...
...
@@ -1492,14 +1488,36 @@ static void test_CreateTypeLib(void) {
V_VT
(
&
cust_data
)
=
VT_EMPTY
;
hres
=
ITypeInfo2_GetCustData
(
ti2
,
&
custguid
,
&
cust_data
);
todo_wine
ok
(
hres
==
S_OK
,
"got %08x
\n
"
,
hres
);
todo_wine
ok
(
V_VT
(
&
cust_data
)
==
VT_UI4
,
"got %d
\n
"
,
V_VT
(
&
cust_data
));
todo_wine
ok
(
V_I4
(
&
cust_data
)
==
12345678
,
"got 0x%08x
\n
"
,
V_I4
(
&
cust_data
));
V_VT
(
&
cust_data
)
=
VT_BSTR
;
V_BSTR
(
&
cust_data
)
=
SysAllocString
(
asdfW
);
hres
=
ICreateTypeInfo2_SetCustData
(
createti2
,
&
custguid
,
&
cust_data
);
ok
(
hres
==
S_OK
,
"got %08x
\n
"
,
hres
);
SysFreeString
(
V_BSTR
(
&
cust_data
));
V_I4
(
&
cust_data
)
=
0
;
V_VT
(
&
cust_data
)
=
VT_EMPTY
;
hres
=
ITypeInfo2_GetCustData
(
ti2
,
&
custguid
,
&
cust_data
);
ok
(
hres
==
S_OK
,
"got %08x
\n
"
,
hres
);
ok
(
V_VT
(
&
cust_data
)
==
VT_BSTR
,
"got %d
\n
"
,
V_VT
(
&
cust_data
));
ok
(
!
lstrcmpW
(
V_BSTR
(
&
cust_data
),
asdfW
),
"got %s
\n
"
,
wine_dbgstr_w
(
V_BSTR
(
&
cust_data
)));
SysFreeString
(
V_BSTR
(
&
cust_data
));
V_VT
(
&
cust_data
)
=
VT_UI4
;
V_UI4
(
&
cust_data
)
=
17
;
hres
=
ITypeInfo2_GetCustData
(
ti2
,
&
bogusguid
,
&
cust_data
);
ok
(
hres
==
S_OK
,
"got %08x
\n
"
,
hres
);
ok
(
V_VT
(
&
cust_data
)
==
VT_EMPTY
,
"got: %d
\n
"
,
V_VT
(
&
cust_data
));
ITypeInfo2_Release
(
ti2
);
ICreateTypeInfo2_Release
(
createti2
);
ICreateTypeInfo_Release
(
createti
);
...
...
dlls/oleaut32/typelib2.c
View file @
9d3e2f1b
...
...
@@ -951,6 +951,64 @@ static int ctl2_find_custdata(
}
/****************************************************************************
* ctl2_decode_variant
*
* Decodes a variant
*
* RETURNS
*
* Success: S_OK
* Failure: Error code from winerror.h
*/
static
HRESULT
ctl2_decode_variant
(
ICreateTypeLib2Impl
*
This
,
/* [I] The typelib that contains the variant */
int
data_offs
,
/* [I] Offset within the data array, or the encoded value itself */
VARIANT
*
value
)
/* [O] Decoded value */
{
char
*
encoded_data
;
VARTYPE
type
;
if
(
data_offs
&
0x80000000
)
{
/* data_offs contains the encoded value */
V_VT
(
value
)
=
(
data_offs
&
~
0x80000000
)
>>
26
;
V_UI4
(
value
)
=
data_offs
&
~
0xFF000000
;
return
S_OK
;
}
encoded_data
=
&
This
->
typelib_segment_data
[
MSFT_SEG_CUSTDATA
][
data_offs
];
type
=
*
encoded_data
;
switch
(
type
)
{
case
VT_I4
:
case
VT_R4
:
case
VT_UI4
:
case
VT_INT
:
case
VT_UINT
:
case
VT_HRESULT
:
case
VT_PTR
:
{
V_VT
(
value
)
=
type
;
V_UI4
(
value
)
=
*
(
unsigned
*
)(
encoded_data
+
2
);
return
S_OK
;
}
case
VT_BSTR
:
{
unsigned
len
,
i
;
len
=
*
(
unsigned
*
)(
encoded_data
+
2
);
V_VT
(
value
)
=
type
;
V_BSTR
(
value
)
=
SysAllocStringByteLen
(
NULL
,
len
*
sizeof
(
OLECHAR
));
for
(
i
=
0
;
i
<
len
;
++
i
)
V_BSTR
(
value
)[
i
]
=
*
(
encoded_data
+
6
+
i
);
return
S_OK
;
}
default:
FIXME
(
"Don't yet have decoder for this VARTYPE: %u
\n
"
,
type
);
return
E_NOTIMPL
;
}
}
/****************************************************************************
* ctl2_set_custdata
*
* Adds a custom data element to an object in a type library.
...
...
@@ -3610,8 +3668,23 @@ static HRESULT WINAPI ITypeInfo2_fnGetCustData(
REFGUID
guid
,
/* [I] The GUID under which the custom data is stored. */
VARIANT
*
pVarVal
)
/* [O] The custom data. */
{
FIXME
(
"(%p,%s,%p), stub!
\n
"
,
iface
,
debugstr_guid
(
guid
),
pVarVal
);
return
E_OUTOFMEMORY
;
ICreateTypeInfo2Impl
*
This
=
impl_from_ITypeInfo2
(
iface
);
MSFT_CDGuid
*
cdentry
;
int
offset
;
TRACE
(
"(%p,%s,%p)
\n
"
,
iface
,
debugstr_guid
(
guid
),
pVarVal
);
if
(
!
guid
||
!
pVarVal
)
return
E_INVALIDARG
;
VariantClear
(
pVarVal
);
offset
=
ctl2_find_custdata
(
This
->
typelib
,
guid
,
This
->
typeinfo
->
oCustData
);
if
(
offset
==
-
1
)
return
S_OK
;
cdentry
=
(
MSFT_CDGuid
*
)
&
This
->
typelib
->
typelib_segment_data
[
MSFT_SEG_CUSTDATAGUID
][
offset
];
return
ctl2_decode_variant
(
This
->
typelib
,
cdentry
->
DataOffset
,
pVarVal
);
}
/******************************************************************************
...
...
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