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.
This commit is contained in:
Huw Davies 2004-12-02 19:58:07 +00:00 committed by Alexandre Julliard
parent 478f3e3049
commit 81768fe150
1 changed files with 9 additions and 2 deletions

View File

@ -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