ReactOS 0.4.16-dev-252-g9ccafe8
factory.c File Reference
#include "config.h"
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "ole2.h"
#include "msxml.h"
#include "msxml2.h"
#include "xmlparser.h"
#include "wine/debug.h"
#include "msxml_private.h"
Include dependency graph for factory.c:

Go to the source code of this file.

Classes

struct  clsid_version_t
 
class  ClassFactory
 
struct  DOMFactory
 

Macros

#define COBJMACROS
 

Typedefs

typedef HRESULT(* ClassFactoryCreateInstanceFunc) (void **)
 
typedef HRESULT(* DOMFactoryCreateInstanceFunc) (MSXML_VERSION, void **)
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (msxml)
 
static MSXML_VERSION get_msxml_version (const GUID *clsid)
 
static ClassFactoryClassFactory_from_IClassFactory (IClassFactory *iface)
 
static HRESULT WINAPI ClassFactory_QueryInterface (IClassFactory *iface, REFIID riid, void **ppobj)
 
static ULONG WINAPI ClassFactory_AddRef (IClassFactory *iface)
 
static ULONG WINAPI ClassFactory_Release (IClassFactory *iface)
 
static HRESULT WINAPI ClassFactory_CreateInstance (IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **ppobj)
 
static HRESULT WINAPI ClassFactory_LockServer (IClassFactory *iface, BOOL dolock)
 
static DOMFactoryDOMFactory_from_IClassFactory (IClassFactory *iface)
 
static ULONG WINAPI DOMClassFactory_AddRef (IClassFactory *iface)
 
static ULONG WINAPI DOMClassFactory_Release (IClassFactory *iface)
 
static HRESULT WINAPI DOMClassFactory_CreateInstance (IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **ppobj)
 
static HRESULT DOMClassFactory_Create (const GUID *clsid, REFIID riid, void **ppv, DOMFactoryCreateInstanceFunc fnCreateInstance)
 
HRESULT WINAPI DllGetClassObject (REFCLSID rclsid, REFIID riid, void **ppv)
 

Variables

static const struct clsid_version_t clsid_versions_table []
 
static const struct IClassFactoryVtbl ClassFactoryVtbl
 
static const struct IClassFactoryVtbl DOMClassFactoryVtbl
 
static ClassFactory xmldoccf = { { &ClassFactoryVtbl }, XMLDocument_create }
 
static ClassFactory httpreqcf = { { &ClassFactoryVtbl }, XMLHTTPRequest_create }
 
static ClassFactory serverhttp = { { &ClassFactoryVtbl }, ServerXMLHTTP_create }
 
static ClassFactory xsltemplatecf = { { &ClassFactoryVtbl }, XSLTemplate_create }
 
static ClassFactory mxnsmanagercf = { {&ClassFactoryVtbl }, MXNamespaceManager_create }
 
static ClassFactory xmlparsercf = { { &ClassFactoryVtbl }, XMLParser_create }
 
static ClassFactory xmlviewcf = { { &ClassFactoryVtbl }, XMLView_create }
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 22 of file factory.c.

Typedef Documentation

◆ ClassFactoryCreateInstanceFunc

typedef HRESULT(* ClassFactoryCreateInstanceFunc) (void **)

Definition at line 50 of file factory.c.

◆ DOMFactoryCreateInstanceFunc

typedef HRESULT(* DOMFactoryCreateInstanceFunc) (MSXML_VERSION, void **)

Definition at line 51 of file factory.c.

Function Documentation

◆ ClassFactory_AddRef()

static ULONG WINAPI ClassFactory_AddRef ( IClassFactory iface)
static

Definition at line 151 of file factory.c.

152{
153 return 2;
154}

◆ ClassFactory_CreateInstance()

static HRESULT WINAPI ClassFactory_CreateInstance ( IClassFactory iface,
IUnknown pOuter,
REFIID  riid,
void **  ppobj 
)
static

Definition at line 161 of file factory.c.

