Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygendomimpl.c
Go to the documentation of this file.
00001 /* 00002 * DOM Document Implementation implementation 00003 * 00004 * Copyright 2007 Alistair Leslie-Hughes 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 00019 */ 00020 00021 #define COBJMACROS 00022 00023 #include "config.h" 00024 00025 #include <stdarg.h> 00026 #include "windef.h" 00027 #include "winbase.h" 00028 #include "winuser.h" 00029 #include "ole2.h" 00030 #include "msxml2.h" 00031 00032 #include "msxml_private.h" 00033 00034 #include "wine/debug.h" 00035 00036 WINE_DEFAULT_DEBUG_CHANNEL(msxml); 00037 00038 #ifdef HAVE_LIBXML2 00039 00040 typedef struct _domimpl 00041 { 00042 const struct IXMLDOMImplementationVtbl *lpVtbl; 00043 LONG ref; 00044 } domimpl; 00045 00046 static inline domimpl *impl_from_IXMLDOMImplementation( IXMLDOMImplementation *iface ) 00047 { 00048 return (domimpl *)((char*)iface - FIELD_OFFSET(domimpl, lpVtbl)); 00049 } 00050 00051 static HRESULT WINAPI dimimpl_QueryInterface( 00052 IXMLDOMImplementation *iface, 00053 REFIID riid, 00054 void** ppvObject ) 00055 { 00056 domimpl *This = impl_from_IXMLDOMImplementation( iface ); 00057 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject); 00058 00059 if ( IsEqualGUID( riid, &IID_IXMLDOMImplementation ) || 00060 IsEqualGUID( riid, &IID_IDispatch ) || 00061 IsEqualGUID( riid, &IID_IUnknown ) ) 00062 { 00063 *ppvObject = iface; 00064 } 00065 else 00066 { 00067 FIXME("Unsupported interface %s\n", debugstr_guid(riid)); 00068 return E_NOINTERFACE; 00069 } 00070 00071 IXMLDOMImplementation_AddRef( iface ); 00072 00073 return S_OK; 00074 } 00075 00076 static ULONG WINAPI dimimpl_AddRef( 00077 IXMLDOMImplementation *iface ) 00078 { 00079 domimpl *This = impl_from_IXMLDOMImplementation( iface ); 00080 return InterlockedIncrement( &This->ref ); 00081 } 00082 00083 static ULONG WINAPI dimimpl_Release( 00084 IXMLDOMImplementation *iface ) 00085 { 00086 domimpl *This = impl_from_IXMLDOMImplementation( iface ); 00087 ULONG ref; 00088 00089 ref = InterlockedDecrement( &This->ref ); 00090 if ( ref == 0 ) 00091 { 00092 heap_free( This ); 00093 } 00094 00095 return ref; 00096 } 00097 00098 static HRESULT WINAPI dimimpl_GetTypeInfoCount( 00099 IXMLDOMImplementation *iface, 00100 UINT* pctinfo ) 00101 { 00102 domimpl *This = impl_from_IXMLDOMImplementation( iface ); 00103 00104 TRACE("(%p)->(%p)\n", This, pctinfo); 00105 00106 *pctinfo = 1; 00107 00108 return S_OK; 00109 } 00110 00111 static HRESULT WINAPI dimimpl_GetTypeInfo( 00112 IXMLDOMImplementation *iface, 00113 UINT iTInfo, LCID lcid, 00114 ITypeInfo** ppTInfo ) 00115 { 00116 domimpl *This = impl_from_IXMLDOMImplementation( iface ); 00117 HRESULT hr; 00118 00119 TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo); 00120 00121 hr = get_typeinfo(IXMLDOMImplementation_tid, ppTInfo); 00122 00123 return hr; 00124 } 00125 00126 static HRESULT WINAPI dimimpl_GetIDsOfNames( 00127 IXMLDOMImplementation *iface, 00128 REFIID riid, LPOLESTR* rgszNames, 00129 UINT cNames, LCID lcid, DISPID* rgDispId ) 00130 { 00131 domimpl *This = impl_from_IXMLDOMImplementation( iface ); 00132 ITypeInfo *typeinfo; 00133 HRESULT hr; 00134 00135 TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames, 00136 lcid, rgDispId); 00137 00138 if(!rgszNames || cNames == 0 || !rgDispId) 00139 return E_INVALIDARG; 00140 00141 hr = get_typeinfo(IXMLDOMImplementation_tid, &typeinfo); 00142 if(SUCCEEDED(hr)) 00143 { 00144 hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId); 00145 ITypeInfo_Release(typeinfo); 00146 } 00147 00148 return hr; 00149 } 00150 00151 static HRESULT WINAPI dimimpl_Invoke( 00152 IXMLDOMImplementation *iface, 00153 DISPID dispIdMember, REFIID riid, LCID lcid, 00154 WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult, 00155 EXCEPINFO* pExcepInfo, UINT* puArgErr ) 00156 { 00157 domimpl *This = impl_from_IXMLDOMImplementation( iface ); 00158 ITypeInfo *typeinfo; 00159 HRESULT hr; 00160 00161 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), 00162 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); 00163 00164 hr = get_typeinfo(IXMLDOMImplementation_tid, &typeinfo); 00165 if(SUCCEEDED(hr)) 00166 { 00167 hr = ITypeInfo_Invoke(typeinfo, &(This->lpVtbl), dispIdMember, wFlags, pDispParams, 00168 pVarResult, pExcepInfo, puArgErr); 00169 ITypeInfo_Release(typeinfo); 00170 } 00171 00172 return hr; 00173 } 00174 00175 static HRESULT WINAPI dimimpl_hasFeature(IXMLDOMImplementation* This, BSTR feature, BSTR version, VARIANT_BOOL *hasFeature) 00176 { 00177 static const WCHAR bVersion[] = {'1','.','0',0}; 00178 static const WCHAR bXML[] = {'X','M','L',0}; 00179 static const WCHAR bDOM[] = {'D','O','M',0}; 00180 static const WCHAR bMSDOM[] = {'M','S','-','D','O','M',0}; 00181 BOOL bValidFeature = FALSE; 00182 BOOL bValidVersion = FALSE; 00183 00184 TRACE("(%p)->(%s %s %p)\n", This, debugstr_w(feature), debugstr_w(version), hasFeature); 00185 00186 if(!feature || !hasFeature) 00187 return E_INVALIDARG; 00188 00189 *hasFeature = VARIANT_FALSE; 00190 00191 if(!version || lstrcmpiW(version, bVersion) == 0) 00192 bValidVersion = TRUE; 00193 00194 if(lstrcmpiW(feature, bXML) == 0 || lstrcmpiW(feature, bDOM) == 0 || lstrcmpiW(feature, bMSDOM) == 0) 00195 bValidFeature = TRUE; 00196 00197 if(bValidVersion && bValidFeature) 00198 *hasFeature = VARIANT_TRUE; 00199 00200 return S_OK; 00201 } 00202 00203 static const struct IXMLDOMImplementationVtbl dimimpl_vtbl = 00204 { 00205 dimimpl_QueryInterface, 00206 dimimpl_AddRef, 00207 dimimpl_Release, 00208 dimimpl_GetTypeInfoCount, 00209 dimimpl_GetTypeInfo, 00210 dimimpl_GetIDsOfNames, 00211 dimimpl_Invoke, 00212 dimimpl_hasFeature 00213 }; 00214 00215 IUnknown* create_doc_Implementation(void) 00216 { 00217 domimpl *This; 00218 00219 This = heap_alloc( sizeof *This ); 00220 if ( !This ) 00221 return NULL; 00222 00223 This->lpVtbl = &dimimpl_vtbl; 00224 This->ref = 1; 00225 00226 return (IUnknown*) &This->lpVtbl; 00227 } 00228 00229 #endif Generated on Sat May 26 2012 04:23:55 for ReactOS by
1.7.6.1
|