Zebediah Figura : msxml3: Load the version 1 typelib before trying to access it.
Alexandre Julliard
julliard at winehq.org
Mon May 20 15:50:48 CDT 2019
Module: wine
Branch: master
Commit: 7edbbe1ed3fe5f3e3ac94d25f7b07fbd076dcebd
URL: https://source.winehq.org/git/wine.git/?a=commit;h=7edbbe1ed3fe5f3e3ac94d25f7b07fbd076dcebd
Author: Zebediah Figura <z.figura12 at gmail.com>
Date: Fri May 17 00:37:27 2019 -0500
msxml3: Load the version 1 typelib before trying to access it.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47214
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/msxml3/dispex.c | 30 +++++++++++++++++++++---------
1 file changed, 21 insertions(+), 9 deletions(-)
diff --git a/dlls/msxml3/dispex.c b/dlls/msxml3/dispex.c
index bd29a21..b1fb728 100644
--- a/dlls/msxml3/dispex.c
+++ b/dlls/msxml3/dispex.c
@@ -150,31 +150,43 @@ static inline unsigned get_libid_from_tid(tid_t tid)
return tid_ids[tid].lib;
}
-HRESULT get_typeinfo(enum tid_t tid, ITypeInfo **typeinfo)
+static HRESULT get_typelib(unsigned lib, ITypeLib **tl)
{
- unsigned lib = get_libid_from_tid(tid);
HRESULT hres;
if(!typelib[lib]) {
- ITypeLib *tl;
-
- hres = LoadRegTypeLib(lib_ids[lib].iid, lib_ids[lib].major, 0, LOCALE_SYSTEM_DEFAULT, &tl);
+ hres = LoadRegTypeLib(lib_ids[lib].iid, lib_ids[lib].major, 0, LOCALE_SYSTEM_DEFAULT, tl);
if(FAILED(hres)) {
ERR("LoadRegTypeLib failed: %08x\n", hres);
return hres;
}
- if(InterlockedCompareExchangePointer((void**)&typelib[lib], tl, NULL))
- ITypeLib_Release(tl);
+ if (InterlockedCompareExchangePointer((void**)&typelib[lib], *tl, NULL))
+ ITypeLib_Release(*tl);
}
+ *tl = typelib[lib];
+ return S_OK;
+}
+
+HRESULT get_typeinfo(enum tid_t tid, ITypeInfo **typeinfo)
+{
+ unsigned lib = get_libid_from_tid(tid);
+ ITypeLib *typelib;
+ HRESULT hres;
+
+ if (FAILED(hres = get_typelib(lib, &typelib)))
+ return hres;
+
if(!typeinfos[tid]) {
ITypeInfo *ti;
- hres = ITypeLib_GetTypeInfoOfGuid(typelib[lib], get_riid_from_tid(tid), &ti);
+ hres = ITypeLib_GetTypeInfoOfGuid(typelib, get_riid_from_tid(tid), &ti);
if(FAILED(hres)) {
/* try harder with typelib from msxml.dll */
- hres = ITypeLib_GetTypeInfoOfGuid(typelib[LibXml], get_riid_from_tid(tid), &ti);
+ if (FAILED(hres = get_typelib(LibXml, &typelib)))
+ return hres;
+ hres = ITypeLib_GetTypeInfoOfGuid(typelib, get_riid_from_tid(tid), &ti);
if(FAILED(hres)) {
ERR("GetTypeInfoOfGuid failed: %08x\n", hres);
return hres;
More information about the wine-cvs
mailing list