oleaut32: Apply TKIND_DISPATCH changes to FUNCDESC results from ITypeComp::Bind.

This commit is contained in:
Andrew Eikum 2013-09-06 07:13:17 -05:00 committed by Alexandre Julliard
parent 664e7938cb
commit cb1f4c5387
2 changed files with 41 additions and 2 deletions

View File

@ -1539,6 +1539,7 @@ static void test_CreateTypeLib(SYSKIND sys) {
static OLECHAR param2W[] = {'p','a','r','a','m','2',0};
static OLECHAR asdfW[] = {'A','s','d','f',0};
static OLECHAR aliasW[] = {'a','l','i','a','s',0};
static OLECHAR invokeW[] = {'I','n','v','o','k','e',0};
static OLECHAR *names1[] = {func1W, param1W, param2W};
static OLECHAR *names2[] = {func2W, param1W, param2W};
static OLECHAR *propname[] = {prop1W, param1W};
@ -1555,6 +1556,7 @@ static void test_CreateTypeLib(SYSKIND sys) {
ITypeLib *tl, *stdole;
ITypeInfo *interface1, *interface2, *dual, *unknown, *dispatch, *ti;
ITypeInfo2 *ti2;
ITypeComp *tcomp;
FUNCDESC funcdesc, *pfuncdesc;
ELEMDESC elemdesc[5], *edesc;
PARAMDESCEX paramdescex;
@ -1569,6 +1571,8 @@ static void test_CreateTypeLib(SYSKIND sys) {
VARIANT cust_data;
HRESULT hres;
TYPEKIND kind;
DESCKIND desckind;
BINDPTR bindptr;
switch(sys){
case SYS_WIN32:
@ -3443,6 +3447,34 @@ static void test_CreateTypeLib(SYSKIND sys) {
ok(typeattr->wMinorVerNum == 0, "wMinorVerNum = %d\n", typeattr->wMinorVerNum);
ITypeInfo_ReleaseTypeAttr(ti, typeattr);
hres = ITypeInfo_GetTypeComp(ti, &tcomp);
ok(hres == S_OK, "got %08x\n", hres);
hres = ITypeComp_Bind(tcomp, invokeW, 0, INVOKE_FUNC, &interface1, &desckind, &bindptr);
ok(hres == S_OK, "got %08x\n", hres);
ok(desckind == DESCKIND_FUNCDESC, "got wrong desckind: 0x%x\n", desckind);
ok(bindptr.lpfuncdesc->memid == 0x60010003, "got %x\n", bindptr.lpfuncdesc->memid);
ok(bindptr.lpfuncdesc->lprgscode == NULL, "got %p\n", bindptr.lpfuncdesc->lprgscode);
ok(bindptr.lpfuncdesc->lprgelemdescParam != NULL, "got %p\n", bindptr.lpfuncdesc->lprgelemdescParam);
ok(bindptr.lpfuncdesc->funckind == FUNC_DISPATCH, "got 0x%x\n", bindptr.lpfuncdesc->funckind);
ok(bindptr.lpfuncdesc->invkind == INVOKE_FUNC, "got 0x%x\n", bindptr.lpfuncdesc->invkind);
ok(bindptr.lpfuncdesc->callconv == CC_STDCALL, "got 0x%x\n", bindptr.lpfuncdesc->callconv);
ok(bindptr.lpfuncdesc->cParams == 8, "got %d\n", bindptr.lpfuncdesc->cParams);
ok(bindptr.lpfuncdesc->cParamsOpt == 0, "got %d\n", bindptr.lpfuncdesc->cParamsOpt);
#ifdef _WIN64
if(sys == SYS_WIN32)
todo_wine ok(bindptr.lpfuncdesc->oVft == 6 * sizeof(void*), "got %x\n", bindptr.lpfuncdesc->oVft);
else
#endif
ok(bindptr.lpfuncdesc->oVft == 6 * sizeof(void*), "got %x\n", bindptr.lpfuncdesc->oVft);
ok(bindptr.lpfuncdesc->cScodes == 0, "got %d\n", bindptr.lpfuncdesc->cScodes);
ok(bindptr.lpfuncdesc->elemdescFunc.tdesc.vt == VT_VOID, "got %d\n", bindptr.lpfuncdesc->elemdescFunc.tdesc.vt);
ok(bindptr.lpfuncdesc->wFuncFlags == FUNCFLAG_FRESTRICTED, "got 0x%x\n", bindptr.lpfuncdesc->wFuncFlags);
ITypeInfo_ReleaseFuncDesc(interface1, bindptr.lpfuncdesc);
ITypeInfo_Release(interface1);
ITypeComp_Release(tcomp);
hres = ITypeInfo_GetRefTypeOfImplType(ti, -1, &hreftype);
ok(hres == S_OK, "got %08x\n", hres);
ok(hreftype == -2, "got wrong hreftype: %x\n", hreftype);

View File

@ -8475,7 +8475,7 @@ static HRESULT WINAPI ITypeComp_fnBind(
for(fdc = 0; fdc < This->cFuncs; ++fdc){
pFDesc = &This->funcdescs[fdc];
if (!strcmpiW(TLB_get_bstr(pFDesc->Name), szName)) {
if (!lstrcmpiW(TLB_get_bstr(pFDesc->Name), szName)) {
if (!wFlags || (pFDesc->funcdesc.invkind & wFlags))
break;
else
@ -8508,7 +8508,7 @@ static HRESULT WINAPI ITypeComp_fnBind(
return S_OK;
}
}
/* FIXME: search each inherited interface, not just the first */
if (hr == DISP_E_MEMBERNOTFOUND && This->impltypes) {
/* recursive search */
ITypeInfo *pTInfo;
@ -8524,6 +8524,13 @@ static HRESULT WINAPI ITypeComp_fnBind(
{
hr = ITypeComp_Bind(pTComp, szName, lHash, wFlags, ppTInfo, pDescKind, pBindPtr);
ITypeComp_Release(pTComp);
if (SUCCEEDED(hr) && *pDescKind == DESCKIND_FUNCDESC &&
This->typekind == TKIND_DISPATCH)
{
FUNCDESC *tmp = pBindPtr->lpfuncdesc;
hr = TLB_AllocAndInitFuncDesc(tmp, &pBindPtr->lpfuncdesc, TRUE);
SysFreeString((BSTR)tmp);
}
return hr;
}
WARN("Could not search inherited interface!\n");