xref: /reactos/dll/win32/msxml3/factory.c (revision bab6b90f)
1c2c66affSColin Finck /*
2c2c66affSColin Finck  *    MSXML Class Factory
3c2c66affSColin Finck  *
4c2c66affSColin Finck  * Copyright 2002 Lionel Ulmer
5c2c66affSColin Finck  * Copyright 2005 Mike McCormack
6c2c66affSColin Finck  *
7c2c66affSColin Finck  * This library is free software; you can redistribute it and/or
8c2c66affSColin Finck  * modify it under the terms of the GNU Lesser General Public
9c2c66affSColin Finck  * License as published by the Free Software Foundation; either
10c2c66affSColin Finck  * version 2.1 of the License, or (at your option) any later version.
11c2c66affSColin Finck  *
12c2c66affSColin Finck  * This library is distributed in the hope that it will be useful,
13c2c66affSColin Finck  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14c2c66affSColin Finck  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15c2c66affSColin Finck  * Lesser General Public License for more details.
16c2c66affSColin Finck  *
17c2c66affSColin Finck  * You should have received a copy of the GNU Lesser General Public
18c2c66affSColin Finck  * License along with this library; if not, write to the Free Software
19c2c66affSColin Finck  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20c2c66affSColin Finck  */
21c2c66affSColin Finck 
22c2c66affSColin Finck #define COBJMACROS
23c2c66affSColin Finck 
24*bab6b90fSAmine Khaldi #include "config.h"
25c2c66affSColin Finck 
26*bab6b90fSAmine Khaldi #include <stdarg.h>
27*bab6b90fSAmine Khaldi #ifdef HAVE_LIBXML2
28*bab6b90fSAmine Khaldi # include <libxml/parser.h>
29*bab6b90fSAmine Khaldi # include <libxml/xmlerror.h>
30*bab6b90fSAmine Khaldi #endif
31*bab6b90fSAmine Khaldi 
32*bab6b90fSAmine Khaldi #include "windef.h"
33*bab6b90fSAmine Khaldi #include "winbase.h"
34*bab6b90fSAmine Khaldi #include "winuser.h"
35*bab6b90fSAmine Khaldi #include "ole2.h"
36*bab6b90fSAmine Khaldi #include "msxml.h"
37*bab6b90fSAmine Khaldi #include "msxml2.h"
38c2c66affSColin Finck #include "xmlparser.h"
39c2c66affSColin Finck 
40c2c66affSColin Finck /* undef the #define in msxml2 so that we can access the v.2 version
41c2c66affSColin Finck    independent CLSID as well as the v.3 one. */
42c2c66affSColin Finck #undef CLSID_DOMDocument
43c2c66affSColin Finck 
44*bab6b90fSAmine Khaldi #include "wine/debug.h"
45c2c66affSColin Finck 
46c2c66affSColin Finck #include "msxml_private.h"
47c2c66affSColin Finck 
48c2c66affSColin Finck WINE_DEFAULT_DEBUG_CHANNEL(msxml);
49c2c66affSColin Finck 
50c2c66affSColin Finck typedef HRESULT (*ClassFactoryCreateInstanceFunc)(void**);
51c2c66affSColin Finck typedef HRESULT (*DOMFactoryCreateInstanceFunc)(MSXML_VERSION, void**);
52c2c66affSColin Finck 
53c2c66affSColin Finck struct clsid_version_t
54c2c66affSColin Finck {
55c2c66affSColin Finck     const GUID *clsid;
56c2c66affSColin Finck     MSXML_VERSION version;
57c2c66affSColin Finck };
58c2c66affSColin Finck 
59c2c66affSColin Finck static const struct clsid_version_t clsid_versions_table[] =
60c2c66affSColin Finck {
61c2c66affSColin Finck     { &CLSID_DOMDocument,   MSXML_DEFAULT },
62c2c66affSColin Finck     { &CLSID_DOMDocument2,  MSXML2  },
63c2c66affSColin Finck     { &CLSID_DOMDocument26, MSXML26 },
64c2c66affSColin Finck     { &CLSID_DOMDocument30, MSXML3  },
65c2c66affSColin Finck     { &CLSID_DOMDocument40, MSXML4  },
66c2c66affSColin Finck     { &CLSID_DOMDocument60, MSXML6  },
67c2c66affSColin Finck 
68c2c66affSColin Finck     { &CLSID_DOMFreeThreadedDocument,   MSXML_DEFAULT },
69c2c66affSColin Finck     { &CLSID_FreeThreadedDOMDocument,   MSXML_DEFAULT },
70c2c66affSColin Finck     { &CLSID_FreeThreadedDOMDocument26, MSXML26 },
71c2c66affSColin Finck     { &CLSID_FreeThreadedDOMDocument30, MSXML3  },
72c2c66affSColin Finck     { &CLSID_FreeThreadedDOMDocument40, MSXML4  },
73c2c66affSColin Finck     { &CLSID_FreeThreadedDOMDocument60, MSXML6  },
74c2c66affSColin Finck 
75c2c66affSColin Finck     { &CLSID_XMLSchemaCache,   MSXML_DEFAULT },
76c2c66affSColin Finck     { &CLSID_XMLSchemaCache26, MSXML26 },
77c2c66affSColin Finck     { &CLSID_XMLSchemaCache30, MSXML3  },
78c2c66affSColin Finck     { &CLSID_XMLSchemaCache40, MSXML4  },
79c2c66affSColin Finck     { &CLSID_XMLSchemaCache60, MSXML6  },
80c2c66affSColin Finck 
81c2c66affSColin Finck     { &CLSID_MXXMLWriter,   MSXML_DEFAULT },
82c2c66affSColin Finck     { &CLSID_MXXMLWriter30, MSXML3 },
83c2c66affSColin Finck     { &CLSID_MXXMLWriter40, MSXML4 },
84c2c66affSColin Finck     { &CLSID_MXXMLWriter60, MSXML6 },
85c2c66affSColin Finck 
86c2c66affSColin Finck     { &CLSID_SAXXMLReader,   MSXML_DEFAULT },
87c2c66affSColin Finck     { &CLSID_SAXXMLReader30, MSXML3 },
88c2c66affSColin Finck     { &CLSID_SAXXMLReader40, MSXML4 },
89c2c66affSColin Finck     { &CLSID_SAXXMLReader60, MSXML6 },
90c2c66affSColin Finck 
91c2c66affSColin Finck     { &CLSID_SAXAttributes,   MSXML_DEFAULT },
92c2c66affSColin Finck     { &CLSID_SAXAttributes30, MSXML3 },
93c2c66affSColin Finck     { &CLSID_SAXAttributes40, MSXML4 },
94c2c66affSColin Finck     { &CLSID_SAXAttributes60, MSXML6 },
95c2c66affSColin Finck 
96c2c66affSColin Finck     { &CLSID_XMLView, MSXML_DEFAULT }
97c2c66affSColin Finck };
98c2c66affSColin Finck 
get_msxml_version(const GUID * clsid)99c2c66affSColin Finck static MSXML_VERSION get_msxml_version(const GUID *clsid)
100c2c66affSColin Finck {
101c2c66affSColin Finck     unsigned int i;
102c2c66affSColin Finck 
103*bab6b90fSAmine Khaldi     for (i = 0; i < ARRAY_SIZE(clsid_versions_table); i++)
104c2c66affSColin Finck         if (IsEqualGUID(clsid, clsid_versions_table[i].clsid))
105c2c66affSColin Finck             return clsid_versions_table[i].version;
106c2c66affSColin Finck 
107c2c66affSColin Finck     ERR("unknown clsid=%s\n", debugstr_guid(clsid));
108c2c66affSColin Finck     return MSXML_DEFAULT;
109c2c66affSColin Finck }
110c2c66affSColin Finck 
111c2c66affSColin Finck /******************************************************************************
112c2c66affSColin Finck  * MSXML ClassFactory
113c2c66affSColin Finck  */
114c2c66affSColin Finck typedef struct
115c2c66affSColin Finck {
116c2c66affSColin Finck     IClassFactory IClassFactory_iface;
117c2c66affSColin Finck     ClassFactoryCreateInstanceFunc pCreateInstance;
118c2c66affSColin Finck } ClassFactory;
119c2c66affSColin Finck 
120c2c66affSColin Finck typedef struct
121c2c66affSColin Finck {
122c2c66affSColin Finck     IClassFactory IClassFactory_iface;
123c2c66affSColin Finck     LONG ref;
124c2c66affSColin Finck     DOMFactoryCreateInstanceFunc pCreateInstance;
125c2c66affSColin Finck     MSXML_VERSION version;
126c2c66affSColin Finck } DOMFactory;
127c2c66affSColin Finck 
ClassFactory_from_IClassFactory(IClassFactory * iface)128c2c66affSColin Finck static inline ClassFactory *ClassFactory_from_IClassFactory(IClassFactory *iface)
129c2c66affSColin Finck {
130c2c66affSColin Finck     return CONTAINING_RECORD(iface, ClassFactory, IClassFactory_iface);
131c2c66affSColin Finck }
132c2c66affSColin Finck 
ClassFactory_QueryInterface(IClassFactory * iface,REFIID riid,void ** ppobj)133c2c66affSColin Finck static HRESULT WINAPI ClassFactory_QueryInterface(
134c2c66affSColin Finck     IClassFactory *iface,
135c2c66affSColin Finck     REFIID riid,
136c2c66affSColin Finck     void **ppobj )
137c2c66affSColin Finck {
138c2c66affSColin Finck     if (IsEqualGUID(riid, &IID_IUnknown) ||
139c2c66affSColin Finck         IsEqualGUID(riid, &IID_IClassFactory))
140c2c66affSColin Finck     {
141c2c66affSColin Finck         IClassFactory_AddRef( iface );
142c2c66affSColin Finck         *ppobj = iface;
143c2c66affSColin Finck         return S_OK;
144c2c66affSColin Finck     }
145c2c66affSColin Finck 
146c2c66affSColin Finck     FIXME("interface %s not implemented\n", debugstr_guid(riid));
147c2c66affSColin Finck     *ppobj = NULL;
148c2c66affSColin Finck     return E_NOINTERFACE;
149c2c66affSColin Finck }
150c2c66affSColin Finck 
ClassFactory_AddRef(IClassFactory * iface)151c2c66affSColin Finck static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface )
152c2c66affSColin Finck {
153c2c66affSColin Finck     return 2;
154c2c66affSColin Finck }
155c2c66affSColin Finck 
ClassFactory_Release(IClassFactory * iface)156c2c66affSColin Finck static ULONG WINAPI ClassFactory_Release(IClassFactory *iface )
157c2c66affSColin Finck {
158c2c66affSColin Finck     return 1;
159c2c66affSColin Finck }
160c2c66affSColin Finck 
ClassFactory_CreateInstance(IClassFactory * iface,IUnknown * pOuter,REFIID riid,void ** ppobj)161c2c66affSColin Finck static HRESULT WINAPI ClassFactory_CreateInstance(
162c2c66affSColin Finck     IClassFactory *iface,
163c2c66affSColin Finck     IUnknown *pOuter,
164c2c66affSColin Finck     REFIID riid,
165c2c66affSColin Finck     void **ppobj )
166c2c66affSColin Finck {
167c2c66affSColin Finck     ClassFactory *This = ClassFactory_from_IClassFactory(iface);
168c2c66affSColin Finck     IUnknown *punk;
169c2c66affSColin Finck     HRESULT r;
170c2c66affSColin Finck 
171c2c66affSColin Finck     TRACE("%p %s %p\n", pOuter, debugstr_guid(riid), ppobj );
172c2c66affSColin Finck 
173c2c66affSColin Finck     *ppobj = NULL;
174c2c66affSColin Finck 
175c2c66affSColin Finck     if (pOuter)
176c2c66affSColin Finck         return CLASS_E_NOAGGREGATION;
177c2c66affSColin Finck 
178c2c66affSColin Finck     r = This->pCreateInstance( (void**) &punk );
179c2c66affSColin Finck     if (FAILED(r))
180c2c66affSColin Finck         return r;
181c2c66affSColin Finck 
182c2c66affSColin Finck     r = IUnknown_QueryInterface( punk, riid, ppobj );
183c2c66affSColin Finck     IUnknown_Release( punk );
184c2c66affSColin Finck     return r;
185c2c66affSColin Finck }
186c2c66affSColin Finck 
ClassFactory_LockServer(IClassFactory * iface,BOOL dolock)187c2c66affSColin Finck static HRESULT WINAPI ClassFactory_LockServer(
188c2c66affSColin Finck     IClassFactory *iface,
189c2c66affSColin Finck     BOOL dolock)
190c2c66affSColin Finck {
191c2c66affSColin Finck     FIXME("(%p)->(%d),stub!\n",iface,dolock);
192c2c66affSColin Finck     return S_OK;
193c2c66affSColin Finck }
194c2c66affSColin Finck 
DOMFactory_from_IClassFactory(IClassFactory * iface)195c2c66affSColin Finck static inline DOMFactory *DOMFactory_from_IClassFactory(IClassFactory *iface)
196c2c66affSColin Finck {
197c2c66affSColin Finck     return CONTAINING_RECORD(iface, DOMFactory, IClassFactory_iface);
198c2c66affSColin Finck }
199c2c66affSColin Finck 
DOMClassFactory_AddRef(IClassFactory * iface)200c2c66affSColin Finck static ULONG WINAPI DOMClassFactory_AddRef(IClassFactory *iface )
201c2c66affSColin Finck {
202c2c66affSColin Finck     DOMFactory *This = DOMFactory_from_IClassFactory(iface);
203c2c66affSColin Finck     ULONG ref = InterlockedIncrement(&This->ref);
204c2c66affSColin Finck     TRACE("(%p) ref = %u\n", This, ref);
205c2c66affSColin Finck     return ref;
206c2c66affSColin Finck }
207c2c66affSColin Finck 
DOMClassFactory_Release(IClassFactory * iface)208c2c66affSColin Finck static ULONG WINAPI DOMClassFactory_Release(IClassFactory *iface )
209c2c66affSColin Finck {
210c2c66affSColin Finck     DOMFactory *This = DOMFactory_from_IClassFactory(iface);
211c2c66affSColin Finck     ULONG ref = InterlockedDecrement(&This->ref);
212c2c66affSColin Finck     TRACE("(%p) ref = %u\n", This, ref);
213c2c66affSColin Finck     if(!ref) {
214c2c66affSColin Finck         heap_free(This);
215c2c66affSColin Finck     }
216c2c66affSColin Finck     return ref;
217c2c66affSColin Finck }
218c2c66affSColin Finck 
DOMClassFactory_CreateInstance(IClassFactory * iface,IUnknown * pOuter,REFIID riid,void ** ppobj)219c2c66affSColin Finck static HRESULT WINAPI DOMClassFactory_CreateInstance(
220c2c66affSColin Finck     IClassFactory *iface,
221c2c66affSColin Finck     IUnknown *pOuter,
222c2c66affSColin Finck     REFIID riid,
223c2c66affSColin Finck     void **ppobj )
224c2c66affSColin Finck {
225c2c66affSColin Finck     DOMFactory *This = DOMFactory_from_IClassFactory(iface);
226c2c66affSColin Finck     IUnknown *punk;
227c2c66affSColin Finck     HRESULT r;
228c2c66affSColin Finck 
229c2c66affSColin Finck     TRACE("%p %s %p\n", pOuter, debugstr_guid(riid), ppobj );
230c2c66affSColin Finck 
231c2c66affSColin Finck     *ppobj = NULL;
232c2c66affSColin Finck 
233c2c66affSColin Finck     if (pOuter)
234c2c66affSColin Finck         return CLASS_E_NOAGGREGATION;
235c2c66affSColin Finck 
236c2c66affSColin Finck     r = This->pCreateInstance( This->version, (void**) &punk );
237c2c66affSColin Finck     if (FAILED(r))
238c2c66affSColin Finck         return r;
239c2c66affSColin Finck 
240c2c66affSColin Finck     r = IUnknown_QueryInterface( punk, riid, ppobj );
241c2c66affSColin Finck     IUnknown_Release( punk );
242c2c66affSColin Finck     return r;
243c2c66affSColin Finck }
244c2c66affSColin Finck 
245c2c66affSColin Finck static const struct IClassFactoryVtbl ClassFactoryVtbl =
246c2c66affSColin Finck {
247c2c66affSColin Finck     ClassFactory_QueryInterface,
248c2c66affSColin Finck     ClassFactory_AddRef,
249c2c66affSColin Finck     ClassFactory_Release,
250c2c66affSColin Finck     ClassFactory_CreateInstance,
251c2c66affSColin Finck     ClassFactory_LockServer
252c2c66affSColin Finck };
253c2c66affSColin Finck 
254c2c66affSColin Finck static const struct IClassFactoryVtbl DOMClassFactoryVtbl =
255c2c66affSColin Finck {
256c2c66affSColin Finck     ClassFactory_QueryInterface,
257c2c66affSColin Finck     DOMClassFactory_AddRef,
258c2c66affSColin Finck     DOMClassFactory_Release,
259c2c66affSColin Finck     DOMClassFactory_CreateInstance,
260c2c66affSColin Finck     ClassFactory_LockServer
261c2c66affSColin Finck };
262c2c66affSColin Finck 
DOMClassFactory_Create(const GUID * clsid,REFIID riid,void ** ppv,DOMFactoryCreateInstanceFunc fnCreateInstance)263c2c66affSColin Finck static HRESULT DOMClassFactory_Create(const GUID *clsid, REFIID riid, void **ppv, DOMFactoryCreateInstanceFunc fnCreateInstance)
264c2c66affSColin Finck {
265c2c66affSColin Finck     DOMFactory *ret = heap_alloc(sizeof(DOMFactory));
266c2c66affSColin Finck     HRESULT hres;
267c2c66affSColin Finck 
268c2c66affSColin Finck     ret->IClassFactory_iface.lpVtbl = &DOMClassFactoryVtbl;
269c2c66affSColin Finck     ret->ref = 0;
270c2c66affSColin Finck     ret->version = get_msxml_version(clsid);
271c2c66affSColin Finck     ret->pCreateInstance = fnCreateInstance;
272c2c66affSColin Finck 
273c2c66affSColin Finck     hres = IClassFactory_QueryInterface(&ret->IClassFactory_iface, riid, ppv);
274c2c66affSColin Finck     if(FAILED(hres)) {
275c2c66affSColin Finck         heap_free(ret);
276c2c66affSColin Finck         *ppv = NULL;
277c2c66affSColin Finck     }
278c2c66affSColin Finck     return hres;
279c2c66affSColin Finck }
280c2c66affSColin Finck 
281c2c66affSColin Finck static ClassFactory xmldoccf = { { &ClassFactoryVtbl }, XMLDocument_create };
282c2c66affSColin Finck static ClassFactory httpreqcf = { { &ClassFactoryVtbl }, XMLHTTPRequest_create };
283c2c66affSColin Finck static ClassFactory serverhttp = { { &ClassFactoryVtbl }, ServerXMLHTTP_create };
284c2c66affSColin Finck static ClassFactory xsltemplatecf = { { &ClassFactoryVtbl }, XSLTemplate_create };
285c2c66affSColin Finck static ClassFactory mxnsmanagercf = { {&ClassFactoryVtbl }, MXNamespaceManager_create };
286c2c66affSColin Finck static ClassFactory xmlparsercf = { { &ClassFactoryVtbl }, XMLParser_create };
287c2c66affSColin Finck static ClassFactory xmlviewcf = { { &ClassFactoryVtbl }, XMLView_create };
288c2c66affSColin Finck 
289c2c66affSColin Finck /******************************************************************
290c2c66affSColin Finck  *		DllGetClassObject (MSXML3.@)
291c2c66affSColin Finck  */
DllGetClassObject(REFCLSID rclsid,REFIID riid,void ** ppv)292c2c66affSColin Finck HRESULT WINAPI DllGetClassObject( REFCLSID rclsid, REFIID riid, void **ppv )
293c2c66affSColin Finck {
294c2c66affSColin Finck     IClassFactory *cf = NULL;
295c2c66affSColin Finck 
296c2c66affSColin Finck     TRACE("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv );
297c2c66affSColin Finck 
298c2c66affSColin Finck     if( IsEqualCLSID( rclsid, &CLSID_DOMDocument )  ||  /* Version indep. v 2.x */
299c2c66affSColin Finck         IsEqualCLSID( rclsid, &CLSID_DOMDocument2 ) ||  /* Version indep. v 3.0 */
300c2c66affSColin Finck         IsEqualCLSID( rclsid, &CLSID_DOMDocument26 )||  /* Version dep.   v 2.6 */
301c2c66affSColin Finck         IsEqualCLSID( rclsid, &CLSID_DOMDocument30 )||  /* Version dep.   v 3.0 */
302c2c66affSColin Finck         IsEqualCLSID( rclsid, &CLSID_DOMDocument40 )||  /* Version dep.   v 4.0 */
303c2c66affSColin Finck         IsEqualCLSID( rclsid, &CLSID_DOMDocument60 ))   /* Version dep.   v 6.0 */
304c2c66affSColin Finck     {
305c2c66affSColin Finck         return DOMClassFactory_Create(rclsid, riid, ppv, DOMDocument_create);
306c2c66affSColin Finck     }
307c2c66affSColin Finck     else if( IsEqualCLSID( rclsid, &CLSID_XMLSchemaCache )   ||
308c2c66affSColin Finck              IsEqualCLSID( rclsid, &CLSID_XMLSchemaCache26 ) ||
309c2c66affSColin Finck              IsEqualCLSID( rclsid, &CLSID_XMLSchemaCache30 ) ||
310c2c66affSColin Finck              IsEqualCLSID( rclsid, &CLSID_XMLSchemaCache40 ) ||
311c2c66affSColin Finck              IsEqualCLSID( rclsid, &CLSID_XMLSchemaCache60 ))
312c2c66affSColin Finck     {
313c2c66affSColin Finck         return DOMClassFactory_Create(rclsid, riid, ppv, SchemaCache_create);
314c2c66affSColin Finck     }
315c2c66affSColin Finck     else if( IsEqualCLSID( rclsid, &CLSID_XMLDocument ) )
316c2c66affSColin Finck     {
317c2c66affSColin Finck         cf = &xmldoccf.IClassFactory_iface;
318c2c66affSColin Finck     }
319c2c66affSColin Finck     else if( IsEqualCLSID( rclsid, &CLSID_DOMFreeThreadedDocument )   ||   /* Version indep. v 2.x */
320c2c66affSColin Finck              IsEqualCLSID( rclsid, &CLSID_FreeThreadedDOMDocument )   ||
321c2c66affSColin Finck              IsEqualCLSID( rclsid, &CLSID_FreeThreadedDOMDocument26 ) ||
322c2c66affSColin Finck              IsEqualCLSID( rclsid, &CLSID_FreeThreadedDOMDocument30 ) ||
323c2c66affSColin Finck              IsEqualCLSID( rclsid, &CLSID_FreeThreadedDOMDocument40 ) ||
324c2c66affSColin Finck              IsEqualCLSID( rclsid, &CLSID_FreeThreadedDOMDocument60 ))
325c2c66affSColin Finck     {
326c2c66affSColin Finck         return DOMClassFactory_Create(rclsid, riid, ppv, DOMDocument_create);
327c2c66affSColin Finck     }
328c2c66affSColin Finck     else if( IsEqualCLSID( rclsid, &CLSID_SAXXMLReader) ||
329c2c66affSColin Finck              IsEqualCLSID( rclsid, &CLSID_SAXXMLReader30 ) ||
330c2c66affSColin Finck              IsEqualCLSID( rclsid, &CLSID_SAXXMLReader40 ) ||
331c2c66affSColin Finck              IsEqualCLSID( rclsid, &CLSID_SAXXMLReader60 ))
332c2c66affSColin Finck     {
333c2c66affSColin Finck         return DOMClassFactory_Create(rclsid, riid, ppv, SAXXMLReader_create);
334c2c66affSColin Finck     }
335c2c66affSColin Finck     else if( IsEqualCLSID( rclsid, &CLSID_XMLHTTPRequest ) ||
336c2c66affSColin Finck              IsEqualCLSID( rclsid, &CLSID_XMLHTTP) ||
337c2c66affSColin Finck              IsEqualCLSID( rclsid, &CLSID_XMLHTTP26 ) ||
338c2c66affSColin Finck              IsEqualCLSID( rclsid, &CLSID_XMLHTTP30 ) ||
339c2c66affSColin Finck              IsEqualCLSID( rclsid, &CLSID_XMLHTTP40 ) ||
340c2c66affSColin Finck              IsEqualCLSID( rclsid, &CLSID_XMLHTTP60 ))
341c2c66affSColin Finck     {
342c2c66affSColin Finck         cf = &httpreqcf.IClassFactory_iface;
343c2c66affSColin Finck     }
344c2c66affSColin Finck     else if( IsEqualCLSID( rclsid, &CLSID_ServerXMLHTTP ) ||
345c2c66affSColin Finck              IsEqualCLSID( rclsid, &CLSID_ServerXMLHTTP30 ) ||
346c2c66affSColin Finck              IsEqualCLSID( rclsid, &CLSID_ServerXMLHTTP40 ) ||
347c2c66affSColin Finck              IsEqualCLSID( rclsid, &CLSID_ServerXMLHTTP60 ))
348c2c66affSColin Finck     {
349c2c66affSColin Finck         cf = &serverhttp.IClassFactory_iface;
350c2c66affSColin Finck     }
351c2c66affSColin Finck     else if( IsEqualCLSID( rclsid, &CLSID_XSLTemplate )   ||
352c2c66affSColin Finck              IsEqualCLSID( rclsid, &CLSID_XSLTemplate26 ) ||
353c2c66affSColin Finck              IsEqualCLSID( rclsid, &CLSID_XSLTemplate30 ) ||
354c2c66affSColin Finck              IsEqualCLSID( rclsid, &CLSID_XSLTemplate40 ) ||
355c2c66affSColin Finck              IsEqualCLSID( rclsid, &CLSID_XSLTemplate60 ))
356c2c66affSColin Finck     {
357c2c66affSColin Finck         cf = &xsltemplatecf.IClassFactory_iface;
358c2c66affSColin Finck     }
359c2c66affSColin Finck     else if( IsEqualCLSID( rclsid, &CLSID_MXXMLWriter )   ||
360c2c66affSColin Finck              IsEqualCLSID( rclsid, &CLSID_MXXMLWriter30 ) ||
361c2c66affSColin Finck              IsEqualCLSID( rclsid, &CLSID_MXXMLWriter40 ) ||
362c2c66affSColin Finck              IsEqualCLSID( rclsid, &CLSID_MXXMLWriter60 ) )
363c2c66affSColin Finck     {
364c2c66affSColin Finck         return DOMClassFactory_Create(rclsid, riid, ppv, MXWriter_create);
365c2c66affSColin Finck     }
366c2c66affSColin Finck     else if( IsEqualCLSID( rclsid, &CLSID_SAXAttributes) ||
367c2c66affSColin Finck              IsEqualCLSID( rclsid, &CLSID_SAXAttributes30 ) ||
368c2c66affSColin Finck              IsEqualCLSID( rclsid, &CLSID_SAXAttributes40 ) ||
369c2c66affSColin Finck              IsEqualCLSID( rclsid, &CLSID_SAXAttributes60 ))
370c2c66affSColin Finck     {
371c2c66affSColin Finck         return DOMClassFactory_Create(rclsid, riid, ppv, SAXAttributes_create);
372c2c66affSColin Finck     }
373c2c66affSColin Finck     else if( IsEqualCLSID( rclsid, &CLSID_MXNamespaceManager ) ||
374c2c66affSColin Finck              IsEqualCLSID( rclsid, &CLSID_MXNamespaceManager40 ) ||
375c2c66affSColin Finck              IsEqualCLSID( rclsid, &CLSID_MXNamespaceManager60 ) )
376c2c66affSColin Finck     {
377c2c66affSColin Finck         cf = &mxnsmanagercf.IClassFactory_iface;
378c2c66affSColin Finck     }
379c2c66affSColin Finck     else if( IsEqualCLSID( rclsid, &CLSID_XMLParser )  ||
380c2c66affSColin Finck              IsEqualCLSID( rclsid, &CLSID_XMLParser26 ) ||
381c2c66affSColin Finck              IsEqualCLSID( rclsid, &CLSID_XMLParser30 )  )
382c2c66affSColin Finck     {
383c2c66affSColin Finck         cf = &xmlparsercf.IClassFactory_iface;
384c2c66affSColin Finck     }
385c2c66affSColin Finck     else if( IsEqualCLSID( rclsid, &CLSID_XMLView ) )
386c2c66affSColin Finck     {
387c2c66affSColin Finck         cf = &xmlviewcf.IClassFactory_iface;
388c2c66affSColin Finck     }
389c2c66affSColin Finck 
390c2c66affSColin Finck     if ( !cf )
391c2c66affSColin Finck         return CLASS_E_CLASSNOTAVAILABLE;
392c2c66affSColin Finck 
393c2c66affSColin Finck     return IClassFactory_QueryInterface( cf, riid, ppv );
394c2c66affSColin Finck }
395