2 * DOM Document Implementation implementation
4 * Copyright 2007 Alistair Leslie-Hughes
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
32 #include "msxml_private.h"
34 #include "wine/debug.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(msxml);
40 typedef struct _domimpl
42 const struct IXMLDOMImplementationVtbl *lpVtbl;
46 static inline domimpl *impl_from_IXMLDOMImplementation( IXMLDOMImplementation *iface )
48 return (domimpl *)((char*)iface - FIELD_OFFSET(domimpl, lpVtbl));
51 static HRESULT WINAPI dimimpl_QueryInterface(
52 IXMLDOMImplementation *iface,
56 domimpl *This = impl_from_IXMLDOMImplementation( iface );
57 TRACE("%p %s %p\n", This, debugstr_guid(riid), ppvObject);
59 if ( IsEqualGUID( riid, &IID_IXMLDOMImplementation ) ||
60 IsEqualGUID( riid, &IID_IDispatch ) ||
61 IsEqualGUID( riid, &IID_IUnknown ) )
67 FIXME("Unsupported interface %s\n", debugstr_guid(riid));
71 IXMLDOMImplementation_AddRef( iface );
76 static ULONG WINAPI dimimpl_AddRef(
77 IXMLDOMImplementation *iface )
79 domimpl *This = impl_from_IXMLDOMImplementation( iface );
80 return InterlockedIncrement( &This->ref );
83 static ULONG WINAPI dimimpl_Release(
84 IXMLDOMImplementation *iface )
86 domimpl *This = impl_from_IXMLDOMImplementation( iface );
89 ref = InterlockedDecrement( &This->ref );
92 HeapFree( GetProcessHeap(), 0, This );
98 static HRESULT WINAPI dimimpl_GetTypeInfoCount(
99 IXMLDOMImplementation *iface,
106 static HRESULT WINAPI dimimpl_GetTypeInfo(
107 IXMLDOMImplementation *iface,
108 UINT iTInfo, LCID lcid,
109 ITypeInfo** ppTInfo )
115 static HRESULT WINAPI dimimpl_GetIDsOfNames(
116 IXMLDOMImplementation *iface,
117 REFIID riid, LPOLESTR* rgszNames,
118 UINT cNames, LCID lcid, DISPID* rgDispId )
124 static HRESULT WINAPI dimimpl_Invoke(
125 IXMLDOMImplementation *iface,
126 DISPID dispIdMember, REFIID riid, LCID lcid,
127 WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult,
128 EXCEPINFO* pExcepInfo, UINT* puArgErr )
134 static HRESULT WINAPI dimimpl_hasFeature(IXMLDOMImplementation* This, BSTR feature, BSTR version, VARIANT_BOOL *hasFeature)
136 static WCHAR bVersion[] = {'1','.','0',0};
137 static WCHAR bXML[] = {'X','M','L',0};
138 static WCHAR bDOM[] = {'D','O','M',0};
139 static WCHAR bMSDOM[] = {'M','S','-','D','O','M',0};
140 BOOL bValidFeature = FALSE;
141 BOOL bValidVersion = FALSE;
143 TRACE("feature(%s) version (%s)\n", debugstr_w(feature), debugstr_w(version));
145 if(!feature || !hasFeature)
148 *hasFeature = VARIANT_FALSE;
150 if(!version || lstrcmpiW(version, bVersion) == 0)
151 bValidVersion = TRUE;
153 if(lstrcmpiW(feature, bXML) == 0 || lstrcmpiW(feature, bDOM) == 0 || lstrcmpiW(feature, bMSDOM) == 0)
154 bValidFeature = TRUE;
156 if(bValidVersion && bValidFeature)
157 *hasFeature = VARIANT_TRUE;
162 static const struct IXMLDOMImplementationVtbl dimimpl_vtbl =
164 dimimpl_QueryInterface,
167 dimimpl_GetTypeInfoCount,
169 dimimpl_GetIDsOfNames,
174 IUnknown* create_doc_Implementation()
178 This = HeapAlloc( GetProcessHeap(), 0, sizeof *This );
182 This->lpVtbl = &dimimpl_vtbl;
185 return (IUnknown*) &This->lpVtbl;