The intention is to have ICreateTypeLib2_fnDeleteTypeInfo() fully implemented such that Cashbooks can run on Linux. I believe this should fix a number of other Windows apps that lean heavily on oleaut32.dll as well.
-- v4: dlls/oleaut32: Mostly mirror fnFindName impl in typelib.c dlls/oleaut32: Use common and correct identifiers in typelib.c
From: Edward O'Callaghan edward@antitrust.cc
Signed-off-by: Edward O'Callaghan edward@antitrust.cc --- dlls/oleaut32/typelib.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c index f421a76fe95..1841fdc88cc 100644 --- a/dlls/oleaut32/typelib.c +++ b/dlls/oleaut32/typelib.c @@ -3618,19 +3618,14 @@ static ITypeLib2* ITypeLib2_Constructor_MSFT(LPVOID pLib, DWORD dwTLBLength)
pTypeLibImpl->dispatch_href = tlbHeader.dispatchpos;
- /* type infos */ + /* Allocate and fill typeinfos array. */ if(tlbHeader.nrtypeinfos >= 0 ) { - ITypeInfoImpl **ppTI; - - ppTI = pTypeLibImpl->typeinfos = calloc(tlbHeader.nrtypeinfos, sizeof(ITypeInfoImpl*)); - + pTypeLibImpl->typeinfos = calloc(tlbHeader.nrtypeinfos, sizeof(ITypeInfoImpl*)); for(i = 0; i < tlbHeader.nrtypeinfos; i++) { - *ppTI = MSFT_DoTypeInfo(&cx, i, pTypeLibImpl); - - ++ppTI; - (pTypeLibImpl->TypeInfoCount)++; + pTypeLibImpl->typeinfos[i] = MSFT_DoTypeInfo(&cx, i, pTypeLibImpl); + pTypeLibImpl->TypeInfoCount++; } }
From: Edward O'Callaghan edward@antitrust.cc
Signed-off-by: Edward O'Callaghan edward@antitrust.cc --- dlls/oleaut32/typelib.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-)
diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c index 1841fdc88cc..458d3a83375 100644 --- a/dlls/oleaut32/typelib.c +++ b/dlls/oleaut32/typelib.c @@ -1285,13 +1285,6 @@ static inline BSTR TLB_get_bstr(const TLBString *str) return str != NULL ? str->str : NULL; }
-static inline int TLB_str_memcmp(void *left, const TLBString *str, DWORD len) -{ - if(!str) - return 1; - return memcmp(left, str->str, len); -} - static inline const GUID *TLB_get_guidref(const TLBGuid *guid) { return guid != NULL ? &guid->guid : NULL; @@ -5021,26 +5014,26 @@ static HRESULT WINAPI ITypeLib2_fnIsName( { ITypeLibImpl *This = impl_from_ITypeLib2(iface); int tic; - UINT nNameBufLen = (lstrlenW(szNameBuf)+1)*sizeof(WCHAR), fdc, vrc; + UINT fdc, vrc;
TRACE("%p, %s, %#lx, %p.\n", iface, debugstr_w(szNameBuf), lHashVal, pfName);
*pfName=TRUE; for(tic = 0; tic < This->TypeInfoCount; ++tic){ ITypeInfoImpl *pTInfo = This->typeinfos[tic]; - if(!TLB_str_memcmp(szNameBuf, pTInfo->Name, nNameBufLen)) goto ITypeLib2_fnIsName_exit; + if(!lstrcmpiW(TLB_get_bstr(pTInfo->Name), szNameBuf)) goto ITypeLib2_fnIsName_exit; 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; + if(!lstrcmpiW(TLB_get_bstr(pFInfo->Name), szNameBuf)) goto ITypeLib2_fnIsName_exit; for(pc=0; pc < pFInfo->funcdesc.cParams; pc++){ - if(!TLB_str_memcmp(szNameBuf, pFInfo->pParamDesc[pc].Name, nNameBufLen)) + if(!lstrcmpiW(TLB_get_bstr(pFInfo->pParamDesc[pc].Name), szNameBuf)) goto ITypeLib2_fnIsName_exit; } } 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; + if(!lstrcmpiW(TLB_get_bstr(pVInfo->Name), szNameBuf)) goto ITypeLib2_fnIsName_exit; }
} @@ -5070,20 +5063,18 @@ static HRESULT WINAPI ITypeLib2_fnFindName( ITypeLibImpl *This = impl_from_ITypeLib2(iface); int tic; UINT count = 0; - UINT len;
TRACE("%p, %s %#lx, %p, %p, %p.\n", iface, debugstr_w(name), hash, ppTInfo, memid, found);
if ((!name && hash == 0) || !ppTInfo || !memid || !found) return E_INVALIDARG;
- len = (lstrlenW(name) + 1)*sizeof(WCHAR); for(tic = 0; count < *found && tic < This->TypeInfoCount; ++tic) { ITypeInfoImpl *pTInfo = This->typeinfos[tic]; TLBVarDesc *var; UINT fdc;
- if(!TLB_str_memcmp(name, pTInfo->Name, len)) { + if(!lstrcmpiW(TLB_get_bstr(pTInfo->Name), name)) { memid[count] = MEMBERID_NIL; goto ITypeLib2_fnFindName_exit; } @@ -5091,7 +5082,7 @@ static HRESULT WINAPI ITypeLib2_fnFindName( for(fdc = 0; fdc < pTInfo->typeattr.cFuncs; ++fdc) { TLBFuncDesc *func = &pTInfo->funcdescs[fdc];
- if(!TLB_str_memcmp(name, func->Name, len)) { + if(!lstrcmpiW(TLB_get_bstr(func->Name), name)) { memid[count] = func->funcdesc.memid; goto ITypeLib2_fnFindName_exit; }
From: Edward O'Callaghan edward@antitrust.cc
Signed-off-by: Edward O'Callaghan edward@antitrust.cc --- dlls/oleaut32/typelib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c index 458d3a83375..a50efd7b78e 100644 --- a/dlls/oleaut32/typelib.c +++ b/dlls/oleaut32/typelib.c @@ -1441,7 +1441,7 @@ static void dump_TLBFuncDescOne(const TLBFuncDesc * pfd) MESSAGE("\thelpstring: %s\n", debugstr_w(TLB_get_bstr(pfd->HelpString))); if(pfd->Entry == NULL) MESSAGE("\tentry: (null)\n"); - else if(pfd->Entry == (void*)-1) + else if(pfd->Entry == TLB_REF_NOT_FOUND) MESSAGE("\tentry: invalid\n"); else if(IS_INTRESOURCE(pfd->Entry)) MESSAGE("\tentry: %p\n", pfd->Entry); @@ -7675,7 +7675,7 @@ static HRESULT WINAPI ITypeInfo_fnGetDllEntry( ITypeInfo2 *iface, MEMBERID memid
if (pBstrDllName) *pBstrDllName = SysAllocString(TLB_get_bstr(This->DllName));
- if (!IS_INTRESOURCE(pFDesc->Entry) && (pFDesc->Entry != (void*)-1)) + if (!IS_INTRESOURCE(pFDesc->Entry) && (pFDesc->Entry != TLB_REF_NOT_FOUND)) { if (pBstrName) *pBstrName = SysAllocString(TLB_get_bstr(pFDesc->Entry)); if (pwOrdinal) *pwOrdinal = -1;
From: Edward O'Callaghan edward@antitrust.cc
Signed-off-by: Edward O'Callaghan edward@antitrust.cc --- dlls/oleaut32/typelib.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c index a50efd7b78e..20a8b4b54cd 100644 --- a/dlls/oleaut32/typelib.c +++ b/dlls/oleaut32/typelib.c @@ -3889,6 +3889,8 @@ static sltg_ref_lookup_t *SLTG_DoRefs(SLTG_RefInfo *pRef, ITypeLibImpl *pTL, unsigned int lib_offs, type_num;
ref_type = calloc(1, sizeof(TLBRefType)); + /* assume internal ref unless import found */ + ref_type->pImpTLInfo = TLB_REF_INTERNAL;
name += SLTG_ReadStringA(name, &refname); if(sscanf(refname, "*\R%x*#%x", &lib_offs, &type_num) != 2) @@ -3928,9 +3930,6 @@ static sltg_ref_lookup_t *SLTG_DoRefs(SLTG_RefInfo *pRef, ITypeLibImpl *pTL, /* Store a reference to IDispatch */ if(pTL->dispatch_href == -1 && IsEqualGUID(&import->guid->guid, &IID_StdOle) && type_num == 4) pTL->dispatch_href = typelib_ref; - - } else { /* internal ref */ - ref_type->pImpTLInfo = TLB_REF_INTERNAL; } ref_type->reference = typelib_ref; ref_type->index = type_num;
From: Edward O'Callaghan edward@antitrust.cc
Signed-off-by: Edward O'Callaghan edward@antitrust.cc --- dlls/oleaut32/typelib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c index 20a8b4b54cd..88e1d06f528 100644 --- a/dlls/oleaut32/typelib.c +++ b/dlls/oleaut32/typelib.c @@ -3959,7 +3959,7 @@ static char *SLTG_DoImpls(char *pBlk, ITypeInfoImpl *pTI, the last one is the regular 0x16 bytes. */
info = (SLTG_ImplInfo*)pBlk; - while(1){ + while(info) { pTI->typeattr.cImplTypes++; if(info->next == 0xffff) break; @@ -3969,7 +3969,7 @@ static char *SLTG_DoImpls(char *pBlk, ITypeInfoImpl *pTI, info = (SLTG_ImplInfo*)pBlk; pTI->impltypes = TLBImplType_Alloc(pTI->typeattr.cImplTypes); pImplType = pTI->impltypes; - while(1) { + while(pImplType) { sltg_get_typelib_ref(ref_lookup, info->ref, &pImplType->hRef); pImplType->implflags = info->impltypeflags; ++pImplType;
From: Edward O'Callaghan edward@antitrust.cc
There are a number of 'index' fields at different levels of structs. This can be extremely confusing not to mention there actual intended purpose. Clarify the precise purpose of the pIndex field of ITypeInfoImpl and collect like terms.
Signed-off-by: Edward O'Callaghan edward@antitrust.cc --- dlls/oleaut32/typelib.c | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-)
diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c index 88e1d06f528..b04feeb36f9 100644 --- a/dlls/oleaut32/typelib.c +++ b/dlls/oleaut32/typelib.c @@ -1216,8 +1216,10 @@ typedef struct tagITypeInfoImpl TYPEATTR typeattr; TYPEDESC *tdescAlias;
- ITypeLibImpl * pTypeLib; /* back pointer to typelib */ - int index; /* index in this typelib; */ + /* pIndex and pTypeLib are required by ITypeInfo::GetContainingTypeLib */ + UINT pIndex; /* index of this typelibimpl */ + ITypeLibImpl * pTypeLib; /* back pointer to typelib */ + HREFTYPE hreftype; /* hreftype for app object binding */ /* type libs seem to store the doc strings in ascii * so why should we do it in unicode? @@ -1535,7 +1537,7 @@ static void dump_TypeInfo(const ITypeInfoImpl * pty) 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); + TRACE("parent tlb:%p index in TLB:%u\n",pty->pTypeLib, pty->pIndex); 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->typeattr.cFuncs); @@ -2659,9 +2661,9 @@ static ITypeInfoImpl * MSFT_DoTypeInfo( MSFT_ReadLEDWords(&tiBase, sizeof(tiBase) ,pcx , pcx->pTblDir->pTypeInfoTab.offset+count*sizeof(tiBase));
-/* this is where we are coming from */ + /* set the parent ITypeLibImpl of this ITypeInfoImpl */ + ptiRet->pIndex = count; ptiRet->pTypeLib = pLibInfo; - ptiRet->index=count;
ptiRet->guid = MSFT_ReadGuid(tiBase.posguid, pcx); ptiRet->typeattr.lcid = pLibInfo->set_lcid; /* FIXME: correct? */ @@ -4549,8 +4551,8 @@ static ITypeLib2* ITypeLib2_Constructor_SLTG(LPVOID pLib, DWORD dwTLBLength) pTIHeader->res06, pTIHeader->res0e, pTIHeader->res16, pTIHeader->res1e);
*ppTypeInfoImpl = ITypeInfoImpl_Constructor(); + (*ppTypeInfoImpl)->pIndex = i; (*ppTypeInfoImpl)->pTypeLib = pTypeLibImpl; - (*ppTypeInfoImpl)->index = i; (*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); @@ -7805,9 +7807,8 @@ static HRESULT WINAPI ITypeInfo_fnGetRefTypeInfo( }
if(ref_type->pImpTLInfo == TLB_REF_INTERNAL) { - UINT Index; TRACE("internal reference\n"); - result = ITypeInfo2_GetContainingTypeLib(iface, &pTLib, &Index); + result = ITypeInfo2_GetContainingTypeLib(iface, &pTLib, NULL); } else { if(ref_type->pImpTLInfo->pImpTypeLib) { TRACE("typeinfo in imported typelib that is already loaded\n"); @@ -8013,13 +8014,13 @@ static HRESULT WINAPI ITypeInfo_fnGetMops( ITypeInfo2 *iface, MEMBERID memid, BS * within that type library. */ static HRESULT WINAPI ITypeInfo_fnGetContainingTypeLib( ITypeInfo2 *iface, - ITypeLib * *ppTLib, UINT *pIndex) + ITypeLib **ppTLib, UINT *pIndex) { ITypeInfoImpl *This = impl_from_ITypeInfo2(iface);
/* If a pointer is null, we simply ignore it, the ATL in particular passes pIndex as 0 */ if (pIndex) { - *pIndex=This->index; + *pIndex = This->pIndex; TRACE("returning pIndex=%d\n", *pIndex); }
@@ -8552,8 +8553,8 @@ HRESULT WINAPI CreateDispTypeInfo( pTypeLibImpl->typeinfos = calloc(pTypeLibImpl->TypeInfoCount, sizeof(ITypeInfoImpl*));
pTIIface = pTypeLibImpl->typeinfos[0] = ITypeInfoImpl_Constructor(); + pTIIface->pIndex = 0; pTIIface->pTypeLib = pTypeLibImpl; - pTIIface->index = 0; pTIIface->Name = NULL; pTIIface->dwHelpContext = -1; pTIIface->guid = NULL; @@ -8606,8 +8607,8 @@ HRESULT WINAPI CreateDispTypeInfo( dump_TypeInfo(pTIIface);
pTIClass = pTypeLibImpl->typeinfos[1] = ITypeInfoImpl_Constructor(); + pTIClass->pIndex = 1; pTIClass->pTypeLib = pTypeLibImpl; - pTIClass->index = 1; pTIClass->Name = NULL; pTIClass->dwHelpContext = -1; pTIClass->guid = NULL; @@ -8851,12 +8852,14 @@ static HRESULT WINAPI ICreateTypeLib2_fnCreateTypeInfo(ICreateTypeLib2 *iface, return TYPE_E_NAMECONFLICT;
This->typeinfos = realloc(This->typeinfos, sizeof(ITypeInfoImpl*) * (This->TypeInfoCount + 1)); + This->TypeInfoCount++;
- info = This->typeinfos[This->TypeInfoCount] = ITypeInfoImpl_Constructor(); + info = This->typeinfos[This->TypeInfoCount - 1] = ITypeInfoImpl_Constructor();
+ info->pIndex = This->TypeInfoCount - 1; info->pTypeLib = This; + info->Name = TLB_append_str(&This->name_list, name); - info->index = This->TypeInfoCount; info->typeattr.typekind = kind; info->typeattr.cbAlignment = 4;
@@ -8890,9 +8893,7 @@ static HRESULT WINAPI ICreateTypeLib2_fnCreateTypeInfo(ICreateTypeLib2 *iface, return hres; }
- info->hreftype = info->index * sizeof(MSFT_TypeInfoBase); - - ++This->TypeInfoCount; + info->hreftype = info->pIndex * sizeof(MSFT_TypeInfoBase);
return S_OK; }
From: Edward O'Callaghan edward@antitrust.cc
Also avoid mixing up types, keep to the canonical varient.
Signed-off-by: Edward O'Callaghan edward@antitrust.cc --- dlls/oleaut32/typelib.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c index b04feeb36f9..1bb2260b5b1 100644 --- a/dlls/oleaut32/typelib.c +++ b/dlls/oleaut32/typelib.c @@ -1090,7 +1090,7 @@ typedef struct tagITypeLibImpl const TLBString *HelpFile; const TLBString *HelpStringDll; DWORD dwHelpContext; - int TypeInfoCount; /* nr of typeinfo's in librarry */ + UINT TypeInfoCount; /* nr of typeinfo's in librarry */ struct tagITypeInfoImpl **typeinfos; struct list custdata_list; struct list implib_list; @@ -1709,14 +1709,14 @@ static inline TLBCustData *TLB_get_custdata_by_guid(const struct list *custdata_ return NULL; }
-static inline ITypeInfoImpl *TLB_get_typeinfo_by_name(ITypeLibImpl *typelib, const OLECHAR *name) +static inline ITypeInfoImpl *TLB_get_typeinfo_by_name(ITypeLibImpl *typelib, const OLECHAR *name, UINT *index) { - int i; - - for (i = 0; i < typelib->TypeInfoCount; ++i) + for (UINT i = 0; i < typelib->TypeInfoCount; ++i) { - if (!lstrcmpiW(TLB_get_bstr(typelib->typeinfos[i]->Name), name)) + if (!lstrcmpiW(TLB_get_bstr(typelib->typeinfos[i]->Name), name)) { + if (index) *index = i; return typelib->typeinfos[i]; + } }
return NULL; @@ -5472,7 +5472,7 @@ static HRESULT WINAPI ITypeLibComp_fnBindType( if(!szName || !ppTInfo || !ppTComp) return E_INVALIDARG;
- info = TLB_get_typeinfo_by_name(This, szName); + info = TLB_get_typeinfo_by_name(This, szName, NULL); if(!info){ *ppTInfo = NULL; *ppTComp = NULL; @@ -8847,7 +8847,7 @@ static HRESULT WINAPI ICreateTypeLib2_fnCreateTypeInfo(ICreateTypeLib2 *iface, if (!ctinfo || !name) return E_INVALIDARG;
- info = TLB_get_typeinfo_by_name(This, name); + info = TLB_get_typeinfo_by_name(This, name, NULL); if (info) return TYPE_E_NAMECONFLICT;
@@ -9993,10 +9993,9 @@ static void WMSFT_write_segment(HANDLE outfile, WMSFT_SegContents *segment) static HRESULT WMSFT_fixup_typeinfos(ITypeLibImpl *This, WMSFT_TLBFile *file, DWORD file_len) { - DWORD i; MSFT_TypeInfoBase *base = (MSFT_TypeInfoBase *)file->typeinfo_seg.data;
- for(i = 0; i < This->TypeInfoCount; ++i){ + for(UINT i = 0; i < This->TypeInfoCount; ++i){ base->memoffset += file_len; ++base; }
From: Edward O'Callaghan edward@antitrust.cc
Implements the trivial cases of 'ICreateTypeLib2::DeleteTypeInfo'.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57662
Signed-off-by: Edward O'Callaghan edward@antitrust.cc --- dlls/oleaut32/typelib.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c index 1bb2260b5b1..c0c6034a877 100644 --- a/dlls/oleaut32/typelib.c +++ b/dlls/oleaut32/typelib.c @@ -10239,6 +10239,15 @@ static HRESULT WINAPI ICreateTypeLib2_fnDeleteTypeInfo(ICreateTypeLib2 *iface, LPOLESTR name) { ITypeLibImpl *This = impl_from_ICreateTypeLib2(iface); + ITypeInfoImpl *info; + + if (!name) + return E_INVALIDARG; + + info = TLB_get_typeinfo_by_name(This, name, NULL); + if (!info) + return E_INVALIDARG; + FIXME("%p %s - stub\n", This, wine_dbgstr_w(name)); return E_NOTIMPL; }
From: Edward O'Callaghan edward@antitrust.cc
Signed-off-by: Edward O'Callaghan edward@antitrust.cc --- dlls/oleaut32/typelib.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c index c0c6034a877..327e114668d 100644 --- a/dlls/oleaut32/typelib.c +++ b/dlls/oleaut32/typelib.c @@ -10271,8 +10271,12 @@ static HRESULT WINAPI ICreateTypeLib2_fnSetCustData(ICreateTypeLib2 *iface, static HRESULT WINAPI ICreateTypeLib2_fnSetHelpStringContext(ICreateTypeLib2 *iface, ULONG helpStringContext) { - FIXME("%p, %lu - stub\n", iface, helpStringContext); - return E_NOTIMPL; + ITypeLibImpl *This = impl_from_ICreateTypeLib2(iface); + TRACE("%p, %lu.\n", iface, helpStringContext); + + This->dwHelpContext = helpStringContext; + + return S_OK; }
static HRESULT WINAPI ICreateTypeLib2_fnSetHelpStringDll(ICreateTypeLib2 *iface,
From: Edward O'Callaghan edward@antitrust.cc
Make the code a little more consistent to read and grep.
Signed-off-by: Edward O'Callaghan edward@antitrust.cc --- dlls/oleaut32/typelib.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-)
diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c index 327e114668d..ec353937eef 100644 --- a/dlls/oleaut32/typelib.c +++ b/dlls/oleaut32/typelib.c @@ -5024,17 +5024,17 @@ static HRESULT WINAPI ITypeLib2_fnIsName( ITypeInfoImpl *pTInfo = This->typeinfos[tic]; if(!lstrcmpiW(TLB_get_bstr(pTInfo->Name), szNameBuf)) goto ITypeLib2_fnIsName_exit; for(fdc = 0; fdc < pTInfo->typeattr.cFuncs; ++fdc) { - TLBFuncDesc *pFInfo = &pTInfo->funcdescs[fdc]; + TLBFuncDesc *pFDesc = &pTInfo->funcdescs[fdc]; int pc; - if(!lstrcmpiW(TLB_get_bstr(pFInfo->Name), szNameBuf)) goto ITypeLib2_fnIsName_exit; - for(pc=0; pc < pFInfo->funcdesc.cParams; pc++){ - if(!lstrcmpiW(TLB_get_bstr(pFInfo->pParamDesc[pc].Name), szNameBuf)) + if(!lstrcmpiW(TLB_get_bstr(pFDesc->Name), szNameBuf)) goto ITypeLib2_fnIsName_exit; + for(pc=0; pc < pFDesc->funcdesc.cParams; pc++){ + if(!lstrcmpiW(TLB_get_bstr(pFDesc->pParamDesc[pc].Name), szNameBuf)) goto ITypeLib2_fnIsName_exit; } } for(vrc = 0; vrc < pTInfo->typeattr.cVars; ++vrc){ - TLBVarDesc *pVInfo = &pTInfo->vardescs[vrc]; - if(!lstrcmpiW(TLB_get_bstr(pVInfo->Name), szNameBuf)) goto ITypeLib2_fnIsName_exit; + TLBVarDesc *pVDesc = &pTInfo->vardescs[vrc]; + if(!lstrcmpiW(TLB_get_bstr(pVDesc->Name), szNameBuf)) goto ITypeLib2_fnIsName_exit; }
} @@ -5070,9 +5070,9 @@ static HRESULT WINAPI ITypeLib2_fnFindName( if ((!name && hash == 0) || !ppTInfo || !memid || !found) return E_INVALIDARG;
+ // TODO: factor out common impl with fnIsName(). for(tic = 0; count < *found && tic < This->TypeInfoCount; ++tic) { ITypeInfoImpl *pTInfo = This->typeinfos[tic]; - TLBVarDesc *var; UINT fdc;
if(!lstrcmpiW(TLB_get_bstr(pTInfo->Name), name)) { @@ -5081,17 +5081,17 @@ static HRESULT WINAPI ITypeLib2_fnFindName( }
for(fdc = 0; fdc < pTInfo->typeattr.cFuncs; ++fdc) { - TLBFuncDesc *func = &pTInfo->funcdescs[fdc]; + TLBFuncDesc *pFDesc = &pTInfo->funcdescs[fdc];
- if(!lstrcmpiW(TLB_get_bstr(func->Name), name)) { - memid[count] = func->funcdesc.memid; + if(!lstrcmpiW(TLB_get_bstr(pFDesc->Name), name)) { + memid[count] = pFDesc->funcdesc.memid; goto ITypeLib2_fnFindName_exit; } }
- var = TLB_get_vardesc_by_name(pTInfo, name); - if (var) { - memid[count] = var->vardesc.memid; + TLBVarDesc *pVDesc = TLB_get_vardesc_by_name(pTInfo, name); + if (pVDesc) { + memid[count] = pVDesc->vardesc.memid; goto ITypeLib2_fnFindName_exit; }
@@ -5594,14 +5594,14 @@ static void ITypeInfoImpl_Destroy(ITypeInfoImpl *This)
for(i = 0; i < This->typeattr.cVars; ++i) { - TLBVarDesc *pVInfo = &This->vardescs[i]; - if (pVInfo->vardesc_create) { - TLB_FreeVarDesc(pVInfo->vardesc_create); - } else if (pVInfo->vardesc.varkind == VAR_CONST) { - VariantClear(pVInfo->vardesc.lpvarValue); - free(pVInfo->vardesc.lpvarValue); + TLBVarDesc *pVDesc = &This->vardescs[i]; + if (pVDesc->vardesc_create) { + TLB_FreeVarDesc(pVDesc->vardesc_create); + } else if (pVDesc->vardesc.varkind == VAR_CONST) { + VariantClear(pVDesc->vardesc.lpvarValue); + free(pVDesc->vardesc.lpvarValue); } - TLB_FreeCustData(&pVInfo->custdata_list); + TLB_FreeCustData(&pVDesc->custdata_list); } free(This->vardescs);
From: Edward O'Callaghan edward@antitrust.cc
The methods fnFindName and fnIsName() are almost identical. Consistently match them where possible, paving the way for a common internal worker implementation.
Signed-off-by: Edward O'Callaghan edward@antitrust.cc --- dlls/oleaut32/typelib.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c index ec353937eef..63293a68ca0 100644 --- a/dlls/oleaut32/typelib.c +++ b/dlls/oleaut32/typelib.c @@ -5015,27 +5015,33 @@ static HRESULT WINAPI ITypeLib2_fnIsName( { ITypeLibImpl *This = impl_from_ITypeLib2(iface); int tic; - UINT fdc, vrc;
TRACE("%p, %s, %#lx, %p.\n", iface, debugstr_w(szNameBuf), lHashVal, pfName);
*pfName=TRUE; for(tic = 0; tic < This->TypeInfoCount; ++tic){ ITypeInfoImpl *pTInfo = This->typeinfos[tic]; - if(!lstrcmpiW(TLB_get_bstr(pTInfo->Name), szNameBuf)) goto ITypeLib2_fnIsName_exit; + UINT fdc; + + if(!lstrcmpiW(TLB_get_bstr(pTInfo->Name), szNameBuf)) + goto ITypeLib2_fnIsName_exit; + for(fdc = 0; fdc < pTInfo->typeattr.cFuncs; ++fdc) { TLBFuncDesc *pFDesc = &pTInfo->funcdescs[fdc]; + + if(!lstrcmpiW(TLB_get_bstr(pFDesc->Name), szNameBuf)) + goto ITypeLib2_fnIsName_exit; + int pc; - if(!lstrcmpiW(TLB_get_bstr(pFDesc->Name), szNameBuf)) goto ITypeLib2_fnIsName_exit; for(pc=0; pc < pFDesc->funcdesc.cParams; pc++){ if(!lstrcmpiW(TLB_get_bstr(pFDesc->pParamDesc[pc].Name), szNameBuf)) goto ITypeLib2_fnIsName_exit; } } - for(vrc = 0; vrc < pTInfo->typeattr.cVars; ++vrc){ - TLBVarDesc *pVDesc = &pTInfo->vardescs[vrc]; - if(!lstrcmpiW(TLB_get_bstr(pVDesc->Name), szNameBuf)) goto ITypeLib2_fnIsName_exit; - } + + TLBVarDesc *pVDesc = TLB_get_vardesc_by_name(pTInfo, szNameBuf); + if (pVDesc) + goto ITypeLib2_fnIsName_exit;
} *pfName=FALSE;
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=151165
Your paranoid android.
=== debian11 (32 bit report) ===
oleaut32: typelib.c:7747: Test succeeded inside todo block: got -1 typelib.c:7749: Test succeeded inside todo block: got 1
=== debian11b (64 bit WoW report) ===
oleaut32: typelib.c:7747: Test succeeded inside todo block: got -1 typelib.c:7749: Test succeeded inside todo block: got 1