From: Kevin Puetz Subject: [PATCH v2 1/6] oleaut32/tests: Include [dual] interface in test_dump_typelib. Message-Id: <20200921141722.2300-1-PuetzKevinA@JohnDeere.com> Date: Mon, 21 Sep 2020 09:17:17 -0500 Signed-off-by: Kevin Puetz --- dlls/oleaut32/tests/typelib.c | 61 +++++++++++++++++++++++++++++++---- 1 file changed, 55 insertions(+), 6 deletions(-) diff --git a/dlls/oleaut32/tests/typelib.c b/dlls/oleaut32/tests/typelib.c index 9c341b4df8..5f1851aabf 100644 --- a/dlls/oleaut32/tests/typelib.c +++ b/dlls/oleaut32/tests/typelib.c @@ -4345,13 +4345,14 @@ static void test_dump_typelib(const WCHAR *name) ITypeLib *lib; int count; int i; + HREFTYPE hRefType = 0; OLE_CHECK(LoadTypeLib(name, &lib)); printf("/*** Autogenerated data. Do not edit, change the generator above instead. ***/\n"); count = ITypeLib_GetTypeInfoCount(lib); - for (i = 0; i < count; i++) + for (i = 0; i < count;) { TYPEATTR *attr; BSTR name; @@ -4363,6 +4364,12 @@ static void test_dump_typelib(const WCHAR *name) " \"%s\",\n", dump_string(name)); OLE_CHECK(ITypeLib_GetTypeInfo(lib, i, &info)); + if(hRefType) { + ITypeInfo *refInfo; + OLE_CHECK(ITypeInfo_GetRefTypeInfo(info, hRefType, &refInfo)); + ITypeInfo_Release(info); + info = refInfo; + } OLE_CHECK(ITypeInfo_GetTypeAttr(info, &attr)); printf(" \"%s\",\n", wine_dbgstr_guid(&attr->guid)); @@ -4446,6 +4453,14 @@ static void test_dump_typelib(const WCHAR *name) if (attr->cVars) printf(" },\n"); printf("},\n"); + if ((attr->typekind == TKIND_DISPATCH) && (attr->wTypeFlags & TYPEFLAG_FDUAL) + && SUCCEEDED(ITypeInfo_GetRefTypeOfImplType(info, -1, &hRefType))) { + /* next iteration dumps hRefType, the TKIND_INTERFACE reference underneath this [dual] TKIND_DISPATCH */ + } else { + ++i; /* move to the next item in lib */ + hRefType = 0; + } + ITypeInfo_ReleaseTypeAttr(info, attr); ITypeInfo_Release(info); SysFreeString(name); @@ -4805,6 +4820,27 @@ static const type_info info[] = { }, { /* vars */ }, }, +{ + "IDualIface", + "{b14b6bb5-904e-4ff9-b247-bd361f7aaedd}", + /*kind*/ TKIND_INTERFACE, /*flags*/ TYPEFLAG_FDISPATCHABLE|TYPEFLAG_FOLEAUTOMATION|TYPEFLAG_FDUAL, /*align*/ TYPE_ALIGNMENT(IDualIface*), /*size*/ sizeof(IDualIface*), + /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 8, /*#func*/ 1, /*#var*/ 0, + { /* funcs */ + { + /*id*/ 0x60020000, /*func*/ FUNC_PUREVIRTUAL, /*inv*/ INVOKE_FUNC, /*call*/ CC_STDCALL, + /*#param*/ 0, /*#opt*/ 0, /*vtbl*/ 7, /*#scodes*/ 0, /*flags*/ 0, + {VT_HRESULT, -1, PARAMFLAG_NONE}, /* ret */ + { /* params */ + {-1, 0, 0} + }, + { /* names */ + "Test", + NULL, + }, + }, + }, + { /* vars */ }, +}, { "ISimpleIface", "{ec5dfcd6-eeb0-4cd6-b51e-8030e1dac009}", @@ -5271,9 +5307,9 @@ static const type_info info[] = { static void test_dump_typelib(const WCHAR *name) { ITypeLib *typelib; - int ticount = ARRAY_SIZE(info); CUSTDATA cust_data; - int iface, func, var; + int iface = 0, func, var; + HREFTYPE hRefType = 0; VARIANT v; HRESULT hr; TLIBATTR *libattr; @@ -5286,10 +5322,8 @@ static void test_dump_typelib(const WCHAR *name) skip("ignoring VARDESC::oInst, (libattr->syskind expected %d got %d)\n", info_syskind, libattr->syskind); } - expect_eq(ITypeLib_GetTypeInfoCount(typelib), ticount, UINT, "%d"); - for (iface = 0; iface < ticount; iface++) + for (const type_info *ti = info; ti != info + ARRAY_SIZE(info); ++ti) { - const type_info *ti = &info[iface]; ITypeInfo2 *typeinfo2; ITypeInfo *typeinfo; TYPEATTR *typeattr; @@ -5298,6 +5332,12 @@ static void test_dump_typelib(const WCHAR *name) trace("Interface %s\n", ti->name); ole_check(ITypeLib_GetTypeInfo(typelib, iface, &typeinfo)); + if(hRefType) { + ITypeInfo *refInfo; + ole_check(ITypeInfo_GetRefTypeInfo(typeinfo, hRefType, &refInfo)); + ITypeInfo_Release(typeinfo); + typeinfo = refInfo; + } ole_check(ITypeLib_GetDocumentation(typelib, iface, &bstrIfName, NULL, &help_ctx, NULL)); expect_wstr_acpval(bstrIfName, ti->name); SysFreeString(bstrIfName); @@ -5438,11 +5478,20 @@ static void test_dump_typelib(const WCHAR *name) ITypeInfo_ReleaseVarDesc(typeinfo, desc); } + if ((typeattr->typekind == TKIND_DISPATCH) && (typeattr->wTypeFlags & TYPEFLAG_FDUAL) + && SUCCEEDED(ITypeInfo_GetRefTypeOfImplType(typeinfo, -1, &hRefType))) { + /* next iteration dumps hRefType, the TKIND_INTERFACE reference underneath this [dual] TKIND_DISPATCH */ + } else { + ++iface; /* move to the next item in typelib */ + hRefType = 0; + } + ITypeInfo_ReleaseTypeAttr(typeinfo, typeattr); ITypeInfo2_Release(typeinfo2); ITypeInfo_Release(typeinfo); } + expect_eq(ITypeLib_GetTypeInfoCount(typelib), iface, UINT, "%d"); ITypeLib_ReleaseTLibAttr(typelib, libattr); ITypeLib_Release(typelib); }