[PATCH v2 3/4] oleaut32: Handle coclasses in ITypeInfo_Invoke().

Zebediah Figura z.figura12 at gmail.com
Tue Nov 13 23:52:50 CST 2018


Based on a patch by Sebastian Lackner.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=19016
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/oleaut32/tests/tmarshal.c |  2 +-
 dlls/oleaut32/typelib.c        | 17 +++++++++++++++++
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/dlls/oleaut32/tests/tmarshal.c b/dlls/oleaut32/tests/tmarshal.c
index 4049d195e0..e1564d5a0b 100644
--- a/dlls/oleaut32/tests/tmarshal.c
+++ b/dlls/oleaut32/tests/tmarshal.c
@@ -2591,7 +2591,7 @@ static void test_typelibmarshal(void)
     dispparams.rgvarg = vararg;
     VariantInit(&varresult);
     hr = IDispatch_Invoke(pDispatch, DISPID_TM_COCLASS, &IID_NULL, LOCALE_NEUTRAL, DISPATCH_METHOD, &dispparams, &varresult, &excepinfo, NULL);
-    todo_wine ok_ole_success(hr, IDispatch_Invoke);
+    ok_ole_success(hr, IDispatch_Invoke);
     ok(excepinfo.wCode == 0x0 && excepinfo.scode == S_OK,
         "EXCEPINFO differs from expected: wCode = 0x%x, scode = 0x%08x\n",
         excepinfo.wCode, excepinfo.scode);
diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c
index 332fafd3f0..5eb34d032d 100644
--- a/dlls/oleaut32/typelib.c
+++ b/dlls/oleaut32/typelib.c
@@ -6572,6 +6572,7 @@ static HRESULT get_iface_guid(ITypeInfo *tinfo, HREFTYPE href, GUID *guid)
     ITypeInfo *tinfo2;
     TYPEATTR *tattr;
     HRESULT hres;
+    int flags, i;
 
     hres = ITypeInfo_GetRefTypeInfo(tinfo, href, &tinfo2);
     if(FAILED(hres))
@@ -6593,6 +6594,22 @@ static HRESULT get_iface_guid(ITypeInfo *tinfo, HREFTYPE href, GUID *guid)
         *guid = tattr->guid;
         break;
 
+    case TKIND_COCLASS:
+        for (i = 0; i < tattr->cImplTypes; i++)
+        {
+            ITypeInfo_GetImplTypeFlags(tinfo2, i, &flags);
+            if (flags & IMPLTYPEFLAG_FDEFAULT)
+                break;
+        }
+
+        if (i == tattr->cImplTypes)
+            i = 0;
+
+        hres = ITypeInfo_GetRefTypeOfImplType(tinfo2, i, &href);
+        if (SUCCEEDED(hres))
+            hres = get_iface_guid(tinfo2, href, guid);
+        break;
+
     default:
         ERR("Unexpected typekind %d\n", tattr->typekind);
         hres = E_UNEXPECTED;
-- 
2.19.1




More information about the wine-devel mailing list