mountmgr: Add a Wine-specific ioctl to define a drive for a Unix path.
[wine/multimedia.git] / dlls / msxml3 / parseerror.c
blob4db078b690ea22148e3582ca438a2a60af30e756
1 /*
2 * ParseError implementation
4 * Copyright 2005 Huw Davies
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
22 #define COBJMACROS
24 #include "config.h"
26 #include <stdarg.h>
27 #include <assert.h>
28 #include "windef.h"
29 #include "winbase.h"
30 #include "winerror.h"
31 #include "winuser.h"
32 #include "ole2.h"
33 #include "msxml2.h"
35 #include "msxml_private.h"
37 #include "wine/debug.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(msxml);
41 typedef struct
43 const struct IXMLDOMParseErrorVtbl *lpVtbl;
44 LONG ref;
45 LONG code, line, linepos, filepos;
46 BSTR url, reason, srcText;
47 } parse_error_t;
49 static inline parse_error_t *impl_from_IXMLDOMParseError( IXMLDOMParseError *iface )
51 return (parse_error_t *)((char*)iface - FIELD_OFFSET(parse_error_t, lpVtbl));
54 static HRESULT WINAPI parseError_QueryInterface(
55 IXMLDOMParseError *iface,
56 REFIID riid,
57 void** ppvObject )
59 TRACE("%p %s %p\n", iface, debugstr_guid(riid), ppvObject);
61 if ( IsEqualGUID( riid, &IID_IUnknown ) ||
62 IsEqualGUID( riid, &IID_IDispatch ) ||
63 IsEqualGUID( riid, &IID_IXMLDOMParseError ) )
65 *ppvObject = iface;
67 else
69 FIXME("interface %s not implemented\n", debugstr_guid(riid));
70 return E_NOINTERFACE;
73 IXMLDOMParseError_AddRef( iface );
75 return S_OK;
78 static ULONG WINAPI parseError_AddRef(
79 IXMLDOMParseError *iface )
81 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
82 ULONG ref = InterlockedIncrement( &This->ref );
83 TRACE("(%p) ref now %d\n", This, ref);
84 return ref;
87 static ULONG WINAPI parseError_Release(
88 IXMLDOMParseError *iface )
90 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
91 ULONG ref;
93 ref = InterlockedDecrement( &This->ref );
94 TRACE("(%p) ref now %d\n", This, ref);
95 if ( ref == 0 )
97 SysFreeString(This->url);
98 SysFreeString(This->reason);
99 SysFreeString(This->srcText);
100 HeapFree( GetProcessHeap(), 0, This );
103 return ref;
106 static HRESULT WINAPI parseError_GetTypeInfoCount(
107 IXMLDOMParseError *iface,
108 UINT* pctinfo )
110 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
112 TRACE("(%p)->(%p)\n", This, pctinfo);
114 *pctinfo = 1;
116 return S_OK;
119 static HRESULT WINAPI parseError_GetTypeInfo(
120 IXMLDOMParseError *iface,
121 UINT iTInfo,
122 LCID lcid,
123 ITypeInfo** ppTInfo )
125 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
126 HRESULT hr;
128 TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
130 hr = get_typeinfo(IXMLDOMParseError_tid, ppTInfo);
132 return hr;
135 static HRESULT WINAPI parseError_GetIDsOfNames(
136 IXMLDOMParseError *iface,
137 REFIID riid,
138 LPOLESTR* rgszNames,
139 UINT cNames,
140 LCID lcid,
141 DISPID* rgDispId )
143 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
144 ITypeInfo *typeinfo;
145 HRESULT hr;
147 TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
148 lcid, rgDispId);
150 if(!rgszNames || cNames == 0 || !rgDispId)
151 return E_INVALIDARG;
153 hr = get_typeinfo(IXMLDOMParseError_tid, &typeinfo);
154 if(SUCCEEDED(hr))
156 hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
157 ITypeInfo_Release(typeinfo);
160 return hr;
163 static HRESULT WINAPI parseError_Invoke(
164 IXMLDOMParseError *iface,
165 DISPID dispIdMember,
166 REFIID riid,
167 LCID lcid,
168 WORD wFlags,
169 DISPPARAMS* pDispParams,
170 VARIANT* pVarResult,
171 EXCEPINFO* pExcepInfo,
172 UINT* puArgErr )
174 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
175 ITypeInfo *typeinfo;
176 HRESULT hr;
178 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
179 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
181 hr = get_typeinfo(IXMLDOMParseError_tid, &typeinfo);
182 if(SUCCEEDED(hr))
184 hr = ITypeInfo_Invoke(typeinfo, &(This->lpVtbl), dispIdMember, wFlags, pDispParams,
185 pVarResult, pExcepInfo, puArgErr);
186 ITypeInfo_Release(typeinfo);
189 return hr;
192 static HRESULT WINAPI parseError_get_errorCode(
193 IXMLDOMParseError *iface,
194 long *code )
196 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
197 TRACE("(%p)->(%p)\n", This, code);
199 *code = This->code;
201 if(This->code == 0)
202 return S_FALSE;
204 return S_OK;
207 static HRESULT WINAPI parseError_get_url(
208 IXMLDOMParseError *iface,
209 BSTR *url )
211 FIXME("\n");
212 return E_NOTIMPL;
215 static HRESULT WINAPI parseError_get_reason(
216 IXMLDOMParseError *iface,
217 BSTR *reason )
219 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
220 TRACE("(%p)->(%p)\n", This, reason);
222 if(!This->reason)
224 *reason = NULL;
225 return S_FALSE;
227 *reason = SysAllocString(This->reason);
228 return S_OK;
231 static HRESULT WINAPI parseError_get_srcText(
232 IXMLDOMParseError *iface,
233 BSTR *srcText )
235 FIXME("\n");
236 return E_NOTIMPL;
239 static HRESULT WINAPI parseError_get_line(
240 IXMLDOMParseError *iface,
241 long *line )
243 FIXME("\n");
244 return E_NOTIMPL;
247 static HRESULT WINAPI parseError_get_linepos(
248 IXMLDOMParseError *iface,
249 long *linepos )
251 FIXME("\n");
252 return E_NOTIMPL;
255 static HRESULT WINAPI parseError_get_filepos(
256 IXMLDOMParseError *iface,
257 long *filepos )
259 FIXME("\n");
260 return E_NOTIMPL;
263 static const struct IXMLDOMParseErrorVtbl parseError_vtbl =
265 parseError_QueryInterface,
266 parseError_AddRef,
267 parseError_Release,
268 parseError_GetTypeInfoCount,
269 parseError_GetTypeInfo,
270 parseError_GetIDsOfNames,
271 parseError_Invoke,
272 parseError_get_errorCode,
273 parseError_get_url,
274 parseError_get_reason,
275 parseError_get_srcText,
276 parseError_get_line,
277 parseError_get_linepos,
278 parseError_get_filepos
281 IXMLDOMParseError *create_parseError( LONG code, BSTR url, BSTR reason, BSTR srcText,
282 LONG line, LONG linepos, LONG filepos )
284 parse_error_t *This;
286 This = HeapAlloc( GetProcessHeap(), 0, sizeof(*This) );
287 if ( !This )
288 return NULL;
290 This->lpVtbl = &parseError_vtbl;
291 This->ref = 1;
293 This->code = code;
294 This->url = url;
295 This->reason = reason;
296 This->srcText = srcText;
297 This->line = line;
298 This->linepos = linepos;
299 This->filepos = filepos;
301 return (IXMLDOMParseError*) &This->lpVtbl;