From 81768fe150ea1d1afdb241bc40dbf879b15312d9 Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Thu, 2 Dec 2004 19:58:07 +0000 Subject: [PATCH] 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. --- dlls/oleaut32/typelib.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c index 964727e5f4a..5f2b2ebb9f5 100644 --- a/dlls/oleaut32/typelib.c +++ b/dlls/oleaut32/typelib.c @@ -4127,8 +4127,14 @@ static HRESULT WINAPI ITypeInfo_fnGetTypeAttr( ITypeInfo2 *iface, { 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_fnReleaseTypeAttr( ITypeInfo2 *iface, { ITypeInfoImpl *This = (ITypeInfoImpl *)iface; TRACE("(%p)->(%p)\n", This, pTypeAttr); + HeapFree(GetProcessHeap(), 0, pTypeAttr); } /* ITypeInfo::ReleaseFuncDesc