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
57895e5a
Commit
57895e5a
authored
Jan 20, 2014
by
Andrew Eikum
Committed by
Alexandre Julliard
Jan 27, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oleaut32: Improve ITypeLib::FindName.
parent
1abafbff
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
107 additions
and
12 deletions
+107
-12
typelib.c
dlls/oleaut32/tests/typelib.c
+95
-4
typelib.c
dlls/oleaut32/typelib.c
+12
-8
No files found.
dlls/oleaut32/tests/typelib.c
View file @
57895e5a
...
@@ -1554,8 +1554,10 @@ static void test_CreateTypeLib(SYSKIND sys) {
...
@@ -1554,8 +1554,10 @@ static void test_CreateTypeLib(SYSKIND sys) {
ICreateTypeInfo2
*
createti2
;
ICreateTypeInfo2
*
createti2
;
ITypeLib
*
tl
,
*
stdole
;
ITypeLib
*
tl
,
*
stdole
;
ITypeInfo
*
interface1
,
*
interface2
,
*
dual
,
*
unknown
,
*
dispatch
,
*
ti
;
ITypeInfo
*
interface1
,
*
interface2
,
*
dual
,
*
unknown
,
*
dispatch
,
*
ti
;
ITypeInfo
*
tinfos
[
2
];
ITypeInfo2
*
ti2
;
ITypeInfo2
*
ti2
;
ITypeComp
*
tcomp
;
ITypeComp
*
tcomp
;
MEMBERID
memids
[
2
];
FUNCDESC
funcdesc
,
*
pfuncdesc
;
FUNCDESC
funcdesc
,
*
pfuncdesc
;
ELEMDESC
elemdesc
[
5
],
*
edesc
;
ELEMDESC
elemdesc
[
5
],
*
edesc
;
PARAMDESCEX
paramdescex
;
PARAMDESCEX
paramdescex
;
...
@@ -1567,6 +1569,7 @@ static void test_CreateTypeLib(SYSKIND sys) {
...
@@ -1567,6 +1569,7 @@ static void test_CreateTypeLib(SYSKIND sys) {
DWORD
helpcontext
,
ptr_size
,
alignment
;
DWORD
helpcontext
,
ptr_size
,
alignment
;
int
impltypeflags
;
int
impltypeflags
;
unsigned
int
cnames
;
unsigned
int
cnames
;
USHORT
found
;
VARIANT
cust_data
;
VARIANT
cust_data
;
HRESULT
hres
;
HRESULT
hres
;
TYPEKIND
kind
;
TYPEKIND
kind
;
...
@@ -2665,6 +2668,46 @@ static void test_CreateTypeLib(SYSKIND sys) {
...
@@ -2665,6 +2668,46 @@ static void test_CreateTypeLib(SYSKIND sys) {
ok
(
libattr
->
wLibFlags
==
LIBFLAG_FHASDISKIMAGE
,
"wLibFlags = %d
\n
"
,
libattr
->
wLibFlags
);
ok
(
libattr
->
wLibFlags
==
LIBFLAG_FHASDISKIMAGE
,
"wLibFlags = %d
\n
"
,
libattr
->
wLibFlags
);
ITypeLib_ReleaseTLibAttr
(
tl
,
libattr
);
ITypeLib_ReleaseTLibAttr
(
tl
,
libattr
);
found
=
2
;
memset
(
tinfos
,
0
,
sizeof
(
tinfos
));
memids
[
0
]
=
0xdeadbeef
;
memids
[
1
]
=
0xdeadbeef
;
hres
=
ITypeLib_FindName
(
tl
,
param1W
,
0
,
tinfos
,
memids
,
&
found
);
ok
(
hres
==
S_OK
,
"got: %08x
\n
"
,
hres
);
ok
(
found
==
0
,
"got wrong count: %u
\n
"
,
found
);
ok
(
tinfos
[
0
]
==
NULL
,
"got invalid typeinfo[0]
\n
"
);
ok
(
tinfos
[
1
]
==
NULL
,
"got invalid typeinfo[1]
\n
"
);
ok
(
memids
[
0
]
==
0xdeadbeef
,
"got invalid memid[0]
\n
"
);
ok
(
memids
[
1
]
==
0xdeadbeef
,
"got invalid memid[1]
\n
"
);
found
=
2
;
memset
(
tinfos
,
0
,
sizeof
(
tinfos
));
memids
[
0
]
=
0xdeadbeef
;
memids
[
1
]
=
0xdeadbeef
;
hres
=
ITypeLib_FindName
(
tl
,
func1W
,
0
,
tinfos
,
memids
,
&
found
);
ok
(
hres
==
S_OK
,
"got: %08x
\n
"
,
hres
);
ok
(
found
==
1
,
"got wrong count: %u
\n
"
,
found
);
ok
(
tinfos
[
0
]
!=
NULL
,
"got invalid typeinfo[0]
\n
"
);
ok
(
tinfos
[
1
]
==
NULL
,
"got invalid typeinfo[1]
\n
"
);
ok
(
memids
[
0
]
==
0
,
"got invalid memid[0]
\n
"
);
ok
(
memids
[
1
]
==
0xdeadbeef
,
"got invalid memid[1]
\n
"
);
if
(
tinfos
[
0
])
ITypeInfo_Release
(
tinfos
[
0
]);
found
=
2
;
memset
(
tinfos
,
0
,
sizeof
(
tinfos
));
memids
[
0
]
=
0xdeadbeef
;
memids
[
1
]
=
0xdeadbeef
;
hres
=
ITypeLib_FindName
(
tl
,
interface1W
,
0
,
tinfos
,
memids
,
&
found
);
ok
(
hres
==
S_OK
,
"got: %08x
\n
"
,
hres
);
ok
(
found
==
1
,
"got wrong count: %u
\n
"
,
found
);
ok
(
tinfos
[
0
]
!=
NULL
,
"got invalid typeinfo[0]
\n
"
);
ok
(
tinfos
[
1
]
==
NULL
,
"got invalid typeinfo[1]
\n
"
);
ok
(
memids
[
0
]
==
MEMBERID_NIL
,
"got invalid memid[0]: %x
\n
"
,
memids
[
0
]);
ok
(
memids
[
1
]
==
0xdeadbeef
,
"got invalid memid[1]
\n
"
);
if
(
tinfos
[
0
])
ITypeInfo_Release
(
tinfos
[
0
]);
hres
=
ITypeLib_GetDocumentation
(
tl
,
-
1
,
&
name
,
&
docstring
,
&
helpcontext
,
&
helpfile
);
hres
=
ITypeLib_GetDocumentation
(
tl
,
-
1
,
&
name
,
&
docstring
,
&
helpcontext
,
&
helpfile
);
ok
(
hres
==
S_OK
,
"got %08x
\n
"
,
hres
);
ok
(
hres
==
S_OK
,
"got %08x
\n
"
,
hres
);
ok
(
memcmp
(
typelibW
,
name
,
sizeof
(
typelibW
))
==
0
,
"got wrong typelib name: %s
\n
"
,
ok
(
memcmp
(
typelibW
,
name
,
sizeof
(
typelibW
))
==
0
,
"got wrong typelib name: %s
\n
"
,
...
@@ -4272,6 +4315,7 @@ static void test_SetVarHelpContext(void)
...
@@ -4272,6 +4315,7 @@ static void test_SetVarHelpContext(void)
static
void
test_SetFuncAndParamNames
(
void
)
static
void
test_SetFuncAndParamNames
(
void
)
{
{
static
OLECHAR
nameW
[]
=
{
'n'
,
'a'
,
'm'
,
'e'
,
0
};
static
OLECHAR
nameW
[]
=
{
'n'
,
'a'
,
'm'
,
'e'
,
0
};
static
OLECHAR
name2W
[]
=
{
'n'
,
'a'
,
'm'
,
'e'
,
'2'
,
0
};
static
OLECHAR
prop
[]
=
{
'p'
,
'r'
,
'o'
,
'p'
,
0
};
static
OLECHAR
prop
[]
=
{
'p'
,
'r'
,
'o'
,
'p'
,
0
};
static
OLECHAR
*
propW
[]
=
{
prop
};
static
OLECHAR
*
propW
[]
=
{
prop
};
static
OLECHAR
func
[]
=
{
'f'
,
'u'
,
'n'
,
'c'
,
0
};
static
OLECHAR
func
[]
=
{
'f'
,
'u'
,
'n'
,
'c'
,
0
};
...
@@ -4280,9 +4324,13 @@ static void test_SetFuncAndParamNames(void)
...
@@ -4280,9 +4324,13 @@ static void test_SetFuncAndParamNames(void)
WCHAR
filenameW
[
MAX_PATH
];
WCHAR
filenameW
[
MAX_PATH
];
ICreateTypeLib2
*
ctl
;
ICreateTypeLib2
*
ctl
;
ICreateTypeInfo
*
cti
;
ICreateTypeInfo
*
cti
;
ITypeLib
*
tl
;
ITypeInfo
*
infos
[
3
];
MEMBERID
memids
[
3
];
FUNCDESC
funcdesc
;
FUNCDESC
funcdesc
;
ELEMDESC
edesc
;
ELEMDESC
edesc
;
HRESULT
hr
;
HRESULT
hr
;
USHORT
found
;
GetTempFileNameA
(
"."
,
"tlb"
,
0
,
filenameA
);
GetTempFileNameA
(
"."
,
"tlb"
,
0
,
filenameA
);
MultiByteToWideChar
(
CP_ACP
,
0
,
filenameA
,
-
1
,
filenameW
,
MAX_PATH
);
MultiByteToWideChar
(
CP_ACP
,
0
,
filenameA
,
-
1
,
filenameW
,
MAX_PATH
);
...
@@ -4352,6 +4400,50 @@ static void test_SetFuncAndParamNames(void)
...
@@ -4352,6 +4400,50 @@ static void test_SetFuncAndParamNames(void)
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ICreateTypeInfo_Release
(
cti
);
ICreateTypeInfo_Release
(
cti
);
hr
=
ICreateTypeLib2_CreateTypeInfo
(
ctl
,
name2W
,
TKIND_INTERFACE
,
&
cti
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
funcdesc
.
funckind
=
FUNC_PUREVIRTUAL
;
funcdesc
.
invkind
=
INVOKE_FUNC
;
funcdesc
.
cParams
=
0
;
funcdesc
.
lprgelemdescParam
=
NULL
;
hr
=
ICreateTypeInfo_AddFuncDesc
(
cti
,
0
,
&
funcdesc
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
ICreateTypeInfo_SetFuncAndParamNames
(
cti
,
0
,
funcW
,
1
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ICreateTypeInfo_Release
(
cti
);
hr
=
ICreateTypeLib2_QueryInterface
(
ctl
,
&
IID_ITypeLib
,
(
void
**
)
&
tl
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
found
=
1
;
memset
(
infos
,
0
,
sizeof
(
infos
));
memids
[
0
]
=
0xdeadbeef
;
memids
[
1
]
=
0xdeadbeef
;
memids
[
2
]
=
0xdeadbeef
;
hr
=
ITypeLib_FindName
(
tl
,
func
,
0
,
infos
,
memids
,
&
found
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
found
==
1
,
"got wrong count: %u
\n
"
,
found
);
ok
(
infos
[
0
]
&&
!
infos
[
1
]
&&
!
infos
[
2
],
"got wrong typeinfo
\n
"
);
ok
(
memids
[
0
]
==
0
,
"got wrong memid[0]
\n
"
);
ok
(
memids
[
1
]
==
0xdeadbeef
&&
memids
[
2
]
==
0xdeadbeef
,
"got wrong memids
\n
"
);
found
=
3
;
memset
(
infos
,
0
,
sizeof
(
infos
));
memids
[
0
]
=
0xdeadbeef
;
memids
[
1
]
=
0xdeadbeef
;
memids
[
2
]
=
0xdeadbeef
;
hr
=
ITypeLib_FindName
(
tl
,
func
,
0
,
infos
,
memids
,
&
found
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
found
==
2
,
"got wrong count: %u
\n
"
,
found
);
ok
(
infos
[
0
]
&&
infos
[
1
]
&&
infos
[
0
]
!=
infos
[
1
],
"got same typeinfo
\n
"
);
ok
(
memids
[
0
]
==
0
,
"got wrong memid[0]
\n
"
);
ok
(
memids
[
1
]
==
0
,
"got wrong memid[1]
\n
"
);
ITypeLib_Release
(
tl
);
ICreateTypeLib2_Release
(
ctl
);
ICreateTypeLib2_Release
(
ctl
);
DeleteFileA
(
filenameA
);
DeleteFileA
(
filenameA
);
}
}
...
@@ -4543,8 +4635,7 @@ static void test_FindName(void)
...
@@ -4543,8 +4635,7 @@ static void test_FindName(void)
ti
=
(
void
*
)
0xdeadbeef
;
ti
=
(
void
*
)
0xdeadbeef
;
hr
=
ITypeLib_FindName
(
tl
,
buffW
,
0
,
&
ti
,
&
memid
,
&
c
);
hr
=
ITypeLib_FindName
(
tl
,
buffW
,
0
,
&
ti
,
&
memid
,
&
c
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
todo_wine
ok
(
memid
==
MEMBERID_NIL
,
"got %d
\n
"
,
memid
);
ok
(
memid
==
-
1
,
"got %d
\n
"
,
memid
);
ok
(
!
lstrcmpW
(
buffW
,
wszGUID
),
"got %s
\n
"
,
wine_dbgstr_w
(
buffW
));
ok
(
!
lstrcmpW
(
buffW
,
wszGUID
),
"got %s
\n
"
,
wine_dbgstr_w
(
buffW
));
ok
(
c
==
1
,
"got %d
\n
"
,
c
);
ok
(
c
==
1
,
"got %d
\n
"
,
c
);
ITypeInfo_Release
(
ti
);
ITypeInfo_Release
(
ti
);
...
@@ -4556,7 +4647,7 @@ todo_wine
...
@@ -4556,7 +4647,7 @@ todo_wine
hr
=
ITypeLib_FindName
(
tl
,
buffW
,
0
,
&
ti
,
&
memid
,
&
c
);
hr
=
ITypeLib_FindName
(
tl
,
buffW
,
0
,
&
ti
,
&
memid
,
&
c
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
todo_wine
{
todo_wine
{
ok
(
memid
==
-
1
,
"got %d
\n
"
,
memid
);
ok
(
memid
==
MEMBERID_NIL
,
"got %d
\n
"
,
memid
);
ok
(
!
lstrcmpW
(
buffW
,
wszGUID
),
"got %s
\n
"
,
wine_dbgstr_w
(
buffW
));
ok
(
!
lstrcmpW
(
buffW
,
wszGUID
),
"got %s
\n
"
,
wine_dbgstr_w
(
buffW
));
ok
(
c
==
1
,
"got %d
\n
"
,
c
);
ok
(
c
==
1
,
"got %d
\n
"
,
c
);
}
}
...
@@ -4569,7 +4660,7 @@ todo_wine {
...
@@ -4569,7 +4660,7 @@ todo_wine {
ti
=
(
void
*
)
0xdeadbeef
;
ti
=
(
void
*
)
0xdeadbeef
;
hr
=
ITypeLib_FindName
(
tl
,
buffW
,
0
,
&
ti
,
&
memid
,
&
c
);
hr
=
ITypeLib_FindName
(
tl
,
buffW
,
0
,
&
ti
,
&
memid
,
&
c
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
memid
==
-
1
,
"got %d
\n
"
,
memid
);
ok
(
memid
==
MEMBERID_NIL
,
"got %d
\n
"
,
memid
);
ok
(
!
lstrcmpW
(
buffW
,
invalidW
),
"got %s
\n
"
,
wine_dbgstr_w
(
buffW
));
ok
(
!
lstrcmpW
(
buffW
,
invalidW
),
"got %s
\n
"
,
wine_dbgstr_w
(
buffW
));
ok
(
c
==
0
,
"got %d
\n
"
,
c
);
ok
(
c
==
0
,
"got %d
\n
"
,
c
);
ok
(
ti
==
(
void
*
)
0xdeadbeef
,
"got %p
\n
"
,
ti
);
ok
(
ti
==
(
void
*
)
0xdeadbeef
,
"got %p
\n
"
,
ti
);
...
...
dlls/oleaut32/typelib.c
View file @
57895e5a
...
@@ -5176,26 +5176,30 @@ static HRESULT WINAPI ITypeLib2_fnFindName(
...
@@ -5176,26 +5176,30 @@ static HRESULT WINAPI ITypeLib2_fnFindName(
return
E_INVALIDARG
;
return
E_INVALIDARG
;
len
=
(
lstrlenW
(
name
)
+
1
)
*
sizeof
(
WCHAR
);
len
=
(
lstrlenW
(
name
)
+
1
)
*
sizeof
(
WCHAR
);
for
(
tic
=
0
;
tic
<
This
->
TypeInfoCount
;
++
tic
)
{
for
(
tic
=
0
;
count
<
*
found
&&
tic
<
This
->
TypeInfoCount
;
++
tic
)
{
ITypeInfoImpl
*
pTInfo
=
This
->
typeinfos
[
tic
];
ITypeInfoImpl
*
pTInfo
=
This
->
typeinfos
[
tic
];
TLBVarDesc
*
var
;
TLBVarDesc
*
var
;
UINT
fdc
;
UINT
fdc
;
if
(
!
TLB_str_memcmp
(
name
,
pTInfo
->
Name
,
len
))
goto
ITypeLib2_fnFindName_exit
;
if
(
!
TLB_str_memcmp
(
name
,
pTInfo
->
Name
,
len
))
{
memid
[
count
]
=
MEMBERID_NIL
;
goto
ITypeLib2_fnFindName_exit
;
}
for
(
fdc
=
0
;
fdc
<
pTInfo
->
cFuncs
;
++
fdc
)
{
for
(
fdc
=
0
;
fdc
<
pTInfo
->
cFuncs
;
++
fdc
)
{
TLBFuncDesc
*
func
=
&
pTInfo
->
funcdescs
[
fdc
];
TLBFuncDesc
*
func
=
&
pTInfo
->
funcdescs
[
fdc
];
int
pc
;
if
(
!
TLB_str_memcmp
(
name
,
func
->
Name
,
len
))
goto
ITypeLib2_fnFindName_exit
;
if
(
!
TLB_str_memcmp
(
name
,
func
->
Name
,
len
))
{
for
(
pc
=
0
;
pc
<
func
->
funcdesc
.
cParams
;
pc
++
)
{
memid
[
count
]
=
func
->
funcdesc
.
memid
;
if
(
!
TLB_str_memcmp
(
name
,
func
->
pParamDesc
[
pc
].
Name
,
len
))
goto
ITypeLib2_fnFindName_exit
;
goto
ITypeLib2_fnFindName_exit
;
}
}
}
}
var
=
TLB_get_vardesc_by_name
(
pTInfo
->
vardescs
,
pTInfo
->
cVars
,
name
);
var
=
TLB_get_vardesc_by_name
(
pTInfo
->
vardescs
,
pTInfo
->
cVars
,
name
);
if
(
var
)
if
(
var
)
{
memid
[
count
]
=
var
->
vardesc
.
memid
;
goto
ITypeLib2_fnFindName_exit
;
goto
ITypeLib2_fnFindName_exit
;
}
continue
;
continue
;
ITypeLib2_fnFindName_exit:
ITypeLib2_fnFindName_exit:
...
...
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