typelib: Fix typeattr for dual interfaces

Huw D M Davies h.davies1 at physics.ox.ac.uk
Thu Dec 2 09:51:26 CST 2004


        Huw Davies <huw at codeweavers.com>
        Allocate the TYPEATTR rather than copying it.
        For a dual interface the dispinterface's cfuncs should include
        the inherited functions, cbSizeVft should just be the size
        of IDispatch's vtbl and we should strip
        TYPEFLAG_FOLEAUTOMATION
-- 
Huw Davies
huw at codeweavers.com
Index: dlls/oleaut32/typelib.c
===================================================================
RCS file: /home/wine/wine/dlls/oleaut32/typelib.c,v
retrieving revision 1.128
diff -u -p -p -r1.128 typelib.c
--- dlls/oleaut32/typelib.c	22 Oct 2004 22:09:09 -0000	1.128
+++ dlls/oleaut32/typelib.c	2 Dec 2004 16:46:43 -0000
@@ -4127,8 +4127,14 @@ static HRESULT WINAPI ITypeInfo_fnGetTyp
 {
     ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
     TRACE("(%p)\n",This);
-    /* FIXME: must do a copy here */
-    *ppTypeAttr=&This->TypeAttr;
+    *ppTypeAttr = HeapAlloc(GetProcessHeap(), 0, sizeof(**ppTypeAttr));
+    memcpy(*ppTypeAttr, &This->TypeAttr, sizeof(**ppTypeAttr));
+    if((*ppTypeAttr)->typekind == TKIND_DISPATCH && (*ppTypeAttr)->wTypeFlags & TYPEFLAG_FDUAL) {
+        (*ppTypeAttr)->cFuncs = (*ppTypeAttr)->cbSizeVft / 4; /* This should include all the inherited
+                                                                 funcs */
+        (*ppTypeAttr)->cbSizeVft = 28; /* This is always the size of IDispatch's vtbl */
+        (*ppTypeAttr)->wTypeFlags &= ~TYPEFLAG_FOLEAUTOMATION;
+    }
     return S_OK;
 }
 
@@ -5176,6 +5182,7 @@ static void WINAPI ITypeInfo_fnReleaseTy
 {
     ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
     TRACE("(%p)->(%p)\n", This, pTypeAttr);
+    HeapFree(GetProcessHeap(), 0, pTypeAttr);
 }
 
 /* ITypeInfo::ReleaseFuncDesc



More information about the wine-patches mailing list