166{
168 IUnknown *punk;
169 HRESULT r;
170
171 TRACE("%p %s %p\n", pOuter, debugstr_guid(riid), ppobj );
172
173 *ppobj = NULL;
174
175 if (pOuter)
177
178 r = This->pCreateInstance( (void**) &punk );
179 if (FAILED(r))
180 return r;
181
182 r = IUnknown_QueryInterface( punk, riid, ppobj );
183 IUnknown_Release( punk );
184 return r;
185}
#define NULL
Definition: types.h:112
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
REFIID riid
Definition: atlbase.h:39
#define FAILED(hr)
Definition: intsafe.h:51
#define debugstr_guid
Definition: kernel32.h:35
static ClassFactory * ClassFactory_from_IClassFactory(IClassFactory *iface)
Definition: factory.c:128
#define TRACE(s)
Definition: solgame.cpp:4
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:2662

◆ ClassFactory_from_IClassFactory()

static ClassFactory * ClassFactory_from_IClassFactory ( IClassFactory iface)
inlinestatic

Definition at line 128 of file factory.c.

129{
130 return CONTAINING_RECORD(iface, ClassFactory, IClassFactory_iface);
131}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by ClassFactory_CreateInstance().

◆ ClassFactory_LockServer()

static HRESULT WINAPI ClassFactory_LockServer ( IClassFactory iface,
BOOL  dolock 
)
static

Definition at line 187 of file factory.c.

190{
191 FIXME("(%p)->(%d),stub!\n",iface,dolock);
192 return S_OK;
193}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define S_OK
Definition: intsafe.h:52

◆ ClassFactory_QueryInterface()

static HRESULT WINAPI ClassFactory_QueryInterface ( IClassFactory iface,
REFIID  riid,
void **  ppobj 
)
static

Definition at line 133 of file factory.c.

137{
140 {
141 IClassFactory_AddRef( iface );
142 *ppobj = iface;
143 return S_OK;
144 }
145
146 FIXME("interface %s not implemented\n", debugstr_guid(riid));
147 *ppobj = NULL;
148 return E_NOINTERFACE;
149}
const GUID IID_IUnknown
const GUID IID_IClassFactory
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ ClassFactory_Release()

static ULONG WINAPI ClassFactory_Release ( IClassFactory iface)
static

Definition at line 156 of file factory.c.

157{
158 return 1;
159}

◆ DllGetClassObject()

HRESULT WINAPI DllGetClassObject ( REFCLSID  rclsid,
REFIID  riid,
void **  ppv 
)

Definition at line 292 of file factory.c.

