wined3d: Spawn a separate thread to adjust the window state of windows belonging...
[wine.git] / dlls / msxml3 / parseerror.c
blob4f32eb0596b59643254cb9ea00c5ba60758d5630
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 <stdarg.h>
26 #include "ole2.h"
27 #include "msxml6.h"
29 #include "msxml_dispex.h"
31 #include "wine/debug.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(msxml);
35 typedef struct
37 DispatchEx dispex;
38 IXMLDOMParseError2 IXMLDOMParseError2_iface;
39 LONG ref;
40 LONG code, line, linepos, filepos;
41 BSTR url, reason, srcText;
42 } parse_error_t;
44 static inline parse_error_t *impl_from_IXMLDOMParseError2( IXMLDOMParseError2 *iface )
46 return CONTAINING_RECORD(iface, parse_error_t, IXMLDOMParseError2_iface);
49 static HRESULT WINAPI parseError_QueryInterface(
50 IXMLDOMParseError2 *iface,
51 REFIID riid,
52 void** ppvObject )
54 parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
56 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);
58 if ( IsEqualGUID( riid, &IID_IUnknown ) ||
59 IsEqualGUID( riid, &IID_IDispatch ) ||
60 IsEqualGUID( riid, &IID_IXMLDOMParseError ) ||
61 IsEqualGUID( riid, &IID_IXMLDOMParseError2 ) )
63 *ppvObject = iface;
65 else if (dispex_query_interface(&This->dispex, riid, ppvObject))
67 return *ppvObject ? S_OK : E_NOINTERFACE;
69 else
71 FIXME("interface %s not implemented\n", debugstr_guid(riid));
72 *ppvObject = NULL;
73 return E_NOINTERFACE;
76 IXMLDOMParseError2_AddRef( iface );
78 return S_OK;
81 static ULONG WINAPI parseError_AddRef(
82 IXMLDOMParseError2 *iface )
84 parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
85 ULONG ref = InterlockedIncrement( &This->ref );
86 TRACE("%p, refcount %lu.\n", iface, ref);
87 return ref;
90 static ULONG WINAPI parseError_Release(
91 IXMLDOMParseError2 *iface )
93 parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
94 ULONG ref = InterlockedDecrement( &This->ref );
96 TRACE("%p, refcount %lu.\n", iface, ref);
98 if (!ref)
100 SysFreeString(This->url);
101 SysFreeString(This->reason);
102 SysFreeString(This->srcText);
103 heap_free( This );
106 return ref;
109 static HRESULT WINAPI parseError_GetTypeInfoCount(
110 IXMLDOMParseError2 *iface,
111 UINT* pctinfo )
113 parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
114 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
117 static HRESULT WINAPI parseError_GetTypeInfo(
118 IXMLDOMParseError2 *iface,
119 UINT iTInfo,
120 LCID lcid,
121 ITypeInfo** ppTInfo )
123 parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
124 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface,
125 iTInfo, lcid, ppTInfo);
128 static HRESULT WINAPI parseError_GetIDsOfNames(
129 IXMLDOMParseError2 *iface,
130 REFIID riid,
131 LPOLESTR* rgszNames,
132 UINT cNames,
133 LCID lcid,
134 DISPID* rgDispId )
136 parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
137 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface,
138 riid, rgszNames, cNames, lcid, rgDispId);
141 static HRESULT WINAPI parseError_Invoke(
142 IXMLDOMParseError2 *iface,
143 DISPID dispIdMember,
144 REFIID riid,
145 LCID lcid,
146 WORD wFlags,
147 DISPPARAMS* pDispParams,
148 VARIANT* pVarResult,
149 EXCEPINFO* pExcepInfo,
150 UINT* puArgErr )
152 parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
153 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface,
154 dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
157 static HRESULT WINAPI parseError_get_errorCode(
158 IXMLDOMParseError2 *iface,
159 LONG *code )
161 parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
162 TRACE("(%p)->(%p)\n", This, code);
164 *code = This->code;
166 if(This->code == 0)
167 return S_FALSE;
169 return S_OK;
172 static HRESULT WINAPI parseError_get_url(
173 IXMLDOMParseError2 *iface,
174 BSTR *url )
176 parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
177 FIXME("(%p)->(%p)\n", This, url);
178 return E_NOTIMPL;
181 static HRESULT WINAPI parseError_get_reason(
182 IXMLDOMParseError2 *iface,
183 BSTR *reason )
185 parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
186 TRACE("(%p)->(%p)\n", This, reason);
188 if(!This->reason)
190 *reason = NULL;
191 return S_FALSE;
193 *reason = SysAllocString(This->reason);
194 return S_OK;
197 static HRESULT WINAPI parseError_get_srcText(
198 IXMLDOMParseError2 *iface,
199 BSTR *srcText )
201 parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
203 TRACE("(%p)->(%p)\n", This, srcText);
205 if (!srcText) return E_INVALIDARG;
207 *srcText = SysAllocString(This->srcText);
209 return S_OK;
212 static HRESULT WINAPI parseError_get_line(
213 IXMLDOMParseError2 *iface,
214 LONG *line )
216 parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
218 TRACE("%p, %p.\n", This, line);
220 if (!line) return E_INVALIDARG;
222 *line = This->line;
223 return S_OK;
226 static HRESULT WINAPI parseError_get_linepos(
227 IXMLDOMParseError2 *iface,
228 LONG *linepos )
230 parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
232 TRACE("(%p)->(%p)\n", This, linepos);
234 if (!linepos) return E_INVALIDARG;
236 *linepos = This->linepos;
237 return S_OK;
240 static HRESULT WINAPI parseError_get_filepos(
241 IXMLDOMParseError2 *iface,
242 LONG *filepos )
244 parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
245 FIXME("(%p)->(%p)\n", This, filepos);
246 return E_NOTIMPL;
249 static HRESULT WINAPI parseError_get_errorXPath(
250 IXMLDOMParseError2 *iface,
251 BSTR *xpathexpr)
253 parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
254 FIXME("(%p)->(%p)\n", This, xpathexpr);
255 return E_NOTIMPL;
258 static HRESULT WINAPI parseError_get_AllErrors(
259 IXMLDOMParseError2 *iface,
260 IXMLDOMParseErrorCollection **allErrors)
262 parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
263 FIXME("(%p)->(%p)\n", This, allErrors);
264 return E_NOTIMPL;
267 static HRESULT WINAPI parseError_errorParameters(
268 IXMLDOMParseError2 *iface,
269 LONG index,
270 BSTR *param)
272 parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
273 FIXME("(%p)->(%p)\n", This, param);
274 return E_NOTIMPL;
277 static HRESULT WINAPI parseError_get_errorParametersCount(
278 IXMLDOMParseError2 *iface,
279 LONG *count)
281 parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
282 FIXME("(%p)->(%p)\n", This, count);
283 return E_NOTIMPL;
286 static const struct IXMLDOMParseError2Vtbl XMLDOMParseError2Vtbl =
288 parseError_QueryInterface,
289 parseError_AddRef,
290 parseError_Release,
291 parseError_GetTypeInfoCount,
292 parseError_GetTypeInfo,
293 parseError_GetIDsOfNames,
294 parseError_Invoke,
295 parseError_get_errorCode,
296 parseError_get_url,
297 parseError_get_reason,
298 parseError_get_srcText,
299 parseError_get_line,
300 parseError_get_linepos,
301 parseError_get_filepos,
302 parseError_get_errorXPath,
303 parseError_get_AllErrors,
304 parseError_errorParameters,
305 parseError_get_errorParametersCount
308 static const tid_t parseError_iface_tids[] = {
309 IXMLDOMParseError2_tid,
313 static dispex_static_data_t parseError_dispex = {
314 NULL,
315 IXMLDOMParseError2_tid,
316 NULL,
317 parseError_iface_tids
320 IXMLDOMParseError *create_parseError( LONG code, BSTR url, BSTR reason, BSTR srcText,
321 LONG line, LONG linepos, LONG filepos )
323 parse_error_t *This;
325 This = heap_alloc( sizeof(*This) );
326 if ( !This )
327 return NULL;
329 This->IXMLDOMParseError2_iface.lpVtbl = &XMLDOMParseError2Vtbl;
330 This->ref = 1;
332 This->code = code;
333 This->url = url;
334 This->reason = reason;
335 This->srcText = srcText;
336 This->line = line;
337 This->linepos = linepos;
338 This->filepos = filepos;
340 init_dispex(&This->dispex, (IUnknown*)&This->IXMLDOMParseError2_iface, &parseError_dispex);
342 return (IXMLDOMParseError*)&This->IXMLDOMParseError2_iface;