typelib: Fix GetRefTypeOfImplType

Huw D M Davies h.davies1 at physics.ox.ac.uk
Mon Oct 17 09:41:10 CDT 2005


        Huw Davies <huw at codeweavers.com>
        When a dispinterface isn't dual, we should return
        TYPE_E_ELEMENTNOTFOUND when trying to get index -1.

-- 
Huw Davies
huw at codeweavers.com
Index: dlls/oleaut32/typelib.c
===================================================================
RCS file: /home/wine/wine/dlls/oleaut32/typelib.c,v
retrieving revision 1.170
diff -u -p -r1.170 typelib.c
--- dlls/oleaut32/typelib.c	21 Sep 2005 09:46:28 -0000	1.170
+++ dlls/oleaut32/typelib.c	17 Oct 2005 14:36:39 -0000
@@ -4338,7 +4338,8 @@ static HRESULT WINAPI ITypeInfo_fnGetRef
 	HREFTYPE  *pRefType)
 {
     ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
-    int(i);
+    int i;
+    HRESULT hr = S_OK;
     TLBImplType *pImpl = This->impltypelist;
 
     TRACE("(%p) index %d\n", This, index);
@@ -4358,8 +4359,7 @@ static HRESULT WINAPI ITypeInfo_fnGetRef
       }
       else
       {
-        if (!pImpl) return TYPE_E_ELEMENTNOTFOUND;
-        *pRefType = pImpl->hRef;
+        hr = TYPE_E_ELEMENTNOTFOUND;
       }
     }
     else
@@ -4370,15 +4370,21 @@ static HRESULT WINAPI ITypeInfo_fnGetRef
         pImpl = pImpl->next;
       }
 
-      if (!pImpl) return TYPE_E_ELEMENTNOTFOUND;
-
-      *pRefType = pImpl->hRef;
-
-      TRACE("-- 0x%08lx\n", pImpl->hRef );
+      if (pImpl)
+        *pRefType = pImpl->hRef;
+      else
+        hr = TYPE_E_ELEMENTNOTFOUND;
     }
 
-    return S_OK;
+    if(TRACE_ON(ole))
+    {
+        if(SUCCEEDED(hr))
+            TRACE("SUCCESS -- hRef = 0x%08lx\n", *pRefType );
+        else
+            TRACE("FAILURE -- hresult = 0x%08lx\n", hr);
+    }
 
+    return hr;
 }
 
 /* ITypeInfo::GetImplTypeFlags



More information about the wine-patches mailing list