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
33 /* undef the #define in msxml2 so that we can access the v.2 version
34 independent CLSID as well as the v.3 one. */
35 #undef CLSID_DOMDocument
37 #include "wine/debug.h"
39 #include "msxml_private.h"
41 WINE_DEFAULT_DEBUG_CHANNEL(msxml
);
43 typedef HRESULT (*fnCreateInstance
)(IUnknown
*pUnkOuter
, LPVOID
*ppObj
);
45 /******************************************************************************
50 const struct IClassFactoryVtbl
*lpVtbl
;
51 fnCreateInstance pfnCreateInstance
;
54 static inline xmlcf
*impl_from_IClassFactory( IClassFactory
*iface
)
56 return (xmlcf
*)((char*)iface
- FIELD_OFFSET(xmlcf
, lpVtbl
));
59 static HRESULT WINAPI
xmlcf_QueryInterface(
64 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
65 IsEqualGUID(riid
, &IID_IClassFactory
))
67 IClassFactory_AddRef( iface
);
72 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
76 static ULONG WINAPI
xmlcf_AddRef(
77 IClassFactory
*iface
)
82 static ULONG WINAPI
xmlcf_Release(
83 IClassFactory
*iface
)
88 static HRESULT WINAPI
xmlcf_CreateInstance(
94 xmlcf
*This
= impl_from_IClassFactory( iface
);
98 TRACE("%p %s %p\n", pOuter
, debugstr_guid(riid
), ppobj
);
103 return CLASS_E_NOAGGREGATION
;
105 r
= This
->pfnCreateInstance( pOuter
, (LPVOID
*) &punk
);
109 r
= IUnknown_QueryInterface( punk
, riid
, ppobj
);
112 IUnknown_Release( punk
);
116 static HRESULT WINAPI
xmlcf_LockServer(
117 IClassFactory
*iface
,
120 FIXME("(%p)->(%d),stub!\n",iface
,dolock
);
124 static const struct IClassFactoryVtbl xmlcf_vtbl
=
126 xmlcf_QueryInterface
,
129 xmlcf_CreateInstance
,
133 static xmlcf domdoccf
= { &xmlcf_vtbl
, DOMDocument_create
};
135 /******************************************************************
136 * DllGetClassObject (MSXML3.@)
138 HRESULT WINAPI
DllGetClassObject( REFCLSID rclsid
, REFIID iid
, LPVOID
*ppv
)
140 IClassFactory
*cf
= NULL
;
142 TRACE("%s %s %p\n", debugstr_guid(rclsid
), debugstr_guid(iid
), ppv
);
144 if( IsEqualGUID( rclsid
, &CLSID_DOMDocument
) || /* Version indep. v 2.x */
145 IsEqualGUID( rclsid
, &CLSID_DOMDocument2
) || /* Version indep. v 3.0 */
146 IsEqualGUID( rclsid
, &CLSID_DOMDocument30
) ) /* Version dep. v 3.0 */
147 cf
= (IClassFactory
*) &domdoccf
.lpVtbl
;
150 return CLASS_E_CLASSNOTAVAILABLE
;
152 return IClassFactory_QueryInterface( cf
, iid
, ppv
);