293{
295
296 TRACE("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv );
297
298 if( IsEqualCLSID( rclsid, &CLSID_DOMDocument ) || /* Version indep. v 2.x */
299 IsEqualCLSID( rclsid, &CLSID_DOMDocument2 ) || /* Version indep. v 3.0 */
300 IsEqualCLSID( rclsid, &CLSID_DOMDocument26 )|| /* Version dep. v 2.6 */
301 IsEqualCLSID( rclsid, &CLSID_DOMDocument30 )|| /* Version dep. v 3.0 */
302 IsEqualCLSID( rclsid, &CLSID_DOMDocument40 )|| /* Version dep. v 4.0 */
303 IsEqualCLSID( rclsid, &CLSID_DOMDocument60 )) /* Version dep. v 6.0 */
304 {
306 }
307 else if( IsEqualCLSID( rclsid, &CLSID_XMLSchemaCache ) ||
308 IsEqualCLSID( rclsid, &CLSID_XMLSchemaCache26 ) ||
309 IsEqualCLSID( rclsid, &CLSID_XMLSchemaCache30 ) ||
310 IsEqualCLSID( rclsid, &CLSID_XMLSchemaCache40 ) ||
311 IsEqualCLSID( rclsid, &CLSID_XMLSchemaCache60 ))
312 {
314 }
315 else if( IsEqualCLSID( rclsid, &CLSID_XMLDocument ) )
316 {
318 }
319 else if( IsEqualCLSID( rclsid, &CLSID_DOMFreeThreadedDocument ) || /* Version indep. v 2.x */
320 IsEqualCLSID( rclsid, &CLSID_FreeThreadedDOMDocument ) ||
321 IsEqualCLSID( rclsid, &CLSID_FreeThreadedDOMDocument26 ) ||
322 IsEqualCLSID( rclsid, &CLSID_FreeThreadedDOMDocument30 ) ||
323 IsEqualCLSID( rclsid, &CLSID_FreeThreadedDOMDocument40 ) ||
324 IsEqualCLSID( rclsid, &CLSID_FreeThreadedDOMDocument60 ))
325 {
327 }
328 else if( IsEqualCLSID( rclsid, &CLSID_SAXXMLReader) ||
329 IsEqualCLSID( rclsid, &CLSID_SAXXMLReader30 ) ||
330 IsEqualCLSID( rclsid, &CLSID_SAXXMLReader40 ) ||
331 IsEqualCLSID( rclsid, &CLSID_SAXXMLReader60 ))
332 {
334 }
335 else if( IsEqualCLSID( rclsid, &CLSID_XMLHTTPRequest ) ||
336 IsEqualCLSID( rclsid, &CLSID_XMLHTTP) ||
337 IsEqualCLSID( rclsid, &CLSID_XMLHTTP26 ) ||
338 IsEqualCLSID( rclsid, &CLSID_XMLHTTP30 ) ||
339 IsEqualCLSID( rclsid, &CLSID_XMLHTTP40 ) ||
340 IsEqualCLSID( rclsid, &CLSID_XMLHTTP60 ))
341 {
343 }
344 else if( IsEqualCLSID( rclsid, &CLSID_ServerXMLHTTP ) ||
345 IsEqualCLSID( rclsid, &CLSID_ServerXMLHTTP30 ) ||
346 IsEqualCLSID( rclsid, &CLSID_ServerXMLHTTP40 ) ||
347 IsEqualCLSID( rclsid, &CLSID_ServerXMLHTTP60 ))
348 {
350 }
351 else if( IsEqualCLSID( rclsid, &CLSID_XSLTemplate ) ||
352 IsEqualCLSID( rclsid, &CLSID_XSLTemplate26 ) ||
353 IsEqualCLSID( rclsid, &CLSID_XSLTemplate30 ) ||
354 IsEqualCLSID( rclsid, &CLSID_XSLTemplate40 ) ||
355 IsEqualCLSID( rclsid, &CLSID_XSLTemplate60 ))
356 {
358 }
359 else if( IsEqualCLSID( rclsid, &CLSID_MXXMLWriter ) ||
360 IsEqualCLSID( rclsid, &CLSID_MXXMLWriter30 ) ||
361 IsEqualCLSID( rclsid, &CLSID_MXXMLWriter40 ) ||
362 IsEqualCLSID( rclsid, &CLSID_MXXMLWriter60 ) )
363 {
365 }
366 else if( IsEqualCLSID( rclsid, &CLSID_SAXAttributes) ||
367 IsEqualCLSID( rclsid, &CLSID_SAXAttributes30 ) ||
368 IsEqualCLSID( rclsid, &CLSID_SAXAttributes40 ) ||
369 IsEqualCLSID( rclsid, &CLSID_SAXAttributes60 ))
370 {
372 }
373 else if( IsEqualCLSID( rclsid, &CLSID_MXNamespaceManager ) ||
374 IsEqualCLSID( rclsid, &CLSID_MXNamespaceManager40 ) ||
375 IsEqualCLSID( rclsid, &CLSID_MXNamespaceManager60 ) )
376 {
378 }
379 else if( IsEqualCLSID( rclsid, &CLSID_XMLParser ) ||
380 IsEqualCLSID( rclsid, &CLSID_XMLParser26 ) ||
381 IsEqualCLSID( rclsid, &CLSID_XMLParser30 ) )
382 {
384 }
385 else if( IsEqualCLSID( rclsid, &CLSID_XMLView ) )
386 {
388 }
389
390 if ( !cf )
392
393 return IClassFactory_QueryInterface( cf, riid, ppv );
394}
HRESULT DOMDocument_create(MSXML_VERSION version, void **ppObj)
Definition: domdoc.c:3727
REFIID LPVOID * ppv
Definition: atlbase.h:39
static ClassFactory xmlparsercf
Definition: factory.c:286
static ClassFactory mxnsmanagercf
Definition: factory.c:285
static ClassFactory serverhttp
Definition: factory.c:283
static ClassFactory xmldoccf
Definition: factory.c:281
static ClassFactory xmlviewcf
Definition: factory.c:287
static HRESULT DOMClassFactory_Create(const GUID *clsid, REFIID riid, void **ppv, DOMFactoryCreateInstanceFunc fnCreateInstance)
Definition: factory.c:263
static ClassFactory xsltemplatecf
Definition: factory.c:284
static ClassFactory httpreqcf
Definition: factory.c:282
const struct _GUID CLSID_DOMDocument
const struct _GUID CLSID_DOMFreeThreadedDocument
const struct _GUID CLSID_XMLDocument
const struct _GUID CLSID_XMLHTTPRequest
HRESULT SAXXMLReader_create(MSXML_VERSION, void **) DECLSPEC_HIDDEN
HRESULT MXWriter_create(MSXML_VERSION, void **) DECLSPEC_HIDDEN
Definition: mxwriter.c:2585
HRESULT SAXAttributes_create(MSXML_VERSION, void **) DECLSPEC_HIDDEN
Definition: mxwriter.c:3553
HRESULT SchemaCache_create(MSXML_VERSION, void **) DECLSPEC_HIDDEN
Definition: schema.c:1647
#define IsEqualCLSID(rclsid1, rclsid2)
Definition: guiddef.h:96
IClassFactory IClassFactory_iface
Definition: main.c:210
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:2663

◆ DOMClassFactory_AddRef()

static ULONG WINAPI DOMClassFactory_AddRef ( IClassFactory iface)
static

Definition at line 200 of file factory.c.

201{
204 TRACE("(%p) ref = %u\n", This, ref);
205 return ref;
206}
#define InterlockedIncrement
Definition: armddk.h:53
static DOMFactory * DOMFactory_from_IClassFactory(IClassFactory *iface)
Definition: factory.c:195
Definition: send.c:48
uint32_t ULONG
Definition: typedefs.h:59

◆ DOMClassFactory_Create()

static HRESULT DOMClassFactory_Create ( const GUID clsid,
REFIID  riid,
void **  ppv,
DOMFactoryCreateInstanceFunc  fnCreateInstance 
)
static

Definition at line 263 of file factory.c.

264{
267
268 ret->IClassFactory_iface.lpVtbl = &DOMClassFactoryVtbl;
269 ret->ref = 0;
270 ret->version = get_msxml_version(clsid);
271 ret->pCreateInstance = fnCreateInstance;
272
273 hres = IClassFactory_QueryInterface(&ret->IClassFactory_iface, riid, ppv);
274 if(FAILED(hres)) {
275 heap_free(ret);
276 *ppv = NULL;
277 }
278 return hres;
279}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
HRESULT(* fnCreateInstance)(IUnknown *pUnkOuter, LPVOID *ppObj)
Definition: hnetcfg.c:37
HRESULT hres
Definition: protocol.c:465
REFCLSID clsid
Definition: msctf.c:82
static const struct IClassFactoryVtbl DOMClassFactoryVtbl
Definition: factory.c:254
static MSXML_VERSION get_msxml_version(const GUID *clsid)
Definition: factory.c:99
int ret

Referenced by DllGetClassObject().

◆ DOMClassFactory_CreateInstance()

static HRESULT WINAPI DOMClassFactory_CreateInstance ( IClassFactory iface,
IUnknown pOuter,
REFIID  riid,
void **  ppobj 
)
static

Definition at line 219 of file factory.c.

224{
226 IUnknown *punk;
227 HRESULT r;
228
229 TRACE("%p %s %p\n", pOuter, debugstr_guid(riid), ppobj );
230
231 *ppobj = NULL;
232
233 if (pOuter)
235
236 r = This->pCreateInstance( This->version, (void**) &punk );
237 if (FAILED(r))
238 return r;
239
240 r = IUnknown_QueryInterface( punk, riid, ppobj );
241 IUnknown_Release( punk );
242 return r;
243}

◆ DOMClassFactory_Release()

static ULONG WINAPI DOMClassFactory_Release ( IClassFactory iface)
static

Definition at line 208 of file factory.c.

209{
212 TRACE("(%p) ref = %u\n", This, ref);
213 if(!ref) {
215 }
216 return ref;
217}
#define InterlockedDecrement
Definition: armddk.h:52

◆ DOMFactory_from_IClassFactory()

static DOMFactory * DOMFactory_from_IClassFactory ( IClassFactory iface)
inlinestatic

Definition at line 195 of file factory.c.

196{
197 return CONTAINING_RECORD(iface, DOMFactory, IClassFactory_iface);
198}

Referenced by DOMClassFactory_AddRef(), DOMClassFactory_CreateInstance(), and DOMClassFactory_Release().

◆ get_msxml_version()

static MSXML_VERSION get_msxml_version ( const GUID clsid)
static

Definition at line 99 of file factory.c.

100{
101 unsigned int i;
102
103 for (i = 0; i < ARRAY_SIZE(clsid_versions_table); i++)
106
107 ERR("unknown clsid=%s\n", debugstr_guid(clsid));
108 return MSXML_DEFAULT;
109}
#define ARRAY_SIZE(A)
Definition: main.h:20
#define ERR(fmt,...)
Definition: precomp.h:57
static const WCHAR version[]
Definition: asmname.c:66
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static const struct clsid_version_t clsid_versions_table[]
Definition: factory.c:59
@ MSXML_DEFAULT
Definition: msxml_private.h:35

Referenced by DOMClassFactory_Create().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( msxml  )

Variable Documentation

◆ ClassFactoryVtbl

const struct IClassFactoryVtbl ClassFactoryVtbl
static
Initial value:
=
{
}
static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **ppobj)
Definition: factory.c:161
static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
Definition: factory.c:187
static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
Definition: factory.c:156
static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
Definition: factory.c:151
static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppobj)
Definition: factory.c:133

