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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
33 #include "wine/debug.h"
35 #include "msxml_private.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(msxml);
39 typedef HRESULT (*fnCreateInstance)(IUnknown *pUnkOuter, LPVOID *ppObj);
41 /******************************************************************************
46 const struct IClassFactoryVtbl *lpVtbl;
47 fnCreateInstance pfnCreateInstance;
50 static inline xmlcf *impl_from_IClassFactory( IClassFactory *iface )
52 return (xmlcf *)((char*)iface - FIELD_OFFSET(xmlcf, lpVtbl));
55 static HRESULT WINAPI xmlcf_QueryInterface(
60 if (IsEqualGUID(riid, &IID_IUnknown) ||
61 IsEqualGUID(riid, &IID_IClassFactory))
63 IClassFactory_AddRef( iface );
71 static ULONG WINAPI xmlcf_AddRef(
72 IClassFactory *iface )
77 static ULONG WINAPI xmlcf_Release(
78 IClassFactory *iface )
83 static HRESULT WINAPI xmlcf_CreateInstance(
89 xmlcf *This = impl_from_IClassFactory( iface );
93 TRACE("%p %s %p\n", pOuter, debugstr_guid(riid), ppobj );
98 return CLASS_E_NOAGGREGATION;
100 r = This->pfnCreateInstance( pOuter, (LPVOID*) &punk );
104 r = IUnknown_QueryInterface( punk, riid, ppobj );
107 IUnknown_Release( punk );
111 static HRESULT WINAPI xmlcf_LockServer(
112 IClassFactory *iface,
115 FIXME("(%p)->(%d),stub!\n",iface,dolock);
119 const struct IClassFactoryVtbl xmlcf_vtbl =
121 xmlcf_QueryInterface,
124 xmlcf_CreateInstance,
128 static xmlcf domdoccf = { &xmlcf_vtbl, DOMDocument_create };
130 /******************************************************************
131 * DllGetClassObject (MSXML3.@)
133 HRESULT WINAPI DllGetClassObject( REFCLSID rclsid, REFIID iid, LPVOID *ppv )
135 IClassFactory *cf = NULL;
137 TRACE("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(iid), ppv );
139 if( IsEqualGUID( rclsid, &CLSID_DOMDocument ) )
140 cf = (IClassFactory*) &domdoccf.lpVtbl;
143 return CLASS_E_CLASSNOTAVAILABLE;
145 return IClassFactory_QueryInterface( cf, iid, ppv );