From e90a17d20f1c70b4f3d22bce8cca84dba5c480e0 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Tue, 23 Aug 2016 21:53:06 +0300 Subject: [PATCH] oleaut32: Keep most of typeinfo attributes in TYPEATTR structure. Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/oleaut32/typelib.c | 539 +++++++++++++++++++--------------------- 1 file changed, 253 insertions(+), 286 deletions(-) diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c index 517e515af7b..6f87279c84c 100644 --- a/dlls/oleaut32/typelib.c +++ b/dlls/oleaut32/typelib.c @@ -1233,22 +1233,8 @@ typedef struct tagITypeInfoImpl BOOL needs_layout; TLBGuid *guid; - LCID lcid; - MEMBERID memidConstructor; - MEMBERID memidDestructor; - LPOLESTR lpstrSchema; - ULONG cbSizeInstance; - TYPEKIND typekind; - WORD cFuncs; - WORD cVars; - WORD cImplTypes; - WORD cbSizeVft; - WORD cbAlignment; - WORD wTypeFlags; - WORD wMajorVerNum; - WORD wMinorVerNum; + TYPEATTR typeattr; TYPEDESC *tdescAlias; - IDLDESC idldescType; ITypeLibImpl * pTypeLib; /* back pointer to typelib */ int index; /* index in this typelib; */ @@ -1575,15 +1561,15 @@ static void dump_TypeInfo(const ITypeInfoImpl * pty) TRACE("%p ref=%u\n", pty, pty->ref); TRACE("%s %s\n", debugstr_w(TLB_get_bstr(pty->Name)), debugstr_w(TLB_get_bstr(pty->DocString))); TRACE("attr:%s\n", debugstr_guid(TLB_get_guidref(pty->guid))); - TRACE("kind:%s\n", typekind_desc[pty->typekind]); - TRACE("fct:%u var:%u impl:%u\n", pty->cFuncs, pty->cVars, pty->cImplTypes); - TRACE("wTypeFlags: 0x%04x\n", pty->wTypeFlags); + TRACE("kind:%s\n", typekind_desc[pty->typeattr.typekind]); + TRACE("fct:%u var:%u impl:%u\n", pty->typeattr.cFuncs, pty->typeattr.cVars, pty->typeattr.cImplTypes); + TRACE("wTypeFlags: 0x%04x\n", pty->typeattr.wTypeFlags); TRACE("parent tlb:%p index in TLB:%u\n",pty->pTypeLib, pty->index); - if (pty->typekind == TKIND_MODULE) TRACE("dllname:%s\n", debugstr_w(TLB_get_bstr(pty->DllName))); + if (pty->typeattr.typekind == TKIND_MODULE) TRACE("dllname:%s\n", debugstr_w(TLB_get_bstr(pty->DllName))); if (TRACE_ON(ole)) - dump_TLBFuncDesc(pty->funcdescs, pty->cFuncs); - dump_TLBVarDesc(pty->vardescs, pty->cVars); - dump_TLBImplType(pty->impltypes, pty->cImplTypes); + dump_TLBFuncDesc(pty->funcdescs, pty->typeattr.cFuncs); + dump_TLBVarDesc(pty->vardescs, pty->typeattr.cVars); + dump_TLBImplType(pty->impltypes, pty->typeattr.cImplTypes); } static void dump_VARDESC(const VARDESC *v) @@ -2641,7 +2627,7 @@ static void MSFT_DoImplTypes(TLBContext *pcx, ITypeInfoImpl *pTI, int count, * and some structures, and fix the alignment */ static void TLB_fix_32on64_typeinfo(ITypeInfoImpl *info) { - if(info->typekind == TKIND_ALIAS){ + if(info->typeattr.typekind == TKIND_ALIAS){ switch(info->tdescAlias->vt){ case VT_BSTR: case VT_DISPATCH: @@ -2650,28 +2636,28 @@ static void TLB_fix_32on64_typeinfo(ITypeInfoImpl *info) case VT_SAFEARRAY: case VT_LPSTR: case VT_LPWSTR: - info->cbSizeInstance = sizeof(void*); - info->cbAlignment = sizeof(void*); + info->typeattr.cbSizeInstance = sizeof(void*); + info->typeattr.cbAlignment = sizeof(void*); break; case VT_CARRAY: case VT_USERDEFINED: - TLB_size_instance(info, SYS_WIN64, info->tdescAlias, &info->cbSizeInstance, &info->cbAlignment); + TLB_size_instance(info, SYS_WIN64, info->tdescAlias, &info->typeattr.cbSizeInstance, &info->typeattr.cbAlignment); break; case VT_VARIANT: - info->cbSizeInstance = sizeof(VARIANT); - info->cbAlignment = 8; + info->typeattr.cbSizeInstance = sizeof(VARIANT); + info->typeattr.cbAlignment = 8; default: - if(info->cbSizeInstance < sizeof(void*)) - info->cbAlignment = info->cbSizeInstance; + if(info->typeattr.cbSizeInstance < sizeof(void*)) + info->typeattr.cbAlignment = info->typeattr.cbSizeInstance; else - info->cbAlignment = sizeof(void*); + info->typeattr.cbAlignment = sizeof(void*); break; } - }else if(info->typekind == TKIND_INTERFACE || - info->typekind == TKIND_DISPATCH || - info->typekind == TKIND_COCLASS){ - info->cbSizeInstance = sizeof(void*); - info->cbAlignment = sizeof(void*); + }else if(info->typeattr.typekind == TKIND_INTERFACE || + info->typeattr.typekind == TKIND_DISPATCH || + info->typeattr.typekind == TKIND_COCLASS){ + info->typeattr.cbSizeInstance = sizeof(void*); + info->typeattr.cbAlignment = sizeof(void*); } } #endif @@ -2698,19 +2684,19 @@ static ITypeInfoImpl * MSFT_DoTypeInfo( ptiRet->index=count; ptiRet->guid = MSFT_ReadGuid(tiBase.posguid, pcx); - ptiRet->lcid=pLibInfo->set_lcid; /* FIXME: correct? */ - ptiRet->lpstrSchema=NULL; /* reserved */ - ptiRet->cbSizeInstance=tiBase.size; - ptiRet->typekind=tiBase.typekind & 0xF; - ptiRet->cFuncs=LOWORD(tiBase.cElement); - ptiRet->cVars=HIWORD(tiBase.cElement); - ptiRet->cbAlignment=(tiBase.typekind >> 11 )& 0x1F; /* there are more flags there */ - ptiRet->wTypeFlags=tiBase.flags; - ptiRet->wMajorVerNum=LOWORD(tiBase.version); - ptiRet->wMinorVerNum=HIWORD(tiBase.version); - ptiRet->cImplTypes=tiBase.cImplTypes; - ptiRet->cbSizeVft=tiBase.cbSizeVft; /* FIXME: this is only the non inherited part */ - if(ptiRet->typekind == TKIND_ALIAS){ + ptiRet->typeattr.lcid = pLibInfo->set_lcid; /* FIXME: correct? */ + ptiRet->typeattr.lpstrSchema = NULL; /* reserved */ + ptiRet->typeattr.cbSizeInstance = tiBase.size; + ptiRet->typeattr.typekind = tiBase.typekind & 0xF; + ptiRet->typeattr.cFuncs = LOWORD(tiBase.cElement); + ptiRet->typeattr.cVars = HIWORD(tiBase.cElement); + ptiRet->typeattr.cbAlignment = (tiBase.typekind >> 11 )& 0x1F; /* there are more flags there */ + ptiRet->typeattr.wTypeFlags = tiBase.flags; + ptiRet->typeattr.wMajorVerNum = LOWORD(tiBase.version); + ptiRet->typeattr.wMinorVerNum = HIWORD(tiBase.version); + ptiRet->typeattr.cImplTypes = tiBase.cImplTypes; + ptiRet->typeattr.cbSizeVft = tiBase.cbSizeVft; /* FIXME: this is only the non inherited part */ + if (ptiRet->typeattr.typekind == TKIND_ALIAS) { TYPEDESC tmp; MSFT_GetTdesc(pcx, tiBase.datatype1, &tmp); ptiRet->tdescAlias = heap_alloc(TLB_SizeTypeDesc(&tmp, TRUE)); @@ -2729,27 +2715,27 @@ static ITypeInfoImpl * MSFT_DoTypeInfo( ptiRet->dwHelpStringContext=tiBase.helpstringcontext; ptiRet->dwHelpContext=tiBase.helpcontext; - if (ptiRet->typekind == TKIND_MODULE) + if (ptiRet->typeattr.typekind == TKIND_MODULE) ptiRet->DllName = MSFT_ReadString(pcx, tiBase.datatype1); /* note: InfoType's Help file and HelpStringDll come from the containing * library. Further HelpString and Docstring appear to be the same thing :( */ /* functions */ - if(ptiRet->cFuncs >0 ) - MSFT_DoFuncs(pcx, ptiRet, ptiRet->cFuncs, - ptiRet->cVars, + if(ptiRet->typeattr.cFuncs >0 ) + MSFT_DoFuncs(pcx, ptiRet, ptiRet->typeattr.cFuncs, + ptiRet->typeattr.cVars, tiBase.memoffset, &ptiRet->funcdescs); /* variables */ - if(ptiRet->cVars >0 ) - MSFT_DoVars(pcx, ptiRet, ptiRet->cFuncs, - ptiRet->cVars, + if(ptiRet->typeattr.cVars >0 ) + MSFT_DoVars(pcx, ptiRet, ptiRet->typeattr.cFuncs, + ptiRet->typeattr.cVars, tiBase.memoffset, &ptiRet->vardescs); - if(ptiRet->cImplTypes >0 ) { - switch(ptiRet->typekind) + if(ptiRet->typeattr.cImplTypes >0 ) { + switch(ptiRet->typeattr.typekind) { case TKIND_COCLASS: - MSFT_DoImplTypes(pcx, ptiRet, ptiRet->cImplTypes, + MSFT_DoImplTypes(pcx, ptiRet, ptiRet->typeattr.cImplTypes, tiBase.datatype1); break; case TKIND_DISPATCH: @@ -2776,7 +2762,7 @@ static ITypeInfoImpl * MSFT_DoTypeInfo( TRACE_(typelib)("%s guid: %s kind:%s\n", debugstr_w(TLB_get_bstr(ptiRet->Name)), debugstr_guid(TLB_get_guidref(ptiRet->guid)), - typekind_desc[ptiRet->typekind]); + typekind_desc[ptiRet->typeattr.typekind]); if (TRACE_ON(typelib)) dump_TypeInfo(ptiRet); @@ -4023,14 +4009,14 @@ static char *SLTG_DoImpls(char *pBlk, ITypeInfoImpl *pTI, info = (SLTG_ImplInfo*)pBlk; while(1){ - pTI->cImplTypes++; + pTI->typeattr.cImplTypes++; if(info->next == 0xffff) break; info = (SLTG_ImplInfo*)(pBlk + info->next); } info = (SLTG_ImplInfo*)pBlk; - pTI->impltypes = TLBImplType_Alloc(pTI->cImplTypes); + pTI->impltypes = TLBImplType_Alloc(pTI->typeattr.cImplTypes); pImplType = pTI->impltypes; while(1) { sltg_get_typelib_ref(ref_lookup, info->ref, &pImplType->hRef); @@ -4155,7 +4141,7 @@ static void SLTG_DoVars(char *pBlk, char *pFirstItem, ITypeInfoImpl *pTI, unsign prevName = pVarDesc->Name; } - pTI->cVars = cVars; + pTI->typeattr.cVars = cVars; } static void SLTG_DoFuncs(char *pBlk, char *pFirstItem, ITypeInfoImpl *pTI, @@ -4262,7 +4248,7 @@ static void SLTG_DoFuncs(char *pBlk, char *pFirstItem, ITypeInfoImpl *pTI, } } } - pTI->cFuncs = cFuncs; + pTI->typeattr.cFuncs = cFuncs; } static void SLTG_ProcessCoClass(char *pBlk, ITypeInfoImpl *pTI, @@ -4310,7 +4296,7 @@ static void SLTG_ProcessInterface(char *pBlk, ITypeInfoImpl *pTI, heap_free(ref_lookup); if (TRACE_ON(typelib)) - dump_TLBFuncDesc(pTI->funcdescs, pTI->cFuncs); + dump_TLBFuncDesc(pTI->funcdescs, pTI->typeattr.cFuncs); } static void SLTG_ProcessRecord(char *pBlk, ITypeInfoImpl *pTI, @@ -4369,11 +4355,11 @@ static void SLTG_ProcessDispatch(char *pBlk, ITypeInfoImpl *pTI, /* this is necessary to cope with MSFT typelibs that set cFuncs to the number * of dispinterface functions including the IDispatch ones, so * ITypeInfo::GetFuncDesc takes the real value for cFuncs from cbSizeVft */ - pTI->cbSizeVft = pTI->cFuncs * pTI->pTypeLib->ptr_size; + pTI->typeattr.cbSizeVft = pTI->typeattr.cFuncs * pTI->pTypeLib->ptr_size; heap_free(ref_lookup); if (TRACE_ON(typelib)) - dump_TLBFuncDesc(pTI->funcdescs, pTI->cFuncs); + dump_TLBFuncDesc(pTI->funcdescs, pTI->typeattr.cFuncs); } static void SLTG_ProcessEnum(char *pBlk, ITypeInfoImpl *pTI, @@ -4614,14 +4600,14 @@ static ITypeLib2* ITypeLib2_Constructor_SLTG(LPVOID pLib, DWORD dwTLBLength) (*ppTypeInfoImpl)->Name = SLTG_ReadName(pNameTable, pOtherTypeInfoBlks[i].name_offs, pTypeLibImpl); (*ppTypeInfoImpl)->dwHelpContext = pOtherTypeInfoBlks[i].helpcontext; (*ppTypeInfoImpl)->guid = TLB_append_guid(&pTypeLibImpl->guid_list, &pOtherTypeInfoBlks[i].uuid, 2); - (*ppTypeInfoImpl)->typekind = pTIHeader->typekind; - (*ppTypeInfoImpl)->wMajorVerNum = pTIHeader->major_version; - (*ppTypeInfoImpl)->wMinorVerNum = pTIHeader->minor_version; - (*ppTypeInfoImpl)->wTypeFlags = + (*ppTypeInfoImpl)->typeattr.typekind = pTIHeader->typekind; + (*ppTypeInfoImpl)->typeattr.wMajorVerNum = pTIHeader->major_version; + (*ppTypeInfoImpl)->typeattr.wMinorVerNum = pTIHeader->minor_version; + (*ppTypeInfoImpl)->typeattr.wTypeFlags = (pTIHeader->typeflags1 >> 3) | (pTIHeader->typeflags2 << 5); - if((*ppTypeInfoImpl)->wTypeFlags & TYPEFLAG_FDUAL) - (*ppTypeInfoImpl)->typekind = TKIND_DISPATCH; + if((*ppTypeInfoImpl)->typeattr.wTypeFlags & TYPEFLAG_FDUAL) + (*ppTypeInfoImpl)->typeattr.typekind = TKIND_DISPATCH; if((pTIHeader->typeflags1 & 7) != 2) FIXME_(typelib)("typeflags1 = %02x\n", pTIHeader->typeflags1); @@ -4632,15 +4618,15 @@ static ITypeLib2* ITypeLib2_Constructor_SLTG(LPVOID pLib, DWORD dwTLBLength) debugstr_w(TLB_get_bstr((*ppTypeInfoImpl)->Name)), typekind_desc[pTIHeader->typekind], debugstr_guid(TLB_get_guidref((*ppTypeInfoImpl)->guid)), - (*ppTypeInfoImpl)->wTypeFlags); + (*ppTypeInfoImpl)->typeattr.wTypeFlags); pMemHeader = (SLTG_MemberHeader*)((char *)pBlk + pTIHeader->elem_table); pTITail = (SLTG_TypeInfoTail*)((char *)(pMemHeader + 1) + pMemHeader->cbExtra); - (*ppTypeInfoImpl)->cbAlignment = pTITail->cbAlignment; - (*ppTypeInfoImpl)->cbSizeInstance = pTITail->cbSizeInstance; - (*ppTypeInfoImpl)->cbSizeVft = pTITail->cbSizeVft; + (*ppTypeInfoImpl)->typeattr.cbAlignment = pTITail->cbAlignment; + (*ppTypeInfoImpl)->typeattr.cbSizeInstance = pTITail->cbSizeInstance; + (*ppTypeInfoImpl)->typeattr.cbSizeVft = pTITail->cbSizeVft; switch(pTIHeader->typekind) { case TKIND_ENUM: @@ -4890,7 +4876,7 @@ static HRESULT WINAPI ITypeLib2_fnGetTypeInfoType( if(index >= This->TypeInfoCount) return TYPE_E_ELEMENTNOTFOUND; - *pTKind = This->typeinfos[index]->typekind; + *pTKind = This->typeinfos[index]->typeattr.typekind; return S_OK; } @@ -5082,7 +5068,7 @@ static HRESULT WINAPI ITypeLib2_fnIsName( for(tic = 0; tic < This->TypeInfoCount; ++tic){ ITypeInfoImpl *pTInfo = This->typeinfos[tic]; if(!TLB_str_memcmp(szNameBuf, pTInfo->Name, nNameBufLen)) goto ITypeLib2_fnIsName_exit; - for(fdc = 0; fdc < pTInfo->cFuncs; ++fdc) { + for(fdc = 0; fdc < pTInfo->typeattr.cFuncs; ++fdc) { TLBFuncDesc *pFInfo = &pTInfo->funcdescs[fdc]; int pc; if(!TLB_str_memcmp(szNameBuf, pFInfo->Name, nNameBufLen)) goto ITypeLib2_fnIsName_exit; @@ -5091,7 +5077,7 @@ static HRESULT WINAPI ITypeLib2_fnIsName( goto ITypeLib2_fnIsName_exit; } } - for(vrc = 0; vrc < pTInfo->cVars; ++vrc){ + for(vrc = 0; vrc < pTInfo->typeattr.cVars; ++vrc){ TLBVarDesc *pVInfo = &pTInfo->vardescs[vrc]; if(!TLB_str_memcmp(szNameBuf, pVInfo->Name, nNameBufLen)) goto ITypeLib2_fnIsName_exit; } @@ -5141,7 +5127,7 @@ static HRESULT WINAPI ITypeLib2_fnFindName( goto ITypeLib2_fnFindName_exit; } - for(fdc = 0; fdc < pTInfo->cFuncs; ++fdc) { + for(fdc = 0; fdc < pTInfo->typeattr.cFuncs; ++fdc) { TLBFuncDesc *func = &pTInfo->funcdescs[fdc]; if(!TLB_str_memcmp(name, func->Name, len)) { @@ -5150,7 +5136,7 @@ static HRESULT WINAPI ITypeLib2_fnFindName( } } - var = TLB_get_vardesc_by_name(pTInfo->vardescs, pTInfo->cVars, name); + var = TLB_get_vardesc_by_name(pTInfo->vardescs, pTInfo->typeattr.cVars, name); if (var) { memid[count] = var->vardesc.memid; goto ITypeLib2_fnFindName_exit; @@ -5402,8 +5388,8 @@ static HRESULT WINAPI ITypeLibComp_fnBind( /* FIXME: check wFlags here? */ /* FIXME: we should use a hash table to look this info up using lHash * instead of an O(n) search */ - if ((pTypeInfo->typekind == TKIND_ENUM) || - (pTypeInfo->typekind == TKIND_MODULE)) + if ((pTypeInfo->typeattr.typekind == TKIND_ENUM) || + (pTypeInfo->typeattr.typekind == TKIND_MODULE)) { if (pTypeInfo->Name && !strcmpW(pTypeInfo->Name->str, szName)) { @@ -5415,8 +5401,8 @@ static HRESULT WINAPI ITypeLibComp_fnBind( } } - if ((pTypeInfo->typekind == TKIND_MODULE) || - (pTypeInfo->typekind == TKIND_ENUM)) + if ((pTypeInfo->typeattr.typekind == TKIND_MODULE) || + (pTypeInfo->typeattr.typekind == TKIND_ENUM)) { ITypeComp *pSubTypeComp = &pTypeInfo->ITypeComp_iface; HRESULT hr; @@ -5431,8 +5417,8 @@ static HRESULT WINAPI ITypeLibComp_fnBind( typemismatch = TRUE; } - if ((pTypeInfo->typekind == TKIND_COCLASS) && - (pTypeInfo->wTypeFlags & TYPEFLAG_FAPPOBJECT)) + if ((pTypeInfo->typeattr.typekind == TKIND_COCLASS) && + (pTypeInfo->typeattr.wTypeFlags & TYPEFLAG_FAPPOBJECT)) { ITypeComp *pSubTypeComp = &pTypeInfo->ITypeComp_iface; HRESULT hr; @@ -5569,8 +5555,8 @@ static ITypeInfoImpl* ITypeInfoImpl_Constructor(void) pTypeInfoImpl->ICreateTypeInfo2_iface.lpVtbl = &CreateTypeInfo2Vtbl; pTypeInfoImpl->ref = 0; pTypeInfoImpl->hreftype = -1; - pTypeInfoImpl->memidConstructor = MEMBERID_NIL; - pTypeInfoImpl->memidDestructor = MEMBERID_NIL; + pTypeInfoImpl->typeattr.memidConstructor = MEMBERID_NIL; + pTypeInfoImpl->typeattr.memidDestructor = MEMBERID_NIL; pTypeInfoImpl->pcustdata_list = &pTypeInfoImpl->custdata_list; list_init(pTypeInfoImpl->pcustdata_list); } @@ -5628,7 +5614,7 @@ static void ITypeInfoImpl_Destroy(ITypeInfoImpl *This) TRACE("destroying ITypeInfo(%p)\n",This); - for (i = 0; i < This->cFuncs; ++i) + for (i = 0; i < This->typeattr.cFuncs; ++i) { int j; TLBFuncDesc *pFInfo = &This->funcdescs[i]; @@ -5645,7 +5631,7 @@ static void ITypeInfoImpl_Destroy(ITypeInfoImpl *This) } heap_free(This->funcdescs); - for(i = 0; i < This->cVars; ++i) + for(i = 0; i < This->typeattr.cVars; ++i) { TLBVarDesc *pVInfo = &This->vardescs[i]; if (pVInfo->vardesc_create) { @@ -5659,7 +5645,7 @@ static void ITypeInfoImpl_Destroy(ITypeInfoImpl *This) heap_free(This->vardescs); if(This->impltypes){ - for (i = 0; i < This->cImplTypes; ++i){ + for (i = 0; i < This->typeattr.cImplTypes; ++i){ TLBImplType *pImpl = &This->impltypes[i]; TLB_FreeCustData(&pImpl->custdata_list); } @@ -5707,37 +5693,18 @@ static HRESULT WINAPI ITypeInfo_fnGetTypeAttr( ITypeInfo2 *iface, TRACE("(%p)\n",This); size = sizeof(**ppTypeAttr); - if (This->typekind == TKIND_ALIAS && This->tdescAlias) + if (This->typeattr.typekind == TKIND_ALIAS && This->tdescAlias) size += TLB_SizeTypeDesc(This->tdescAlias, FALSE); *ppTypeAttr = heap_alloc(size); if (!*ppTypeAttr) return E_OUTOFMEMORY; + **ppTypeAttr = This->typeattr; (*ppTypeAttr)->guid = *TLB_get_guid_null(This->guid); - (*ppTypeAttr)->lcid = This->lcid; - (*ppTypeAttr)->memidConstructor = This->memidConstructor; - (*ppTypeAttr)->memidDestructor = This->memidDestructor; - (*ppTypeAttr)->lpstrSchema = This->lpstrSchema; - (*ppTypeAttr)->cbSizeInstance = This->cbSizeInstance; - (*ppTypeAttr)->typekind = This->typekind; - (*ppTypeAttr)->cFuncs = This->cFuncs; - (*ppTypeAttr)->cVars = This->cVars; - (*ppTypeAttr)->cImplTypes = This->cImplTypes; - (*ppTypeAttr)->cbSizeVft = This->cbSizeVft; - (*ppTypeAttr)->cbAlignment = This->cbAlignment; - (*ppTypeAttr)->wTypeFlags = This->wTypeFlags; - (*ppTypeAttr)->wMajorVerNum = This->wMajorVerNum; - (*ppTypeAttr)->wMinorVerNum = This->wMinorVerNum; - (*ppTypeAttr)->idldescType = This->idldescType; if (This->tdescAlias) - TLB_CopyTypeDesc(&(*ppTypeAttr)->tdescAlias, - This->tdescAlias, *ppTypeAttr + 1); - else{ - (*ppTypeAttr)->tdescAlias.vt = VT_EMPTY; - (*ppTypeAttr)->tdescAlias.u.lptdesc = NULL; - } + TLB_CopyTypeDesc(&(*ppTypeAttr)->tdescAlias, This->tdescAlias, *ppTypeAttr + 1); if((*ppTypeAttr)->typekind == TKIND_DISPATCH) { /* This should include all the inherited funcs */ @@ -5931,7 +5898,7 @@ HRESULT ITypeInfoImpl_GetInternalFuncDesc( ITypeInfo *iface, UINT index, const F { ITypeInfoImpl *This = impl_from_ITypeInfo(iface); - if (index >= This->cFuncs) + if (index >= This->typeattr.cFuncs) return TYPE_E_ELEMENTNOTFOUND; *ppFuncDesc = &This->funcdescs[index].funcdesc; @@ -5973,7 +5940,7 @@ static HRESULT ITypeInfoImpl_GetInternalDispatchFuncDesc( ITypeInfo *iface, } if (funcs) - *funcs = implemented_funcs + This->cFuncs; + *funcs = implemented_funcs + This->typeattr.cFuncs; else *hrefoffset = 0; @@ -6036,7 +6003,7 @@ static HRESULT WINAPI ITypeInfo_fnGetFuncDesc( ITypeInfo2 *iface, UINT index, if (This->needs_layout) ICreateTypeInfo2_LayOut(&This->ICreateTypeInfo2_iface); - if (This->typekind == TKIND_DISPATCH) + if (This->typeattr.typekind == TKIND_DISPATCH) hr = ITypeInfoImpl_GetInternalDispatchFuncDesc((ITypeInfo *)iface, index, &internal_funcdesc, NULL, &hrefoffset); @@ -6052,9 +6019,9 @@ static HRESULT WINAPI ITypeInfo_fnGetFuncDesc( ITypeInfo2 *iface, UINT index, hr = TLB_AllocAndInitFuncDesc( internal_funcdesc, ppFuncDesc, - This->typekind == TKIND_DISPATCH); + This->typeattr.typekind == TKIND_DISPATCH); - if ((This->typekind == TKIND_DISPATCH) && hrefoffset) + if ((This->typeattr.typekind == TKIND_DISPATCH) && hrefoffset) ITypeInfoImpl_FuncDescAddHrefOffset(*ppFuncDesc, hrefoffset); TRACE("-- 0x%08x\n", hr); @@ -6127,7 +6094,7 @@ static HRESULT WINAPI ITypeInfo_fnGetVarDesc( ITypeInfo2 *iface, UINT index, TRACE("(%p) index %d\n", This, index); - if(index >= This->cVars) + if(index >= This->typeattr.cVars) return TYPE_E_ELEMENTNOTFOUND; if (This->needs_layout) @@ -6156,7 +6123,7 @@ static HRESULT WINAPI ITypeInfo_fnGetNames( ITypeInfo2 *iface, MEMBERID memid, *pcNames = 0; - pFDesc = TLB_get_funcdesc_by_memberid(This->funcdescs, This->cFuncs, memid); + pFDesc = TLB_get_funcdesc_by_memberid(This->funcdescs, This->typeattr.cFuncs, memid); if(pFDesc) { if(!cMaxNames || !pFDesc->Name) @@ -6174,7 +6141,7 @@ static HRESULT WINAPI ITypeInfo_fnGetNames( ITypeInfo2 *iface, MEMBERID memid, return S_OK; } - pVDesc = TLB_get_vardesc_by_memberid(This->vardescs, This->cVars, memid); + pVDesc = TLB_get_vardesc_by_memberid(This->vardescs, This->typeattr.cVars, memid); if(pVDesc) { *rgBstrNames=SysAllocString(TLB_get_bstr(pVDesc->Name)); @@ -6183,7 +6150,7 @@ static HRESULT WINAPI ITypeInfo_fnGetNames( ITypeInfo2 *iface, MEMBERID memid, else { if(This->impltypes && - (This->typekind==TKIND_INTERFACE || This->typekind==TKIND_DISPATCH)) { + (This->typeattr.typekind == TKIND_INTERFACE || This->typeattr.typekind == TKIND_DISPATCH)) { /* recursive search */ ITypeInfo *pTInfo; HRESULT result; @@ -6232,7 +6199,7 @@ static HRESULT WINAPI ITypeInfo_fnGetRefTypeOfImplType( retrieve the associated TKIND_INTERFACE handle for the current TKIND_DISPATCH */ - if (This->wTypeFlags & TYPEFLAG_FDUAL) + if (This->typeattr.wTypeFlags & TYPEFLAG_FDUAL) { *pRefType = -2; } @@ -6241,18 +6208,18 @@ static HRESULT WINAPI ITypeInfo_fnGetRefTypeOfImplType( hr = TYPE_E_ELEMENTNOTFOUND; } } - else if(index == 0 && This->typekind == TKIND_DISPATCH) + else if(index == 0 && This->typeattr.typekind == TKIND_DISPATCH) { /* All TKIND_DISPATCHs are made to look like they inherit from IDispatch */ *pRefType = This->pTypeLib->dispatch_href; } else { - if(index >= This->cImplTypes) + if(index >= This->typeattr.cImplTypes) hr = TYPE_E_ELEMENTNOTFOUND; else{ *pRefType = This->impltypes[index].hRef; - if(This->typekind == TKIND_INTERFACE) + if (This->typeattr.typekind == TKIND_INTERFACE) *pRefType |= 0x2; } } @@ -6283,12 +6250,12 @@ static HRESULT WINAPI ITypeInfo_fnGetImplTypeFlags( ITypeInfo2 *iface, if(!pImplTypeFlags) return E_INVALIDARG; - if(This->typekind == TKIND_DISPATCH && index == 0){ + if(This->typeattr.typekind == TKIND_DISPATCH && index == 0){ *pImplTypeFlags = 0; return S_OK; } - if(index >= This->cImplTypes) + if(index >= This->typeattr.cImplTypes) return TYPE_E_ELEMENTNOTFOUND; *pImplTypeFlags = This->impltypes[index].implflags; @@ -6315,7 +6282,7 @@ static HRESULT WINAPI ITypeInfo_fnGetIDsOfNames( ITypeInfo2 *iface, for (i = 0; i < cNames; i++) pMemId[i] = MEMBERID_NIL; - for (fdc = 0; fdc < This->cFuncs; ++fdc) { + for (fdc = 0; fdc < This->typeattr.cFuncs; ++fdc) { int j; const TLBFuncDesc *pFDesc = &This->funcdescs[fdc]; if(!lstrcmpiW(*rgszNames, TLB_get_bstr(pFDesc->Name))) { @@ -6333,7 +6300,7 @@ static HRESULT WINAPI ITypeInfo_fnGetIDsOfNames( ITypeInfo2 *iface, return ret; } } - pVDesc = TLB_get_vardesc_by_name(This->vardescs, This->cVars, *rgszNames); + pVDesc = TLB_get_vardesc_by_name(This->vardescs, This->typeattr.cVars, *rgszNames); if(pVDesc){ if(cNames) *pMemId = pVDesc->vardesc.memid; @@ -6911,7 +6878,7 @@ static HRESULT WINAPI ITypeInfo_fnInvoke( This,pIUnk,memid,wFlags,pDispParams,pVarResult,pExcepInfo,pArgErr ); - if( This->wTypeFlags & TYPEFLAG_FRESTRICTED ) + if( This->typeattr.wTypeFlags & TYPEFLAG_FRESTRICTED ) return DISP_E_MEMBERNOTFOUND; if (!pDispParams) @@ -6931,7 +6898,7 @@ static HRESULT WINAPI ITypeInfo_fnInvoke( /* we do this instead of using GetFuncDesc since it will return a fake * FUNCDESC for dispinterfaces and we want the real function description */ - for (fdc = 0; fdc < This->cFuncs; ++fdc){ + for (fdc = 0; fdc < This->typeattr.cFuncs; ++fdc){ pFuncInfo = &This->funcdescs[fdc]; if ((memid == pFuncInfo->funcdesc.memid) && (wFlags & pFuncInfo->funcdesc.invkind) && @@ -6939,7 +6906,7 @@ static HRESULT WINAPI ITypeInfo_fnInvoke( break; } - if (fdc < This->cFuncs) { + if (fdc < This->typeattr.cFuncs) { const FUNCDESC *func_desc = &pFuncInfo->funcdesc; if (TRACE_ON(ole)) @@ -7444,7 +7411,7 @@ static HRESULT WINAPI ITypeInfo_fnGetDocumentation( ITypeInfo2 *iface, *pBstrHelpFile=SysAllocString(TLB_get_bstr(This->pTypeLib->HelpFile)); return S_OK; }else {/* for a member */ - pFDesc = TLB_get_funcdesc_by_memberid(This->funcdescs, This->cFuncs, memid); + pFDesc = TLB_get_funcdesc_by_memberid(This->funcdescs, This->typeattr.cFuncs, memid); if(pFDesc){ if(pBstrName) *pBstrName = SysAllocString(TLB_get_bstr(pFDesc->Name)); @@ -7456,7 +7423,7 @@ static HRESULT WINAPI ITypeInfo_fnGetDocumentation( ITypeInfo2 *iface, *pBstrHelpFile = SysAllocString(TLB_get_bstr(This->pTypeLib->HelpFile)); return S_OK; } - pVDesc = TLB_get_vardesc_by_memberid(This->vardescs, This->cVars, memid); + pVDesc = TLB_get_vardesc_by_memberid(This->vardescs, This->typeattr.cVars, memid); if(pVDesc){ if(pBstrName) *pBstrName = SysAllocString(TLB_get_bstr(pVDesc->Name)); @@ -7471,7 +7438,7 @@ static HRESULT WINAPI ITypeInfo_fnGetDocumentation( ITypeInfo2 *iface, } if(This->impltypes && - (This->typekind==TKIND_INTERFACE || This->typekind==TKIND_DISPATCH)) { + (This->typeattr.typekind == TKIND_INTERFACE || This->typeattr.typekind == TKIND_DISPATCH)) { /* recursive search */ ITypeInfo *pTInfo; HRESULT result; @@ -7507,10 +7474,10 @@ static HRESULT WINAPI ITypeInfo_fnGetDllEntry( ITypeInfo2 *iface, MEMBERID memid if (pBstrName) *pBstrName = NULL; if (pwOrdinal) *pwOrdinal = 0; - if (This->typekind != TKIND_MODULE) + if (This->typeattr.typekind != TKIND_MODULE) return TYPE_E_BADMODULEKIND; - pFDesc = TLB_get_funcdesc_by_memberid(This->funcdescs, This->cFuncs, memid); + pFDesc = TLB_get_funcdesc_by_memberid(This->funcdescs, This->typeattr.cFuncs, memid); if(pFDesc){ dump_TypeInfo(This); if (TRACE_ON(ole)) @@ -7625,9 +7592,9 @@ static HRESULT WINAPI ITypeInfo_fnGetRefTypeInfo( if ((INT)hRefType < 0) { ITypeInfoImpl *pTypeInfoImpl; - if (!(This->wTypeFlags & TYPEFLAG_FDUAL) || - !(This->typekind == TKIND_INTERFACE || - This->typekind == TKIND_DISPATCH)) + if (!(This->typeattr.wTypeFlags & TYPEFLAG_FDUAL) || + !(This->typeattr.typekind == TKIND_INTERFACE || + This->typeattr.typekind == TKIND_DISPATCH)) return TYPE_E_ELEMENTNOTFOUND; /* when we meet a DUAL typeinfo, we must create the alternate @@ -7639,10 +7606,10 @@ static HRESULT WINAPI ITypeInfo_fnGetRefTypeInfo( pTypeInfoImpl->ref = 0; list_init(&pTypeInfoImpl->custdata_list); - if (This->typekind == TKIND_INTERFACE) - pTypeInfoImpl->typekind = TKIND_DISPATCH; + if (This->typeattr.typekind == TKIND_INTERFACE) + pTypeInfoImpl->typeattr.typekind = TKIND_DISPATCH; else - pTypeInfoImpl->typekind = TKIND_INTERFACE; + pTypeInfoImpl->typeattr.typekind = TKIND_INTERFACE; *ppTInfo = (ITypeInfo *)&pTypeInfoImpl->ITypeInfo2_iface; /* the AddRef implicitly adds a reference to the parent typelib, which @@ -7655,7 +7622,7 @@ static HRESULT WINAPI ITypeInfo_fnGetRefTypeInfo( result = S_OK; } else if ((hRefType & DISPATCH_HREF_MASK) && - (This->typekind == TKIND_DISPATCH)) + (This->typeattr.typekind == TKIND_DISPATCH)) { HREFTYPE href_dispatch = hRefType; result = ITypeInfoImpl_GetDispatchRefTypeInfo((ITypeInfo *)iface, &href_dispatch, ppTInfo); @@ -7956,7 +7923,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetTypeKind( ITypeInfo2 * iface, TYPEKIND *pTypeKind) { ITypeInfoImpl *This = impl_from_ITypeInfo2(iface); - *pTypeKind=This->typekind; + *pTypeKind = This->typeattr.typekind; TRACE("(%p) type 0x%0x\n", This,*pTypeKind); return S_OK; } @@ -7971,7 +7938,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetTypeKind( ITypeInfo2 * iface, static HRESULT WINAPI ITypeInfo2_fnGetTypeFlags( ITypeInfo2 *iface, ULONG *pTypeFlags) { ITypeInfoImpl *This = impl_from_ITypeInfo2(iface); - *pTypeFlags=This->wTypeFlags; + *pTypeFlags=This->typeattr.wTypeFlags; TRACE("(%p) flags 0x%x\n", This,*pTypeFlags); return S_OK; } @@ -7988,12 +7955,12 @@ static HRESULT WINAPI ITypeInfo2_fnGetFuncIndexOfMemId( ITypeInfo2 * iface, UINT fdc; HRESULT result; - for (fdc = 0; fdc < This->cFuncs; ++fdc){ + for (fdc = 0; fdc < This->typeattr.cFuncs; ++fdc){ const TLBFuncDesc *pFuncInfo = &This->funcdescs[fdc]; if(memid == pFuncInfo->funcdesc.memid && (invKind & pFuncInfo->funcdesc.invkind)) break; } - if(fdc < This->cFuncs) { + if(fdc < This->typeattr.cFuncs) { *pFuncIndex = fdc; result = S_OK; } else @@ -8018,7 +7985,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetVarIndexOfMemId( ITypeInfo2 * iface, TRACE("%p %d %p\n", iface, memid, pVarIndex); - pVarInfo = TLB_get_vardesc_by_memberid(This->vardescs, This->cVars, memid); + pVarInfo = TLB_get_vardesc_by_memberid(This->vardescs, This->typeattr.cVars, memid); if(!pVarInfo) return TYPE_E_ELEMENTNOTFOUND; @@ -8070,7 +8037,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetFuncCustData( TRACE("%p %u %s %p\n", This, index, debugstr_guid(guid), pVarVal); - if(index >= This->cFuncs) + if(index >= This->typeattr.cFuncs) return TYPE_E_ELEMENTNOTFOUND; pCData = TLB_get_custdata_by_guid(&pFDesc->custdata_list, guid); @@ -8101,7 +8068,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetParamCustData( TRACE("%p %u %u %s %p\n", This, indexFunc, indexParam, debugstr_guid(guid), pVarVal); - if(indexFunc >= This->cFuncs) + if(indexFunc >= This->typeattr.cFuncs) return TYPE_E_ELEMENTNOTFOUND; if(indexParam >= pFDesc->funcdesc.cParams) @@ -8133,7 +8100,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetVarCustData( TRACE("%p %s %p\n", This, debugstr_guid(guid), pVarVal); - if(index >= This->cVars) + if(index >= This->typeattr.cVars) return TYPE_E_ELEMENTNOTFOUND; pCData = TLB_get_custdata_by_guid(&pVDesc->custdata_list, guid); @@ -8162,7 +8129,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetImplTypeCustData( TRACE("%p %u %s %p\n", This, index, debugstr_guid(guid), pVarVal); - if(index >= This->cImplTypes) + if(index >= This->typeattr.cImplTypes) return TYPE_E_ELEMENTNOTFOUND; pCData = TLB_get_custdata_by_guid(&pRDesc->custdata_list, guid); @@ -8211,7 +8178,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetDocumentation2( SysAllocString(TLB_get_bstr(This->pTypeLib->HelpStringDll));/* FIXME */ return S_OK; }else {/* for a member */ - pFDesc = TLB_get_funcdesc_by_memberid(This->funcdescs, This->cFuncs, memid); + pFDesc = TLB_get_funcdesc_by_memberid(This->funcdescs, This->typeattr.cFuncs, memid); if(pFDesc){ if(pbstrHelpString) *pbstrHelpString=SysAllocString(TLB_get_bstr(pFDesc->HelpString)); @@ -8222,7 +8189,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetDocumentation2( SysAllocString(TLB_get_bstr(This->pTypeLib->HelpStringDll));/* FIXME */ return S_OK; } - pVDesc = TLB_get_vardesc_by_memberid(This->vardescs, This->cVars, memid); + pVDesc = TLB_get_vardesc_by_memberid(This->vardescs, This->typeattr.cVars, memid); if(pVDesc){ if(pbstrHelpString) *pbstrHelpString=SysAllocString(TLB_get_bstr(pVDesc->HelpString)); @@ -8268,7 +8235,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetAllFuncCustData( TRACE("%p %u %p\n", This, index, pCustData); - if(index >= This->cFuncs) + if(index >= This->typeattr.cFuncs) return TYPE_E_ELEMENTNOTFOUND; return TLB_copy_all_custdata(&pFDesc->custdata_list, pCustData); @@ -8287,7 +8254,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetAllParamCustData( ITypeInfo2 * iface, TRACE("%p %u %u %p\n", This, indexFunc, indexParam, pCustData); - if(indexFunc >= This->cFuncs) + if(indexFunc >= This->typeattr.cFuncs) return TYPE_E_ELEMENTNOTFOUND; if(indexParam >= pFDesc->funcdesc.cParams) @@ -8309,7 +8276,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetAllVarCustData( ITypeInfo2 * iface, TRACE("%p %u %p\n", This, index, pCustData); - if(index >= This->cVars) + if(index >= This->typeattr.cVars) return TYPE_E_ELEMENTNOTFOUND; return TLB_copy_all_custdata(&pVDesc->custdata_list, pCustData); @@ -8330,7 +8297,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetAllImplTypeCustData( TRACE("%p %u %p\n", This, index, pCustData); - if(index >= This->cImplTypes) + if(index >= This->typeattr.cImplTypes) return TYPE_E_ELEMENTNOTFOUND; return TLB_copy_all_custdata(&pRDesc->custdata_list, pCustData); @@ -8418,17 +8385,17 @@ HRESULT WINAPI CreateDispTypeInfo( pTIIface->Name = NULL; pTIIface->dwHelpContext = -1; pTIIface->guid = NULL; - pTIIface->lcid = lcid; - pTIIface->typekind = TKIND_INTERFACE; - pTIIface->wMajorVerNum = 0; - pTIIface->wMinorVerNum = 0; - pTIIface->cbAlignment = 2; - pTIIface->cbSizeInstance = -1; - pTIIface->cbSizeVft = -1; - pTIIface->cFuncs = 0; - pTIIface->cImplTypes = 0; - pTIIface->cVars = 0; - pTIIface->wTypeFlags = 0; + pTIIface->typeattr.lcid = lcid; + pTIIface->typeattr.typekind = TKIND_INTERFACE; + pTIIface->typeattr.wMajorVerNum = 0; + pTIIface->typeattr.wMinorVerNum = 0; + pTIIface->typeattr.cbAlignment = 2; + pTIIface->typeattr.cbSizeInstance = -1; + pTIIface->typeattr.cbSizeVft = -1; + pTIIface->typeattr.cFuncs = 0; + pTIIface->typeattr.cImplTypes = 0; + pTIIface->typeattr.cVars = 0; + pTIIface->typeattr.wTypeFlags = 0; pTIIface->hreftype = 0; pTIIface->funcdescs = TLBFuncDesc_Alloc(pidata->cMembers); @@ -8461,7 +8428,7 @@ HRESULT WINAPI CreateDispTypeInfo( pFuncDesc->HelpString = NULL; pFuncDesc->Entry = NULL; list_init(&pFuncDesc->custdata_list); - pTIIface->cFuncs++; + pTIIface->typeattr.cFuncs++; ++pFuncDesc; } @@ -8473,17 +8440,17 @@ HRESULT WINAPI CreateDispTypeInfo( pTIClass->Name = NULL; pTIClass->dwHelpContext = -1; pTIClass->guid = NULL; - pTIClass->lcid = lcid; - pTIClass->typekind = TKIND_COCLASS; - pTIClass->wMajorVerNum = 0; - pTIClass->wMinorVerNum = 0; - pTIClass->cbAlignment = 2; - pTIClass->cbSizeInstance = -1; - pTIClass->cbSizeVft = -1; - pTIClass->cFuncs = 0; - pTIClass->cImplTypes = 1; - pTIClass->cVars = 0; - pTIClass->wTypeFlags = 0; + pTIClass->typeattr.lcid = lcid; + pTIClass->typeattr.typekind = TKIND_COCLASS; + pTIClass->typeattr.wMajorVerNum = 0; + pTIClass->typeattr.wMinorVerNum = 0; + pTIClass->typeattr.cbAlignment = 2; + pTIClass->typeattr.cbSizeInstance = -1; + pTIClass->typeattr.cbSizeVft = -1; + pTIClass->typeattr.cFuncs = 0; + pTIClass->typeattr.cImplTypes = 1; + pTIClass->typeattr.cVars = 0; + pTIClass->typeattr.wTypeFlags = 0; pTIClass->hreftype = sizeof(MSFT_TypeInfoBase); pTIClass->impltypes = TLBImplType_Alloc(1); @@ -8545,7 +8512,7 @@ static HRESULT WINAPI ITypeComp_fnBind( pBindPtr->lpfuncdesc = NULL; *ppTInfo = NULL; - for(fdc = 0; fdc < This->cFuncs; ++fdc){ + for(fdc = 0; fdc < This->typeattr.cFuncs; ++fdc){ pFDesc = &This->funcdescs[fdc]; if (!lstrcmpiW(TLB_get_bstr(pFDesc->Name), szName)) { if (!wFlags || (pFDesc->funcdesc.invkind & wFlags)) @@ -8556,12 +8523,12 @@ static HRESULT WINAPI ITypeComp_fnBind( } } - if (fdc < This->cFuncs) + if (fdc < This->typeattr.cFuncs) { HRESULT hr = TLB_AllocAndInitFuncDesc( &pFDesc->funcdesc, &pBindPtr->lpfuncdesc, - This->typekind == TKIND_DISPATCH); + This->typeattr.typekind == TKIND_DISPATCH); if (FAILED(hr)) return hr; *pDescKind = DESCKIND_FUNCDESC; @@ -8569,7 +8536,7 @@ static HRESULT WINAPI ITypeComp_fnBind( ITypeInfo_AddRef(*ppTInfo); return S_OK; } else { - pVDesc = TLB_get_vardesc_by_name(This->vardescs, This->cVars, szName); + pVDesc = TLB_get_vardesc_by_name(This->vardescs, This->typeattr.cVars, szName); if(pVDesc){ HRESULT hr = TLB_AllocAndInitVarDesc(&pVDesc->vardesc, &pBindPtr->lpvardesc); if (FAILED(hr)) @@ -8597,7 +8564,7 @@ static HRESULT WINAPI ITypeComp_fnBind( hr = ITypeComp_Bind(pTComp, szName, lHash, wFlags, ppTInfo, pDescKind, pBindPtr); ITypeComp_Release(pTComp); if (SUCCEEDED(hr) && *pDescKind == DESCKIND_FUNCDESC && - This->typekind == TKIND_DISPATCH) + This->typeattr.typekind == TKIND_DISPATCH) { FUNCDESC *tmp = pBindPtr->lpfuncdesc; hr = TLB_AllocAndInitFuncDesc(tmp, &pBindPtr->lpfuncdesc, TRUE); @@ -8724,29 +8691,29 @@ static HRESULT WINAPI ICreateTypeLib2_fnCreateTypeInfo(ICreateTypeLib2 *iface, info->pTypeLib = This; info->Name = TLB_append_str(&This->name_list, name); info->index = This->TypeInfoCount; - info->typekind = kind; - info->cbAlignment = 4; + info->typeattr.typekind = kind; + info->typeattr.cbAlignment = 4; - switch(info->typekind) { + switch (info->typeattr.typekind) { case TKIND_ENUM: case TKIND_INTERFACE: case TKIND_DISPATCH: case TKIND_COCLASS: - info->cbSizeInstance = This->ptr_size; + info->typeattr.cbSizeInstance = This->ptr_size; break; case TKIND_RECORD: case TKIND_UNION: - info->cbSizeInstance = 0; + info->typeattr.cbSizeInstance = 0; break; case TKIND_MODULE: - info->cbSizeInstance = 2; + info->typeattr.cbSizeInstance = 2; break; case TKIND_ALIAS: - info->cbSizeInstance = -0x75; + info->typeattr.cbSizeInstance = -0x75; break; default: - FIXME("unrecognized typekind %d\n", info->typekind); - info->cbSizeInstance = 0xdeadbeef; + FIXME("unrecognized typekind %d\n", info->typeattr.typekind); + info->typeattr.cbSizeInstance = 0xdeadbeef; break; } @@ -9319,7 +9286,7 @@ static DWORD WMSFT_compile_typeinfo_aux(ITypeInfoImpl *info, MEMBERID *memid; DWORD *name, *offsets, offs; - for(i = 0; i < info->cFuncs; ++i){ + for(i = 0; i < info->typeattr.cFuncs; ++i){ TLBFuncDesc *desc = &info->funcdescs[i]; recorded_size += 6 * sizeof(INT); /* mandatory fields */ @@ -9350,7 +9317,7 @@ static DWORD WMSFT_compile_typeinfo_aux(ITypeInfoImpl *info, extra_size += 2 * sizeof(INT); /* memberid, name offs */ } - for(i = 0; i < info->cVars; ++i){ + for(i = 0; i < info->typeattr.cVars; ++i){ TLBVarDesc *desc = &info->vardescs[i]; recorded_size += 5 * sizeof(INT); /* mandatory fields */ @@ -9376,7 +9343,7 @@ static DWORD WMSFT_compile_typeinfo_aux(ITypeInfoImpl *info, aux_seg->len += recorded_size + extra_size; - aux_seg->len += sizeof(INT) * (info->cVars + info->cFuncs); /* offsets at the end */ + aux_seg->len += sizeof(INT) * (info->typeattr.cVars + info->typeattr.cFuncs); /* offsets at the end */ if(aux_seg->data) aux_seg->data = heap_realloc(aux_seg->data, aux_seg->len); @@ -9389,7 +9356,7 @@ static DWORD WMSFT_compile_typeinfo_aux(ITypeInfoImpl *info, offs = 0; funcrecord = (MSFT_FuncRecord*)(((char *)aux_seg->data) + ret + sizeof(INT)); - for(i = 0; i < info->cFuncs; ++i){ + for(i = 0; i < info->typeattr.cFuncs; ++i){ TLBFuncDesc *desc = &info->funcdescs[i]; DWORD size = 6 * sizeof(INT), paramdefault_size = 0, *paramdefault; @@ -9519,7 +9486,7 @@ static DWORD WMSFT_compile_typeinfo_aux(ITypeInfoImpl *info, } varrecord = (MSFT_VarRecord*)funcrecord; - for(i = 0; i < info->cVars; ++i){ + for(i = 0; i < info->typeattr.cVars; ++i){ TLBVarDesc *desc = &info->vardescs[i]; DWORD size = 5 * sizeof(INT); @@ -9576,19 +9543,19 @@ static DWORD WMSFT_compile_typeinfo_aux(ITypeInfoImpl *info, } memid = (MEMBERID*)varrecord; - for(i = 0; i < info->cFuncs; ++i){ + for(i = 0; i < info->typeattr.cFuncs; ++i){ TLBFuncDesc *desc = &info->funcdescs[i]; *memid = desc->funcdesc.memid; ++memid; } - for(i = 0; i < info->cVars; ++i){ + for(i = 0; i < info->typeattr.cVars; ++i){ TLBVarDesc *desc = &info->vardescs[i]; *memid = desc->vardesc.memid; ++memid; } name = (UINT*)memid; - for(i = 0; i < info->cFuncs; ++i){ + for(i = 0; i < info->typeattr.cFuncs; ++i){ TLBFuncDesc *desc = &info->funcdescs[i]; if(desc->Name) *name = desc->Name->offset; @@ -9596,7 +9563,7 @@ static DWORD WMSFT_compile_typeinfo_aux(ITypeInfoImpl *info, *name = -1; ++name; } - for(i = 0; i < info->cVars; ++i){ + for(i = 0; i < info->typeattr.cVars; ++i){ TLBVarDesc *desc = &info->vardescs[i]; if(desc->Name) *name = desc->Name->offset; @@ -9620,7 +9587,7 @@ static DWORD WMSFT_compile_typeinfo_ref(ITypeInfoImpl *info, WMSFT_TLBFile *file DWORD offs = file->ref_seg.len, i; WMSFT_RefChunk *chunk; - file->ref_seg.len += info->cImplTypes * sizeof(WMSFT_RefChunk); + file->ref_seg.len += info->typeattr.cImplTypes * sizeof(WMSFT_RefChunk); if(!file->ref_seg.data) file->ref_seg.data = heap_alloc(file->ref_seg.len); else @@ -9628,11 +9595,11 @@ static DWORD WMSFT_compile_typeinfo_ref(ITypeInfoImpl *info, WMSFT_TLBFile *file chunk = (WMSFT_RefChunk*)((char*)file->ref_seg.data + offs); - for(i = 0; i < info->cImplTypes; ++i){ + for(i = 0; i < info->typeattr.cImplTypes; ++i){ chunk->href = info->impltypes[i].hRef; chunk->res04 = info->impltypes[i].implflags; chunk->res08 = -1; - if(i < info->cImplTypes - 1) + if(i < info->typeattr.cImplTypes - 1) chunk->next = offs + sizeof(WMSFT_RefChunk) * (i + 1); else chunk->next = -1; @@ -9650,18 +9617,18 @@ static DWORD WMSFT_compile_typeinfo(ITypeInfoImpl *info, INT16 index, WMSFT_TLBF if(data){ MSFT_TypeInfoBase *base = (MSFT_TypeInfoBase*)data; - if(info->wTypeFlags & TYPEFLAG_FDUAL) + if(info->typeattr.wTypeFlags & TYPEFLAG_FDUAL) base->typekind = TKIND_DISPATCH; else - base->typekind = info->typekind; + base->typekind = info->typeattr.typekind; base->typekind |= index << 16; /* TODO: There are some other flags here */ - base->typekind |= (info->cbAlignment << 11) | (info->cbAlignment << 6); + base->typekind |= (info->typeattr.cbAlignment << 11) | (info->typeattr.cbAlignment << 6); base->memoffset = WMSFT_compile_typeinfo_aux(info, file); base->res2 = 0; base->res3 = 0; base->res4 = 3; base->res5 = 0; - base->cElement = (info->cVars << 16) | info->cFuncs; + base->cElement = (info->typeattr.cVars << 16) | info->typeattr.cFuncs; base->res7 = 0; base->res8 = 0; base->res9 = 0; @@ -9670,7 +9637,7 @@ static DWORD WMSFT_compile_typeinfo(ITypeInfoImpl *info, INT16 index, WMSFT_TLBF base->posguid = info->guid->offset; else base->posguid = -1; - base->flags = info->wTypeFlags; + base->flags = info->typeattr.wTypeFlags; if(info->Name) { base->NameOffset = info->Name->offset; @@ -9679,7 +9646,7 @@ static DWORD WMSFT_compile_typeinfo(ITypeInfoImpl *info, INT16 index, WMSFT_TLBF }else { base->NameOffset = -1; } - base->version = (info->wMinorVerNum << 16) | info->wMajorVerNum; + base->version = (info->typeattr.wMinorVerNum << 16) | info->typeattr.wMajorVerNum; if(info->DocString) base->docstringoffs = info->DocString->offset; else @@ -9687,20 +9654,20 @@ static DWORD WMSFT_compile_typeinfo(ITypeInfoImpl *info, INT16 index, WMSFT_TLBF base->helpstringcontext = info->dwHelpStringContext; base->helpcontext = info->dwHelpContext; base->oCustData = WMSFT_compile_custdata(info->pcustdata_list, file); - base->cImplTypes = info->cImplTypes; - base->cbSizeVft = info->cbSizeVft; - base->size = info->cbSizeInstance; - if(info->typekind == TKIND_COCLASS){ + base->cImplTypes = info->typeattr.cImplTypes; + base->cbSizeVft = info->typeattr.cbSizeVft; + base->size = info->typeattr.cbSizeInstance; + if(info->typeattr.typekind == TKIND_COCLASS){ base->datatype1 = WMSFT_compile_typeinfo_ref(info, file); - }else if(info->typekind == TKIND_ALIAS){ + }else if(info->typeattr.typekind == TKIND_ALIAS){ base->datatype1 = WMSFT_append_typedesc(info->tdescAlias, file, NULL, NULL); - }else if(info->typekind == TKIND_MODULE){ + }else if(info->typeattr.typekind == TKIND_MODULE){ if(info->DllName) base->datatype1 = info->DllName->offset; else base->datatype1 = -1; }else{ - if(info->cImplTypes > 0) + if(info->typeattr.cImplTypes > 0) base->datatype1 = info->impltypes[0].hRef; else base->datatype1 = -1; @@ -10253,12 +10220,12 @@ static HRESULT WINAPI ICreateTypeInfo2_fnSetTypeFlags(ICreateTypeInfo2 *iface, return hres; } - old_flags = This->wTypeFlags; - This->wTypeFlags = typeFlags; + old_flags = This->typeattr.wTypeFlags; + This->typeattr.wTypeFlags = typeFlags; hres = ICreateTypeInfo2_LayOut(iface); if (FAILED(hres)) { - This->wTypeFlags = old_flags; + This->typeattr.wTypeFlags = old_flags; return hres; } @@ -10299,8 +10266,8 @@ static HRESULT WINAPI ICreateTypeInfo2_fnSetVersion(ICreateTypeInfo2 *iface, TRACE("%p %d %d\n", This, majorVerNum, minorVerNum); - This->wMajorVerNum = majorVerNum; - This->wMinorVerNum = minorVerNum; + This->typeattr.wMajorVerNum = majorVerNum; + This->typeattr.wMinorVerNum = minorVerNum; return S_OK; } @@ -10427,7 +10394,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddFuncDesc(ICreateTypeInfo2 *iface, if (!funcDesc || funcDesc->oVft & 3) return E_INVALIDARG; - switch (This->typekind) { + switch (This->typeattr.typekind) { case TKIND_MODULE: if (funcDesc->funckind != FUNC_STATIC) return TYPE_E_BADMODULEKIND; @@ -10441,7 +10408,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddFuncDesc(ICreateTypeInfo2 *iface, return TYPE_E_BADMODULEKIND; } - if (index > This->cFuncs) + if (index > This->typeattr.cFuncs) return TYPE_E_ELEMENTNOTFOUND; if (funcDesc->invkind & (INVOKE_PROPERTYPUT | INVOKE_PROPERTYPUTREF) && @@ -10507,17 +10474,17 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddFuncDesc(ICreateTypeInfo2 *iface, if (This->funcdescs) { This->funcdescs = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->funcdescs, - sizeof(TLBFuncDesc) * (This->cFuncs + 1)); + sizeof(TLBFuncDesc) * (This->typeattr.cFuncs + 1)); - if (index < This->cFuncs) { + if (index < This->typeattr.cFuncs) { memmove(This->funcdescs + index + 1, This->funcdescs + index, - (This->cFuncs - index) * sizeof(TLBFuncDesc)); + (This->typeattr.cFuncs - index) * sizeof(TLBFuncDesc)); func_desc = This->funcdescs + index; } else - func_desc = This->funcdescs + This->cFuncs; + func_desc = This->funcdescs + This->typeattr.cFuncs; /* move custdata lists to the new memory location */ - for(i = 0; i < This->cFuncs + 1; ++i){ + for(i = 0; i < This->typeattr.cFuncs + 1; ++i){ if(index != i){ TLBFuncDesc *fd = &This->funcdescs[i]; if(fd->custdata_list.prev == fd->custdata_list.next) @@ -10534,7 +10501,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddFuncDesc(ICreateTypeInfo2 *iface, memcpy(func_desc, &tmp_func_desc, sizeof(tmp_func_desc)); list_init(&func_desc->custdata_list); - ++This->cFuncs; + ++This->typeattr.cFuncs; This->needs_layout = TRUE; @@ -10550,25 +10517,25 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddImplType(ICreateTypeInfo2 *iface, TRACE("%p %u %d\n", This, index, refType); - switch(This->typekind){ + switch(This->typeattr.typekind){ case TKIND_COCLASS: { if (index == -1) { FIXME("Unhandled index: -1\n"); return E_NOTIMPL; } - if(index != This->cImplTypes) + if(index != This->typeattr.cImplTypes) return TYPE_E_ELEMENTNOTFOUND; break; } case TKIND_INTERFACE: case TKIND_DISPATCH: - if (index != 0 || This->cImplTypes) + if (index != 0 || This->typeattr.cImplTypes) return TYPE_E_ELEMENTNOTFOUND; break; default: - FIXME("Unimplemented typekind: %d\n", This->typekind); + FIXME("Unimplemented typekind: %d\n", This->typeattr.typekind); return E_NOTIMPL; } @@ -10576,17 +10543,17 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddImplType(ICreateTypeInfo2 *iface, UINT i; This->impltypes = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->impltypes, - sizeof(TLBImplType) * (This->cImplTypes + 1)); + sizeof(TLBImplType) * (This->typeattr.cImplTypes + 1)); - if (index < This->cImplTypes) { + if (index < This->typeattr.cImplTypes) { memmove(This->impltypes + index + 1, This->impltypes + index, - (This->cImplTypes - index) * sizeof(TLBImplType)); + (This->typeattr.cImplTypes - index) * sizeof(TLBImplType)); impl_type = This->impltypes + index; } else - impl_type = This->impltypes + This->cImplTypes; + impl_type = This->impltypes + This->typeattr.cImplTypes; /* move custdata lists to the new memory location */ - for(i = 0; i < This->cImplTypes + 1; ++i){ + for(i = 0; i < This->typeattr.cImplTypes + 1; ++i){ if(index != i){ TLBImplType *it = &This->impltypes[i]; if(it->custdata_list.prev == it->custdata_list.next) @@ -10604,10 +10571,10 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddImplType(ICreateTypeInfo2 *iface, TLBImplType_Constructor(impl_type); impl_type->hRef = refType; - ++This->cImplTypes; + ++This->typeattr.cImplTypes; if((refType & (~0x3)) == (This->pTypeLib->dispatch_href & (~0x3))) - This->wTypeFlags |= TYPEFLAG_FDISPATCHABLE; + This->typeattr.wTypeFlags |= TYPEFLAG_FDISPATCHABLE; hres = ICreateTypeInfo2_LayOut(iface); if (FAILED(hres)) @@ -10624,10 +10591,10 @@ static HRESULT WINAPI ICreateTypeInfo2_fnSetImplTypeFlags(ICreateTypeInfo2 *ifac TRACE("%p %u %x\n", This, index, implTypeFlags); - if (This->typekind != TKIND_COCLASS) + if (This->typeattr.typekind != TKIND_COCLASS) return TYPE_E_BADMODULEKIND; - if (index >= This->cImplTypes) + if (index >= This->typeattr.cImplTypes) return TYPE_E_ELEMENTNOTFOUND; impl_type->implflags = implTypeFlags; @@ -10642,7 +10609,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnSetAlignment(ICreateTypeInfo2 *iface, TRACE("%p %d\n", This, alignment); - This->cbAlignment = alignment; + This->typeattr.cbAlignment = alignment; return S_OK; } @@ -10659,7 +10626,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnSetSchema(ICreateTypeInfo2 *iface, This->Schema = TLB_append_str(&This->pTypeLib->string_list, schema); - This->lpstrSchema = This->Schema->str; + This->typeattr.lpstrSchema = This->Schema->str; return S_OK; } @@ -10676,17 +10643,17 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddVarDesc(ICreateTypeInfo2 *iface, UINT i; This->vardescs = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->vardescs, - sizeof(TLBVarDesc) * (This->cVars + 1)); + sizeof(TLBVarDesc) * (This->typeattr.cVars + 1)); - if (index < This->cVars) { + if (index < This->typeattr.cVars) { memmove(This->vardescs + index + 1, This->vardescs + index, - (This->cVars - index) * sizeof(TLBVarDesc)); + (This->typeattr.cVars - index) * sizeof(TLBVarDesc)); var_desc = This->vardescs + index; } else - var_desc = This->vardescs + This->cVars; + var_desc = This->vardescs + This->typeattr.cVars; /* move custdata lists to the new memory location */ - for(i = 0; i < This->cVars + 1; ++i){ + for(i = 0; i < This->typeattr.cVars + 1; ++i){ if(index != i){ TLBVarDesc *var = &This->vardescs[i]; if(var->custdata_list.prev == var->custdata_list.next) @@ -10704,7 +10671,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddVarDesc(ICreateTypeInfo2 *iface, TLB_AllocAndInitVarDesc(varDesc, &var_desc->vardesc_create); var_desc->vardesc = *var_desc->vardesc_create; - ++This->cVars; + ++This->typeattr.cVars; This->needs_layout = TRUE; @@ -10723,7 +10690,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnSetFuncAndParamNames(ICreateTypeInfo2 * if (!names) return E_INVALIDARG; - if (index >= This->cFuncs || numNames == 0) + if (index >= This->typeattr.cFuncs || numNames == 0) return TYPE_E_ELEMENTNOTFOUND; if (func_desc->funcdesc.invkind & (INVOKE_PROPERTYPUT | INVOKE_PROPERTYPUTREF)){ @@ -10733,7 +10700,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnSetFuncAndParamNames(ICreateTypeInfo2 * if(numNames > func_desc->funcdesc.cParams + 1) return TYPE_E_ELEMENTNOTFOUND; - for(i = 0; i < This->cFuncs; ++i) { + for(i = 0; i < This->typeattr.cFuncs; ++i) { TLBFuncDesc *iter = &This->funcdescs[i]; if (iter->Name && !strcmpW(TLB_get_bstr(iter->Name), *names)) { if (iter->funcdesc.invkind & (INVOKE_PROPERTYPUT | INVOKE_PROPERTYPUTREF | INVOKE_PROPERTYGET) && @@ -10764,7 +10731,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnSetVarName(ICreateTypeInfo2 *iface, if(!name) return E_INVALIDARG; - if(index >= This->cVars) + if(index >= This->typeattr.cVars) return TYPE_E_ELEMENTNOTFOUND; This->vardescs[index].Name = TLB_append_str(&This->pTypeLib->name_list, name); @@ -10782,10 +10749,10 @@ static HRESULT WINAPI ICreateTypeInfo2_fnSetTypeDescAlias(ICreateTypeInfo2 *ifac if(!tdescAlias) return E_INVALIDARG; - if(This->typekind != TKIND_ALIAS) + if(This->typeattr.typekind != TKIND_ALIAS) return TYPE_E_BADMODULEKIND; - hr = TLB_size_instance(This, This->pTypeLib->syskind, tdescAlias, &This->cbSizeInstance, &This->cbAlignment); + hr = TLB_size_instance(This, This->pTypeLib->syskind, tdescAlias, &This->typeattr.cbSizeInstance, &This->typeattr.cbAlignment); if(FAILED(hr)) return hr; @@ -10815,7 +10782,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnSetFuncDocString(ICreateTypeInfo2 *ifac if(!docString) return E_INVALIDARG; - if(index >= This->cFuncs) + if(index >= This->typeattr.cFuncs) return TYPE_E_ELEMENTNOTFOUND; func_desc->HelpString = TLB_append_str(&This->pTypeLib->string_list, docString); @@ -10834,7 +10801,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnSetVarDocString(ICreateTypeInfo2 *iface if(!docString) return E_INVALIDARG; - if(index >= This->cVars) + if(index >= This->typeattr.cVars) return TYPE_E_ELEMENTNOTFOUND; var_desc->HelpString = TLB_append_str(&This->pTypeLib->string_list, docString); @@ -10850,7 +10817,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnSetFuncHelpContext(ICreateTypeInfo2 *if TRACE("%p %u %d\n", This, index, helpContext); - if(index >= This->cFuncs) + if(index >= This->typeattr.cFuncs) return TYPE_E_ELEMENTNOTFOUND; func_desc->helpcontext = helpContext; @@ -10866,7 +10833,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnSetVarHelpContext(ICreateTypeInfo2 *ifa TRACE("%p %u %d\n", This, index, helpContext); - if(index >= This->cVars) + if(index >= This->typeattr.cVars) return TYPE_E_ELEMENTNOTFOUND; var_desc->HelpContext = helpContext; @@ -10892,8 +10859,8 @@ static HRESULT WINAPI ICreateTypeInfo2_fnSetTypeIdldesc(ICreateTypeInfo2 *iface, if (!idlDesc) return E_INVALIDARG; - This->idldescType.dwReserved = idlDesc->dwReserved; - This->idldescType.wIDLFlags = idlDesc->wIDLFlags; + This->typeattr.idldescType.dwReserved = idlDesc->dwReserved; + This->typeattr.idldescType.wIDLFlags = idlDesc->wIDLFlags; return S_OK; } @@ -10914,7 +10881,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnLayOut(ICreateTypeInfo2 *iface) if (FAILED(hres)) return hres; - if (This->typekind == TKIND_INTERFACE) { + if (This->typeattr.typekind == TKIND_INTERFACE) { ITypeInfo *inh; TYPEATTR *attr; HREFTYPE inh_href; @@ -10931,7 +10898,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnLayOut(ICreateTypeInfo2 *iface) ITypeInfo_Release(tinfo); return hres; } - This->cbSizeVft = attr->cbSizeVft; + This->typeattr.cbSizeVft = attr->cbSizeVft; ITypeInfo_ReleaseTypeAttr(inh, attr); do{ @@ -10950,34 +10917,34 @@ static HRESULT WINAPI ICreateTypeInfo2_fnLayOut(ICreateTypeInfo2 *iface) ITypeInfo_Release(inh); } else if (hres == TYPE_E_ELEMENTNOTFOUND) { - This->cbSizeVft = 0; + This->typeattr.cbSizeVft = 0; hres = S_OK; } else { ITypeInfo_Release(tinfo); return hres; } } else if (hres == TYPE_E_ELEMENTNOTFOUND) { - This->cbSizeVft = 0; + This->typeattr.cbSizeVft = 0; hres = S_OK; } else { ITypeInfo_Release(tinfo); return hres; } - } else if (This->typekind == TKIND_DISPATCH) - This->cbSizeVft = 7 * This->pTypeLib->ptr_size; + } else if (This->typeattr.typekind == TKIND_DISPATCH) + This->typeattr.cbSizeVft = 7 * This->pTypeLib->ptr_size; else - This->cbSizeVft = 0; + This->typeattr.cbSizeVft = 0; func_desc = This->funcdescs; i = 0; - while (i < This->cFuncs) { + while (i < This->typeattr.cFuncs) { if (!(func_desc->funcdesc.oVft & 0x1)) - func_desc->funcdesc.oVft = This->cbSizeVft; + func_desc->funcdesc.oVft = This->typeattr.cbSizeVft; if ((func_desc->funcdesc.oVft & 0xFFFC) > user_vft) user_vft = func_desc->funcdesc.oVft & 0xFFFC; - This->cbSizeVft += This->pTypeLib->ptr_size; + This->typeattr.cbSizeVft += This->pTypeLib->ptr_size; if (func_desc->funcdesc.memid == MEMBERID_NIL) { TLBFuncDesc *iter; @@ -10987,10 +10954,10 @@ static HRESULT WINAPI ICreateTypeInfo2_fnLayOut(ICreateTypeInfo2 *iface) func_desc->funcdesc.memid = 0x60000000 + (depth << 16) + i; iter = This->funcdescs; - while (j < This->cFuncs) { + while (j < This->typeattr.cFuncs) { if (iter != func_desc && iter->funcdesc.memid == func_desc->funcdesc.memid) { if (!reset) { - func_desc->funcdesc.memid = 0x60000000 + (depth << 16) + This->cFuncs; + func_desc->funcdesc.memid = 0x60000000 + (depth << 16) + This->typeattr.cFuncs; reset = TRUE; } else ++func_desc->funcdesc.memid; @@ -11007,10 +10974,10 @@ static HRESULT WINAPI ICreateTypeInfo2_fnLayOut(ICreateTypeInfo2 *iface) ++i; } - if (user_vft > This->cbSizeVft) - This->cbSizeVft = user_vft + This->pTypeLib->ptr_size; + if (user_vft > This->typeattr.cbSizeVft) + This->typeattr.cbSizeVft = user_vft + This->pTypeLib->ptr_size; - for(i = 0; i < This->cVars; ++i){ + for(i = 0; i < This->typeattr.cVars; ++i){ TLBVarDesc *var_desc = &This->vardescs[i]; if(var_desc->vardesc.memid == MEMBERID_NIL){ UINT j = 0; @@ -11020,10 +10987,10 @@ static HRESULT WINAPI ICreateTypeInfo2_fnLayOut(ICreateTypeInfo2 *iface) var_desc->vardesc.memid = 0x40000000 + (depth << 16) + i; iter = This->vardescs; - while (j < This->cVars) { + while (j < This->typeattr.cVars) { if (iter != var_desc && iter->vardesc.memid == var_desc->vardesc.memid) { if (!reset) { - var_desc->vardesc.memid = 0x40000000 + (depth << 16) + This->cVars; + var_desc->vardesc.memid = 0x40000000 + (depth << 16) + This->typeattr.cVars; reset = TRUE; } else ++var_desc->vardesc.memid;