typelib: GetFuncIndexOfMemId

Huw D M Davies h.davies1 at physics.ox.ac.uk
Mon Dec 6 08:47:11 CST 2004


        Huw Davies <huw at codeweavers.com>
        GetFuncIndexOfMemId should respect invkind and return
        TYPE_E_ELEMENTNOTFOUND if the function cannot be found.
-- 
Huw Davies
huw at codeweavers.com
Index: dlls/oleaut32/typelib.c
===================================================================
RCS file: /home/wine/wine/dlls/oleaut32/typelib.c,v
retrieving revision 1.129
diff -u -p -p -r1.129 typelib.c
--- dlls/oleaut32/typelib.c	2 Dec 2004 19:58:07 -0000	1.129
+++ dlls/oleaut32/typelib.c	6 Dec 2004 15:39:08 -0000
@@ -5249,18 +5249,18 @@ static HRESULT WINAPI ITypeInfo2_fnGetFu
     TLBFuncDesc *pFuncInfo;
     int i;
     HRESULT result;
-    /* FIXME: should check for invKind??? */
-    for(i=0, pFuncInfo=This->funclist;pFuncInfo &&
-            memid != pFuncInfo->funcdesc.memid; i++, pFuncInfo=pFuncInfo->next);
-    if(pFuncInfo){
-        *pFuncIndex=i;
-        result= S_OK;
-    }else{
-        *pFuncIndex=0;
-        result=E_INVALIDARG;
-    }
+
+    for(i = 0, pFuncInfo = This->funclist; pFuncInfo; i++, pFuncInfo=pFuncInfo->next)
+        if(memid == pFuncInfo->funcdesc.memid && (invKind & pFuncInfo->funcdesc.invkind))
+            break;
+    if(pFuncInfo) {
+        *pFuncIndex = i;
+        result = S_OK;
+    } else
+        result = TYPE_E_ELEMENTNOTFOUND;
+
     TRACE("(%p) memid 0x%08lx invKind 0x%04x -> %s\n", This,
-          memid, invKind, SUCCEEDED(result)? "SUCCES":"FAILED");
+          memid, invKind, SUCCEEDED(result) ? "SUCCESS" : "FAILED");
     return result;
 }
 



More information about the wine-patches mailing list