2005-11-08 14:10:49 +01:00
|
|
|
/*
|
|
|
|
* ParseError implementation
|
|
|
|
*
|
|
|
|
* Copyright 2005 Huw Davies
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2005-11-08 14:10:49 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#define COBJMACROS
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
2011-02-24 13:11:53 +01:00
|
|
|
|
2005-11-08 14:10:49 +01:00
|
|
|
#include "ole2.h"
|
2010-08-29 23:31:49 +02:00
|
|
|
#include "msxml6.h"
|
2005-11-08 14:10:49 +01:00
|
|
|
|
2021-08-19 16:29:05 +02:00
|
|
|
#include "msxml_dispex.h"
|
2005-11-08 14:10:49 +01:00
|
|
|
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2011-11-01 21:50:56 +01:00
|
|
|
DispatchEx dispex;
|
2011-12-14 13:42:23 +01:00
|
|
|
IXMLDOMParseError2 IXMLDOMParseError2_iface;
|
2005-11-08 14:10:49 +01:00
|
|
|
LONG ref;
|
|
|
|
LONG code, line, linepos, filepos;
|
|
|
|
BSTR url, reason, srcText;
|
|
|
|
} parse_error_t;
|
|
|
|
|
2011-12-14 13:42:23 +01:00
|
|
|
static inline parse_error_t *impl_from_IXMLDOMParseError2( IXMLDOMParseError2 *iface )
|
2005-11-08 14:10:49 +01:00
|
|
|
{
|
2011-12-14 13:42:23 +01:00
|
|
|
return CONTAINING_RECORD(iface, parse_error_t, IXMLDOMParseError2_iface);
|
2005-11-08 14:10:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI parseError_QueryInterface(
|
2011-12-14 13:42:23 +01:00
|
|
|
IXMLDOMParseError2 *iface,
|
2005-11-08 14:10:49 +01:00
|
|
|
REFIID riid,
|
|
|
|
void** ppvObject )
|
|
|
|
{
|
2011-12-14 13:42:23 +01:00
|
|
|
parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
|
2011-10-31 14:44:28 +01:00
|
|
|
|
|
|
|
TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);
|
2005-11-08 14:10:49 +01:00
|
|
|
|
|
|
|
if ( IsEqualGUID( riid, &IID_IUnknown ) ||
|
|
|
|
IsEqualGUID( riid, &IID_IDispatch ) ||
|
2011-12-14 13:42:23 +01:00
|
|
|
IsEqualGUID( riid, &IID_IXMLDOMParseError ) ||
|
|
|
|
IsEqualGUID( riid, &IID_IXMLDOMParseError2 ) )
|
2005-11-08 14:10:49 +01:00
|
|
|
{
|
|
|
|
*ppvObject = iface;
|
|
|
|
}
|
2011-11-01 21:50:56 +01:00
|
|
|
else if (dispex_query_interface(&This->dispex, riid, ppvObject))
|
|
|
|
{
|
|
|
|
return *ppvObject ? S_OK : E_NOINTERFACE;
|
|
|
|
}
|
2005-11-08 14:10:49 +01:00
|
|
|
else
|
2006-01-27 19:22:56 +01:00
|
|
|
{
|
|
|
|
FIXME("interface %s not implemented\n", debugstr_guid(riid));
|
2011-02-28 20:28:53 +01:00
|
|
|
*ppvObject = NULL;
|
2005-11-08 14:10:49 +01:00
|
|
|
return E_NOINTERFACE;
|
2006-01-27 19:22:56 +01:00
|
|
|
}
|
2005-11-08 14:10:49 +01:00
|
|
|
|
2011-12-14 13:42:23 +01:00
|
|
|
IXMLDOMParseError2_AddRef( iface );
|
2005-11-08 14:10:49 +01:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI parseError_AddRef(
|
2011-12-14 13:42:23 +01:00
|
|
|
IXMLDOMParseError2 *iface )
|
2005-11-08 14:10:49 +01:00
|
|
|
{
|
2011-12-14 13:42:23 +01:00
|
|
|
parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
|
2005-11-08 14:10:49 +01:00
|
|
|
ULONG ref = InterlockedIncrement( &This->ref );
|
2011-10-31 14:44:28 +01:00
|
|
|
TRACE("(%p)->(%d)\n", This, ref);
|
2005-11-08 14:10:49 +01:00
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI parseError_Release(
|
2011-12-14 13:42:23 +01:00
|
|
|
IXMLDOMParseError2 *iface )
|
2005-11-08 14:10:49 +01:00
|
|
|
{
|
2011-12-14 13:42:23 +01:00
|
|
|
parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
|
2011-10-31 14:44:28 +01:00
|
|
|
ULONG ref = InterlockedDecrement( &This->ref );
|
2005-11-08 14:10:49 +01:00
|
|
|
|
2011-10-31 14:44:28 +01:00
|
|
|
TRACE("(%p)->(%d)\n", This, ref);
|
2005-11-08 14:10:49 +01:00
|
|
|
if ( ref == 0 )
|
|
|
|
{
|
|
|
|
SysFreeString(This->url);
|
|
|
|
SysFreeString(This->reason);
|
|
|
|
SysFreeString(This->srcText);
|
2010-02-03 20:47:53 +01:00
|
|
|
heap_free( This );
|
2005-11-08 14:10:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI parseError_GetTypeInfoCount(
|
2011-12-14 13:42:23 +01:00
|
|
|
IXMLDOMParseError2 *iface,
|
2005-11-08 14:10:49 +01:00
|
|
|
UINT* pctinfo )
|
|
|
|
{
|
2011-12-14 13:42:23 +01:00
|
|
|
parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
|
2011-11-19 17:32:23 +01:00
|
|
|
return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
|
2005-11-08 14:10:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI parseError_GetTypeInfo(
|
2011-12-14 13:42:23 +01:00
|
|
|
IXMLDOMParseError2 *iface,
|
2005-11-08 14:10:49 +01:00
|
|
|
UINT iTInfo,
|
|
|
|
LCID lcid,
|
|
|
|
ITypeInfo** ppTInfo )
|
|
|
|
{
|
2011-12-14 13:42:23 +01:00
|
|
|
parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
|
2011-11-19 17:32:23 +01:00
|
|
|
return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface,
|
|
|
|
iTInfo, lcid, ppTInfo);
|
2005-11-08 14:10:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI parseError_GetIDsOfNames(
|
2011-12-14 13:42:23 +01:00
|
|
|
IXMLDOMParseError2 *iface,
|
2005-11-08 14:10:49 +01:00
|
|
|
REFIID riid,
|
|
|
|
LPOLESTR* rgszNames,
|
|
|
|
UINT cNames,
|
|
|
|
LCID lcid,
|
|
|
|
DISPID* rgDispId )
|
|
|
|
{
|
2011-12-14 13:42:23 +01:00
|
|
|
parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
|
2011-11-19 17:32:23 +01:00
|
|
|
return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface,
|
|
|
|
riid, rgszNames, cNames, lcid, rgDispId);
|
2005-11-08 14:10:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI parseError_Invoke(
|
2011-12-14 13:42:23 +01:00
|
|
|
IXMLDOMParseError2 *iface,
|
2005-11-08 14:10:49 +01:00
|
|
|
DISPID dispIdMember,
|
|
|
|
REFIID riid,
|
|
|
|
LCID lcid,
|
|
|
|
WORD wFlags,
|
|
|
|
DISPPARAMS* pDispParams,
|
|
|
|
VARIANT* pVarResult,
|
|
|
|
EXCEPINFO* pExcepInfo,
|
|
|
|
UINT* puArgErr )
|
|
|
|
{
|
2011-12-14 13:42:23 +01:00
|
|
|
parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
|
2011-11-19 17:32:23 +01:00
|
|
|
return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface,
|
|
|
|
dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
2005-11-08 14:10:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI parseError_get_errorCode(
|
2011-12-14 13:42:23 +01:00
|
|
|
IXMLDOMParseError2 *iface,
|
2009-03-09 23:28:16 +01:00
|
|
|
LONG *code )
|
2005-11-08 14:10:49 +01:00
|
|
|
{
|
2011-12-14 13:42:23 +01:00
|
|
|
parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
|
2005-11-08 14:10:49 +01:00
|
|
|
TRACE("(%p)->(%p)\n", This, code);
|
|
|
|
|
|
|
|
*code = This->code;
|
|
|
|
|
|
|
|
if(This->code == 0)
|
|
|
|
return S_FALSE;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI parseError_get_url(
|
2011-12-14 13:42:23 +01:00
|
|
|
IXMLDOMParseError2 *iface,
|
2005-11-08 14:10:49 +01:00
|
|
|
BSTR *url )
|
|
|
|
{
|
2011-12-14 13:42:23 +01:00
|
|
|
parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
|
2010-02-17 07:40:40 +01:00
|
|
|
FIXME("(%p)->(%p)\n", This, url);
|
2005-11-08 14:10:49 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI parseError_get_reason(
|
2011-12-14 13:42:23 +01:00
|
|
|
IXMLDOMParseError2 *iface,
|
2005-11-08 14:10:49 +01:00
|
|
|
BSTR *reason )
|
|
|
|
{
|
2011-12-14 13:42:23 +01:00
|
|
|
parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
|
2006-02-21 12:52:25 +01:00
|
|
|
TRACE("(%p)->(%p)\n", This, reason);
|
|
|
|
|
|
|
|
if(!This->reason)
|
|
|
|
{
|
|
|
|
*reason = NULL;
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
*reason = SysAllocString(This->reason);
|
|
|
|
return S_OK;
|
2005-11-08 14:10:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI parseError_get_srcText(
|
2011-12-14 13:42:23 +01:00
|
|
|
IXMLDOMParseError2 *iface,
|
2005-11-08 14:10:49 +01:00
|
|
|
BSTR *srcText )
|
|
|
|
{
|
2011-12-14 13:42:23 +01:00
|
|
|
parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
|
2011-11-04 21:27:39 +01:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, srcText);
|
|
|
|
|
|
|
|
if (!srcText) return E_INVALIDARG;
|
|
|
|
|
|
|
|
*srcText = SysAllocString(This->srcText);
|
|
|
|
|
|
|
|
return S_OK;
|
2005-11-08 14:10:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI parseError_get_line(
|
2011-12-14 13:42:23 +01:00
|
|
|
IXMLDOMParseError2 *iface,
|
2009-03-09 23:28:16 +01:00
|
|
|
LONG *line )
|
2005-11-08 14:10:49 +01:00
|
|
|
{
|
2011-12-14 13:42:23 +01:00
|
|
|
parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
|
2011-11-04 21:26:53 +01:00
|
|
|
|
2019-11-05 12:34:18 +01:00
|
|
|
TRACE("%p, %p.\n", This, line);
|
2011-11-04 21:26:53 +01:00
|
|
|
|
|
|
|
if (!line) return E_INVALIDARG;
|
|
|
|
|
|
|
|
*line = This->line;
|
|
|
|
return S_OK;
|
2005-11-08 14:10:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI parseError_get_linepos(
|
2011-12-14 13:42:23 +01:00
|
|
|
IXMLDOMParseError2 *iface,
|
2009-03-09 23:28:16 +01:00
|
|
|
LONG *linepos )
|
2005-11-08 14:10:49 +01:00
|
|
|
{
|
2011-12-14 13:42:23 +01:00
|
|
|
parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
|
2011-11-04 21:26:53 +01:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, linepos);
|
|
|
|
|
|
|
|
if (!linepos) return E_INVALIDARG;
|
|
|
|
|
|
|
|
*linepos = This->linepos;
|
|
|
|
return S_OK;
|
2005-11-08 14:10:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI parseError_get_filepos(
|
2011-12-14 13:42:23 +01:00
|
|
|
IXMLDOMParseError2 *iface,
|
2009-03-09 23:28:16 +01:00
|
|
|
LONG *filepos )
|
2005-11-08 14:10:49 +01:00
|
|
|
{
|
2011-12-14 13:42:23 +01:00
|
|
|
parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
|
2010-02-17 07:40:40 +01:00
|
|
|
FIXME("(%p)->(%p)\n", This, filepos);
|
2005-11-08 14:10:49 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2011-12-14 13:42:23 +01:00
|
|
|
static HRESULT WINAPI parseError_get_errorXPath(
|
|
|
|
IXMLDOMParseError2 *iface,
|
|
|
|
BSTR *xpathexpr)
|
|
|
|
{
|
|
|
|
parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
|
|
|
|
FIXME("(%p)->(%p)\n", This, xpathexpr);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI parseError_get_AllErrors(
|
|
|
|
IXMLDOMParseError2 *iface,
|
|
|
|
IXMLDOMParseErrorCollection **allErrors)
|
|
|
|
{
|
|
|
|
parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
|
|
|
|
FIXME("(%p)->(%p)\n", This, allErrors);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI parseError_errorParameters(
|
|
|
|
IXMLDOMParseError2 *iface,
|
|
|
|
LONG index,
|
|
|
|
BSTR *param)
|
|
|
|
{
|
|
|
|
parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
|
|
|
|
FIXME("(%p)->(%p)\n", This, param);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI parseError_get_errorParametersCount(
|
|
|
|
IXMLDOMParseError2 *iface,
|
|
|
|
LONG *count)
|
|
|
|
{
|
|
|
|
parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
|
|
|
|
FIXME("(%p)->(%p)\n", This, count);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct IXMLDOMParseError2Vtbl XMLDOMParseError2Vtbl =
|
2005-11-08 14:10:49 +01:00
|
|
|
{
|
|
|
|
parseError_QueryInterface,
|
|
|
|
parseError_AddRef,
|
|
|
|
parseError_Release,
|
|
|
|
parseError_GetTypeInfoCount,
|
|
|
|
parseError_GetTypeInfo,
|
|
|
|
parseError_GetIDsOfNames,
|
|
|
|
parseError_Invoke,
|
|
|
|
parseError_get_errorCode,
|
|
|
|
parseError_get_url,
|
|
|
|
parseError_get_reason,
|
|
|
|
parseError_get_srcText,
|
|
|
|
parseError_get_line,
|
|
|
|
parseError_get_linepos,
|
2011-12-14 13:42:23 +01:00
|
|
|
parseError_get_filepos,
|
|
|
|
parseError_get_errorXPath,
|
|
|
|
parseError_get_AllErrors,
|
|
|
|
parseError_errorParameters,
|
|
|
|
parseError_get_errorParametersCount
|
2005-11-08 14:10:49 +01:00
|
|
|
};
|
|
|
|
|
2011-11-01 21:50:56 +01:00
|
|
|
static const tid_t parseError_iface_tids[] = {
|
2011-12-14 13:42:23 +01:00
|
|
|
IXMLDOMParseError2_tid,
|
2011-11-01 21:50:56 +01:00
|
|
|
0
|
|
|
|
};
|
|
|
|
|
|
|
|
static dispex_static_data_t parseError_dispex = {
|
|
|
|
NULL,
|
2011-12-14 13:42:23 +01:00
|
|
|
IXMLDOMParseError2_tid,
|
2011-11-01 21:50:56 +01:00
|
|
|
NULL,
|
|
|
|
parseError_iface_tids
|
|
|
|
};
|
|
|
|
|
2005-11-08 14:10:49 +01:00
|
|
|
IXMLDOMParseError *create_parseError( LONG code, BSTR url, BSTR reason, BSTR srcText,
|
|
|
|
LONG line, LONG linepos, LONG filepos )
|
|
|
|
{
|
|
|
|
parse_error_t *This;
|
|
|
|
|
2010-02-03 20:47:53 +01:00
|
|
|
This = heap_alloc( sizeof(*This) );
|
2005-11-08 14:10:49 +01:00
|
|
|
if ( !This )
|
|
|
|
return NULL;
|
|
|
|
|
2011-12-14 13:42:23 +01:00
|
|
|
This->IXMLDOMParseError2_iface.lpVtbl = &XMLDOMParseError2Vtbl;
|
2005-11-08 14:10:49 +01:00
|
|
|
This->ref = 1;
|
|
|
|
|
|
|
|
This->code = code;
|
|
|
|
This->url = url;
|
|
|
|
This->reason = reason;
|
|
|
|
This->srcText = srcText;
|
|
|
|
This->line = line;
|
|
|
|
This->linepos = linepos;
|
|
|
|
This->filepos = filepos;
|
|
|
|
|
2011-12-14 13:42:23 +01:00
|
|
|
init_dispex(&This->dispex, (IUnknown*)&This->IXMLDOMParseError2_iface, &parseError_dispex);
|
2011-11-01 21:50:56 +01:00
|
|
|
|
2011-12-14 13:42:23 +01:00
|
|
|
return (IXMLDOMParseError*)&This->IXMLDOMParseError2_iface;
|
2005-11-08 14:10:49 +01:00
|
|
|
}
|