dispex.c (bab6b90f) dispex.c (eb44c20c)
1/*
2 * Copyright 2008 Jacek Caban for CodeWeavers
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *

--- 136 unchanged lines hidden (view full) ---

145 return tid_ids[tid].iid;
146}
147
148static inline unsigned get_libid_from_tid(tid_t tid)
149{
150 return tid_ids[tid].lib;
151}
152
1/*
2 * Copyright 2008 Jacek Caban for CodeWeavers
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *

--- 136 unchanged lines hidden (view full) ---

145 return tid_ids[tid].iid;
146}
147
148static inline unsigned get_libid_from_tid(tid_t tid)
149{
150 return tid_ids[tid].lib;
151}
152
153HRESULT get_typeinfo(enum tid_t tid, ITypeInfo **typeinfo)
153static HRESULT get_typelib(unsigned lib, ITypeLib **tl)
154{
154{
155 unsigned lib = get_libid_from_tid(tid);
156 HRESULT hres;
157
158 if(!typelib[lib]) {
155 HRESULT hres;
156
157 if(!typelib[lib]) {
159 ITypeLib *tl;
160
161 hres = LoadRegTypeLib(lib_ids[lib].iid, lib_ids[lib].major, 0, LOCALE_SYSTEM_DEFAULT, &tl);
158 hres = LoadRegTypeLib(lib_ids[lib].iid, lib_ids[lib].major, 0, LOCALE_SYSTEM_DEFAULT, tl);
162 if(FAILED(hres)) {
163 ERR("LoadRegTypeLib failed: %08x\n", hres);
164 return hres;
165 }
166
159 if(FAILED(hres)) {
160 ERR("LoadRegTypeLib failed: %08x\n", hres);
161 return hres;
162 }
163
167 if(InterlockedCompareExchangePointer((void**)&typelib[lib], tl, NULL))
168 ITypeLib_Release(tl);
164 if (InterlockedCompareExchangePointer((void**)&typelib[lib], *tl, NULL))
165 ITypeLib_Release(*tl);
169 }
170
166 }
167
168 *tl = typelib[lib];
169 return S_OK;
170}
171
172HRESULT get_typeinfo(enum tid_t tid, ITypeInfo **typeinfo)
173{
174 unsigned lib = get_libid_from_tid(tid);
175 ITypeLib *typelib;
176 HRESULT hres;
177
178 if (FAILED(hres = get_typelib(lib, &typelib)))
179 return hres;
180
171 if(!typeinfos[tid]) {
172 ITypeInfo *ti;
173
181 if(!typeinfos[tid]) {
182 ITypeInfo *ti;
183
174 hres = ITypeLib_GetTypeInfoOfGuid(typelib[lib], get_riid_from_tid(tid), &ti);
184 hres = ITypeLib_GetTypeInfoOfGuid(typelib, get_riid_from_tid(tid), &ti);
175 if(FAILED(hres)) {
176 /* try harder with typelib from msxml.dll */
185 if(FAILED(hres)) {
186 /* try harder with typelib from msxml.dll */
177 hres = ITypeLib_GetTypeInfoOfGuid(typelib[LibXml], get_riid_from_tid(tid), &ti);
187 if (FAILED(hres = get_typelib(LibXml, &typelib)))
188 return hres;
189 hres = ITypeLib_GetTypeInfoOfGuid(typelib, get_riid_from_tid(tid), &ti);
178 if(FAILED(hres)) {
179 ERR("GetTypeInfoOfGuid failed: %08x\n", hres);
180 return hres;
181 }
182 }
183
184 if(InterlockedCompareExchangePointer((void**)(typeinfos+tid), ti, NULL))
185 ITypeInfo_Release(ti);

--- 461 unchanged lines hidden ---
190 if(FAILED(hres)) {
191 ERR("GetTypeInfoOfGuid failed: %08x\n", hres);
192 return hres;
193 }
194 }
195
196 if(InterlockedCompareExchangePointer((void**)(typeinfos+tid), ti, NULL))
197 ITypeInfo_Release(ti);

--- 461 unchanged lines hidden ---