Kevin Puetz : oleaut32: Search cache for requested typeinfo in GetRefTypeInfo.
Module: wine Branch: master Commit: dc96f63f3f87ff18425c0b11dfc989ca5431da3e URL: https://source.winehq.org/git/wine.git/?a=commit;h=dc96f63f3f87ff18425c0b11d... Author: Kevin Puetz <PuetzKevinA(a)JohnDeere.com> Date: Mon Feb 10 14:56:28 2020 +0100 oleaut32: Search cache for requested typeinfo in GetRefTypeInfo. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/oleaut32/typelib.c | 48 ++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 10 deletions(-) diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c index 788d853f63..a65f432af0 100644 --- a/dlls/oleaut32/typelib.c +++ b/dlls/oleaut32/typelib.c @@ -7981,21 +7981,49 @@ static HRESULT WINAPI ITypeInfo_fnGetRefTypeInfo( ITypeLib_AddRef(pTLib); result = S_OK; } else { - static const WCHAR TYPELIBW[] = {'T','Y','P','E','L','I','B',0}; - struct search_res_tlb_params params; - BSTR libnam; + /* Search in cached typelibs */ + ITypeLibImpl *entry; - TRACE("typeinfo in imported typelib that isn't already loaded\n"); + EnterCriticalSection(&cache_section); + LIST_FOR_EACH_ENTRY(entry, &tlb_cache, ITypeLibImpl, entry) + { + if (entry->guid + && IsEqualIID(&entry->guid->guid, TLB_get_guid_null(ref_type->pImpTLInfo->guid)) + && entry->ver_major == ref_type->pImpTLInfo->wVersionMajor + && entry->ver_minor == ref_type->pImpTLInfo->wVersionMinor + && entry->set_lcid == ref_type->pImpTLInfo->lcid) + { + TRACE("got cached %p\n", entry); + pTLib = (ITypeLib*)&entry->ITypeLib2_iface; + ITypeLib_AddRef(pTLib); + result = S_OK; + break; + } + } + LeaveCriticalSection(&cache_section); - /* Search in resource table */ - params.guid = TLB_get_guid_null(ref_type->pImpTLInfo->guid); - params.pTLib = NULL; - EnumResourceNamesW(NULL, TYPELIBW, search_res_tlb, (LONG_PTR)¶ms); - pTLib = params.pTLib; - result = S_OK; + if (!pTLib) + { + static const WCHAR TYPELIBW[] = {'T','Y','P','E','L','I','B',0}; + struct search_res_tlb_params params; + + TRACE("typeinfo in imported typelib that isn't already loaded\n"); + + /* Search in resource table */ + params.guid = TLB_get_guid_null(ref_type->pImpTLInfo->guid); + params.pTLib = NULL; + EnumResourceNamesW(NULL, TYPELIBW, search_res_tlb, (LONG_PTR)¶ms); + if(params.pTLib) + { + pTLib = params.pTLib; + result = S_OK; + } + } if (!pTLib) { + BSTR libnam; + /* Search on disk */ result = query_typelib_path(TLB_get_guid_null(ref_type->pImpTLInfo->guid), ref_type->pImpTLInfo->wVersionMajor,
participants (1)
-
Alexandre Julliard