[PATCH 05/13] oleaut32/tests: Include [dual] interface in test_dump_typelib.

Puetz Kevin A PuetzKevinA at JohnDeere.com
Thu Aug 6 23:10:36 CDT 2020


Signed-off-by: Kevin Puetz <PuetzKevinA at JohnDeere.com>
---
 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 ecd6bf09b8..2f23949c7d 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);
@@ -4804,6 +4819,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}",
@@ -5270,17 +5306,15 @@ 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;
 
     ole_check(LoadTypeLibEx(name, REGKIND_NONE, &typelib));
-    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;
@@ -5289,6 +5323,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);
@@ -5425,11 +5465,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_Release(typelib);
 }
 





More information about the wine-devel mailing list