We should always allocate in NdrConformantStringUnmarshal if the
[wine.git] / dlls / msxml3 / parseerror.c
blob359ce64b8a6216b7bc64c0fb9127f4430833f990
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #define COBJMACROS
24 #include <stdarg.h>
25 #include <assert.h>
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winerror.h"
29 #include "winuser.h"
30 #include "ole2.h"
31 #include "msxml2.h"
33 #include "msxml_private.h"
35 #include "wine/debug.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(msxml);
39 typedef struct
41 const struct IXMLDOMParseErrorVtbl *lpVtbl;
42 LONG ref;
43 LONG code, line, linepos, filepos;
44 BSTR url, reason, srcText;
45 } parse_error_t;
47 static inline parse_error_t *impl_from_IXMLDOMParseError( IXMLDOMParseError *iface )
49 return (parse_error_t *)((char*)iface - FIELD_OFFSET(parse_error_t, lpVtbl));
52 static HRESULT WINAPI parseError_QueryInterface(
53 IXMLDOMParseError *iface,
54 REFIID riid,
55 void** ppvObject )
57 TRACE("%p %s %p\n", iface, debugstr_guid(riid), ppvObject);
59 if ( IsEqualGUID( riid, &IID_IUnknown ) ||
60 IsEqualGUID( riid, &IID_IDispatch ) ||
61 IsEqualGUID( riid, &IID_IXMLDOMParseError ) )
63 *ppvObject = iface;
65 else
66 return E_NOINTERFACE;
68 IXMLDOMParseError_AddRef( iface );
70 return S_OK;
73 static ULONG WINAPI parseError_AddRef(
74 IXMLDOMParseError *iface )
76 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
77 ULONG ref = InterlockedIncrement( &This->ref );
78 TRACE("(%p) ref now %ld\n", This, ref);
79 return ref;
82 static ULONG WINAPI parseError_Release(
83 IXMLDOMParseError *iface )
85 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
86 ULONG ref;
88 ref = InterlockedDecrement( &This->ref );
89 TRACE("(%p) ref now %ld\n", This, ref);
90 if ( ref == 0 )
92 SysFreeString(This->url);
93 SysFreeString(This->reason);
94 SysFreeString(This->srcText);
95 HeapFree( GetProcessHeap(), 0, This );
98 return ref;
101 static HRESULT WINAPI parseError_GetTypeInfoCount(
102 IXMLDOMParseError *iface,
103 UINT* pctinfo )
105 FIXME("\n");
106 return E_NOTIMPL;
109 static HRESULT WINAPI parseError_GetTypeInfo(
110 IXMLDOMParseError *iface,
111 UINT iTInfo,
112 LCID lcid,
113 ITypeInfo** ppTInfo )
115 FIXME("\n");
116 return E_NOTIMPL;
119 static HRESULT WINAPI parseError_GetIDsOfNames(
120 IXMLDOMParseError *iface,
121 REFIID riid,
122 LPOLESTR* rgszNames,
123 UINT cNames,
124 LCID lcid,
125 DISPID* rgDispId )
127 FIXME("\n");
128 return E_NOTIMPL;
131 static HRESULT WINAPI parseError_Invoke(
132 IXMLDOMParseError *iface,
133 DISPID dispIdMember,
134 REFIID riid,
135 LCID lcid,
136 WORD wFlags,
137 DISPPARAMS* pDispParams,
138 VARIANT* pVarResult,
139 EXCEPINFO* pExcepInfo,
140 UINT* puArgErr )
142 FIXME("\n");
143 return E_NOTIMPL;
146 static HRESULT WINAPI parseError_get_errorCode(
147 IXMLDOMParseError *iface,
148 LONG *code )
150 parse_error_t *This = impl_from_IXMLDOMParseError( iface );
151 TRACE("(%p)->(%p)\n", This, code);
153 *code = This->code;
155 if(This->code == 0)
156 return S_FALSE;
158 return S_OK;
161 static HRESULT WINAPI parseError_get_url(
162 IXMLDOMParseError *iface,
163 BSTR *url )
165 FIXME("\n");
166 return E_NOTIMPL;
169 static HRESULT WINAPI parseError_get_reason(
170 IXMLDOMParseError *iface,
171 BSTR *reason )
173 FIXME("\n");
174 return E_NOTIMPL;
177 static HRESULT WINAPI parseError_get_srcText(
178 IXMLDOMParseError *iface,
179 BSTR *srcText )
181 FIXME("\n");
182 return E_NOTIMPL;
185 static HRESULT WINAPI parseError_get_line(
186 IXMLDOMParseError *iface,
187 LONG *line )
189 FIXME("\n");
190 return E_NOTIMPL;
193 static HRESULT WINAPI parseError_get_linepos(
194 IXMLDOMParseError *iface,
195 LONG *linepos )
197 FIXME("\n");
198 return E_NOTIMPL;
201 static HRESULT WINAPI parseError_get_filepos(
202 IXMLDOMParseError *iface,
203 LONG *filepos )
205 FIXME("\n");
206 return E_NOTIMPL;
209 static const struct IXMLDOMParseErrorVtbl parseError_vtbl =
211 parseError_QueryInterface,
212 parseError_AddRef,
213 parseError_Release,
214 parseError_GetTypeInfoCount,
215 parseError_GetTypeInfo,
216 parseError_GetIDsOfNames,
217 parseError_Invoke,
218 parseError_get_errorCode,
219 parseError_get_url,
220 parseError_get_reason,
221 parseError_get_srcText,
222 parseError_get_line,
223 parseError_get_linepos,
224 parseError_get_filepos
227 IXMLDOMParseError *create_parseError( LONG code, BSTR url, BSTR reason, BSTR srcText,
228 LONG line, LONG linepos, LONG filepos )
230 parse_error_t *This;
232 This = HeapAlloc( GetProcessHeap(), 0, sizeof(*This) );
233 if ( !This )
234 return NULL;
236 This->lpVtbl = &parseError_vtbl;
237 This->ref = 1;
239 This->code = code;
240 This->url = url;
241 This->reason = reason;
242 This->srcText = srcText;
243 This->line = line;
244 This->linepos = linepos;
245 This->filepos = filepos;
247 return (IXMLDOMParseError*) &This->lpVtbl;