Definition at line 245 of file factory.c.

◆ clsid_versions_table

const struct clsid_version_t clsid_versions_table[]
static

Definition at line 59 of file factory.c.

Referenced by get_msxml_version().

◆ DOMClassFactoryVtbl

const struct IClassFactoryVtbl DOMClassFactoryVtbl
static
Initial value:
=
{
}
static HRESULT WINAPI DOMClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **ppobj)
Definition: factory.c:219
static ULONG WINAPI DOMClassFactory_Release(IClassFactory *iface)
Definition: factory.c:208
static ULONG WINAPI DOMClassFactory_AddRef(IClassFactory *iface)
Definition: factory.c:200

Definition at line 254 of file factory.c.

Referenced by DOMClassFactory_Create().

◆ httpreqcf

ClassFactory httpreqcf = { { &ClassFactoryVtbl }, XMLHTTPRequest_create }
static

Definition at line 282 of file factory.c.

Referenced by DllGetClassObject().

◆ mxnsmanagercf

ClassFactory mxnsmanagercf = { {&ClassFactoryVtbl }, MXNamespaceManager_create }
static

Definition at line 285 of file factory.c.

Referenced by DllGetClassObject().

◆ serverhttp

ClassFactory serverhttp = { { &ClassFactoryVtbl }, ServerXMLHTTP_create }
static

Definition at line 283 of file factory.c.

Referenced by DllGetClassObject().

◆ xmldoccf

ClassFactory xmldoccf = { { &ClassFactoryVtbl }, XMLDocument_create }
static

Definition at line 281 of file factory.c.

Referenced by DllGetClassObject().

◆ xmlparsercf

ClassFactory xmlparsercf = { { &ClassFactoryVtbl }, XMLParser_create }
static

Definition at line 286 of file factory.c.

Referenced by DllGetClassObject().

◆ xmlviewcf

ClassFactory xmlviewcf = { { &ClassFactoryVtbl }, XMLView_create }
static

Definition at line 287 of file factory.c.

Referenced by DllGetClassObject().

◆ xsltemplatecf

ClassFactory xsltemplatecf = { { &ClassFactoryVtbl }, XSLTemplate_create }
static

Definition at line 284 of file factory.c.

Referenced by DllGetClassObject().