4 * Copyright 2002 Lionel Ulmer
5 * Copyright 2005 Mike McCormack
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
34 #include "wine/debug.h"
36 #include "msxml_private.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(msxml);
41 static ITypeLib *typelib;
42 static ITypeInfo *typeinfos[LAST_tid];
44 static REFIID tid_ids[] = {
45 &IID_IXMLDOMAttribute,
46 &IID_IXMLDOMCDATASection,
48 &IID_IXMLDOMDocument2,
49 &IID_IXMLDOMDocumentFragment,
51 &IID_IXMLDOMEntityReference,
52 &IID_IXMLDOMNamedNodeMap,
54 &IID_IXMLDOMParseError,
55 &IID_IXMLDOMProcessingInstruction,
56 &IID_IXMLDOMSchemaCollection,
62 HRESULT get_typeinfo(enum tid_t tid, ITypeInfo **typeinfo)
69 hres = LoadRegTypeLib(&LIBID_MSXML2, 3, 0, LOCALE_SYSTEM_DEFAULT, &tl);
71 ERR("LoadRegTypeLib failed: %08x\n", hres);
75 if(InterlockedCompareExchangePointer((void**)&typelib, tl, NULL))
82 hres = ITypeLib_GetTypeInfoOfGuid(typelib, tid_ids[tid], &typeinfo);
84 ERR("GetTypeInfoOfGuid failed: %08x\n", hres);
88 if(InterlockedCompareExchangePointer((void**)(typeinfos+tid), typeinfo, NULL))
89 ITypeInfo_Release(typeinfo);
92 *typeinfo = typeinfos[tid];
94 ITypeInfo_AddRef(typeinfos[tid]);
98 static void process_detach(void)
103 for(i=0; i < sizeof(typeinfos)/sizeof(*typeinfos); i++)
105 ITypeInfo_Release(typeinfos[i]);
107 ITypeLib_Release(typelib);
111 HRESULT WINAPI DllCanUnloadNow(void)
117 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
121 case DLL_PROCESS_ATTACH:
125 DisableThreadLibraryCalls(hInstDLL);
127 case DLL_PROCESS_DETACH: