Module: wine Branch: master Commit: cb1f4c5387c4440460c3a62ff55306e26474ef10 URL: http://source.winehq.org/git/wine.git/?a=commit;h=cb1f4c5387c4440460c3a62ff5...
Author: Andrew Eikum aeikum@codeweavers.com Date: Fri Sep 6 07:13:17 2013 -0500
oleaut32: Apply TKIND_DISPATCH changes to FUNCDESC results from ITypeComp::Bind.
---
dlls/oleaut32/tests/typelib.c | 32 ++++++++++++++++++++++++++++++++ dlls/oleaut32/typelib.c | 11 +++++++++-- 2 files changed, 41 insertions(+), 2 deletions(-)
diff --git a/dlls/oleaut32/tests/typelib.c b/dlls/oleaut32/tests/typelib.c index b873ac2..1c398f9 100644 --- a/dlls/oleaut32/tests/typelib.c +++ b/dlls/oleaut32/tests/typelib.c @@ -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); diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c index 9c1127f..72d53a0 100644 --- a/dlls/oleaut32/typelib.c +++ b/dlls/oleaut32/typelib.c @@ -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");