[PATCH v5 3/3] oleaut32: Match funcdesc using both memberid and invkind.

Huw Davies huw at codeweavers.com
Thu Jun 11 02:54:39 CDT 2020


From: Porot Mo <porotmjp at gmail.com>

Property access functions can share the same memberid.

Signed-off-by: Porot Mo <porotmjp at gmail.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
---
 dlls/oleaut32/tests/typelib.c |  3 ---
 dlls/oleaut32/typelib.c       | 15 ++++++++++++++-
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/dlls/oleaut32/tests/typelib.c b/dlls/oleaut32/tests/typelib.c
index 9f55cc41400..0e59db6ee7f 100644
--- a/dlls/oleaut32/tests/typelib.c
+++ b/dlls/oleaut32/tests/typelib.c
@@ -1050,11 +1050,9 @@ static void test_TypeInfo(void)
 
     /* correct memberid -- wrong invkind */
     hr = ITypeInfo_GetDllEntry(pTypeInfo, 0x60000000, INVOKE_FUNC, &bstrDllName, &bstrName, &ordinal);
-todo_wine
     ok(hr == TYPE_E_ELEMENTNOTFOUND, "ITypeInfo_GetDllEntry should have returned TYPE_E_ELEMENTNOTFOUND instead of 0x%08x\n", hr);
 
     hr = ITypeInfo_GetDllEntry(pTypeInfo, 0x60000000, INVOKE_PROPERTYPUTREF, &bstrDllName, &bstrName, &ordinal);
-todo_wine
     ok(hr == TYPE_E_ELEMENTNOTFOUND, "ITypeInfo_GetDllEntry should have returned TYPE_E_ELEMENTNOTFOUND instead of 0x%08x\n", hr);
 
     /* correct memberid -- correct invkind */
@@ -1069,7 +1067,6 @@ todo_wine
     ok_ole_success(hr, ITypeInfo_GetDllEntry);
     ok(!lstrcmpW(bstrDllName, wszTestDll), "got %s\n", wine_dbgstr_w(bstrDllName));
     ok(bstrName == NULL, "got %s\n", wine_dbgstr_w(bstrName));
-todo_wine
     ok(ordinal == 2, "got ordinal: %04x\n", ordinal);
     SysFreeString(bstrName);
 
diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c
index ab421fec90d..01bb16efbc4 100644
--- a/dlls/oleaut32/typelib.c
+++ b/dlls/oleaut32/typelib.c
@@ -1701,6 +1701,19 @@ static inline TLBFuncDesc *TLB_get_funcdesc_by_memberid(ITypeInfoImpl *typeinfo,
     return NULL;
 }
 
+static inline TLBFuncDesc *TLB_get_funcdesc_by_memberid_invkind(ITypeInfoImpl *typeinfo, MEMBERID memid, INVOKEKIND invkind)
+{
+    int i;
+
+    for (i = 0; i < typeinfo->typeattr.cFuncs; ++i)
+    {
+        if (typeinfo->funcdescs[i].funcdesc.memid == memid && typeinfo->funcdescs[i].funcdesc.invkind == invkind)
+            return &typeinfo->funcdescs[i];
+    }
+
+    return NULL;
+}
+
 static inline TLBVarDesc *TLB_get_vardesc_by_memberid(ITypeInfoImpl *typeinfo, MEMBERID memid)
 {
     int i;
@@ -7804,7 +7817,7 @@ static HRESULT WINAPI ITypeInfo_fnGetDllEntry( ITypeInfo2 *iface, MEMBERID memid
     if (This->typeattr.typekind != TKIND_MODULE)
         return TYPE_E_BADMODULEKIND;
 
-    pFDesc = TLB_get_funcdesc_by_memberid(This, memid);
+    pFDesc = TLB_get_funcdesc_by_memberid_invkind(This, memid, invKind);
     if (!pFDesc) return TYPE_E_ELEMENTNOTFOUND;
 
     dump_TypeInfo(This);
-- 
2.23.0




More information about the wine-devel mailing list