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
|
|
|
|
|
2007-01-20 09:19:55 +01:00
|
|
|
#include "config.h"
|
|
|
|
|
2005-11-08 14:10:49 +01:00
|
|
|
#include <stdarg.h>
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winerror.h"
|
|
|
|
#include "winuser.h"
|
|
|
|
#include "ole2.h"
|
2010-08-29 23:31:49 +02:00
|
|
|
#include "msxml6.h"
|
2005-11-08 14:10:49 +01:00
|
|
|
|
|
|
|
#include "msxml_private.h"
|
|
|
|
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2010-12-29 02:52:22 +01:00
|
|
|
IXMLDOMParseError IXMLDOMParseError_iface;
|
2005-11-08 14:10:49 +01:00
|
|
|
LONG ref;
|
|
|
|
LONG code, line, linepos, filepos;
|
|
|
|
BSTR url, reason, srcText;
|
|
|
|
} parse_error_t;
|
|
|
|
|
|
|
|
static inline parse_error_t *impl_from_IXMLDOMParseError( IXMLDOMParseError *iface )
|
|
|
|
{
|
2010-12-29 02:52:22 +01:00
|
|
|
return CONTAINING_RECORD(iface, parse_error_t, IXMLDOMParseError_iface);
|
2005-11-08 14:10:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI parseError_QueryInterface(
|
|
|
|
IXMLDOMParseError *iface,
|
|
|
|
REFIID riid,
|
|
|
|
void** ppvObject )
|
|
|
|
{
|
2010-02-17 07:40:40 +01:00
|
|
|
TRACE("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppvObject);
|
2005-11-08 14:10:49 +01:00
|
|
|
|
|
|
|
if ( IsEqualGUID( riid, &IID_IUnknown ) ||
|
|
|
|
IsEqualGUID( riid, &IID_IDispatch ) ||
|
|
|
|
IsEqualGUID( riid, &IID_IXMLDOMParseError ) )
|
|
|
|
{
|
|
|
|
*ppvObject = iface;
|
|
|
|
}
|
|
|
|
else
|
2006-01-27 19:22:56 +01:00
|
|
|
{
|
|
|
|
FIXME("interface %s not implemented\n", debugstr_guid(riid));
|
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
|
|
|
|
|
|
|
IXMLDOMParseError_AddRef( iface );
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI parseError_AddRef(
|
|
|
|
IXMLDOMParseError *iface )
|
|
|
|
{
|
|
|
|
parse_error_t *This = impl_from_IXMLDOMParseError( iface );
|
|
|
|
ULONG ref = InterlockedIncrement( &This->ref );
|
2006-10-05 00:58:11 +02:00
|
|
|
TRACE("(%p) ref now %d\n", This, ref);
|
2005-11-08 14:10:49 +01:00
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI parseError_Release(
|
|
|
|
IXMLDOMParseError *iface )
|
|
|
|
{
|
|
|
|
parse_error_t *This = impl_from_IXMLDOMParseError( iface );
|
|
|
|
ULONG ref;
|
|
|
|
|
|
|
|
ref = InterlockedDecrement( &This->ref );
|
2006-10-05 00:58:11 +02:00
|
|
|
TRACE("(%p) ref now %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(
|
|
|
|
IXMLDOMParseError *iface,
|
|
|
|
UINT* pctinfo )
|
|
|
|
{
|
2008-02-19 02:28:08 +01:00
|
|
|
parse_error_t *This = impl_from_IXMLDOMParseError( iface );
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, pctinfo);
|
|
|
|
|
|
|
|
*pctinfo = 1;
|
|
|
|
|
|
|
|
return S_OK;
|
2005-11-08 14:10:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI parseError_GetTypeInfo(
|
|
|
|
IXMLDOMParseError *iface,
|
|
|
|
UINT iTInfo,
|
|
|
|
LCID lcid,
|
|
|
|
ITypeInfo** ppTInfo )
|
|
|
|
{
|
2008-02-19 02:28:08 +01:00
|
|
|
parse_error_t *This = impl_from_IXMLDOMParseError( iface );
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
|
|
|
|
|
|
|
|
hr = get_typeinfo(IXMLDOMParseError_tid, ppTInfo);
|
|
|
|
|
|
|
|
return hr;
|
2005-11-08 14:10:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI parseError_GetIDsOfNames(
|
|
|
|
IXMLDOMParseError *iface,
|
|
|
|
REFIID riid,
|
|
|
|
LPOLESTR* rgszNames,
|
|
|
|
UINT cNames,
|
|
|
|
LCID lcid,
|
|
|
|
DISPID* rgDispId )
|
|
|
|
{
|
2008-02-19 02:28:08 +01:00
|
|
|
parse_error_t *This = impl_from_IXMLDOMParseError( iface );
|
|
|
|
ITypeInfo *typeinfo;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
|
|
|
|
lcid, rgDispId);
|
|
|
|
|
|
|
|
if(!rgszNames || cNames == 0 || !rgDispId)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
hr = get_typeinfo(IXMLDOMParseError_tid, &typeinfo);
|
|
|
|
if(SUCCEEDED(hr))
|
|
|
|
{
|
|
|
|
hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
|
|
|
|
ITypeInfo_Release(typeinfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
return hr;
|
2005-11-08 14:10:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI parseError_Invoke(
|
|
|
|
IXMLDOMParseError *iface,
|
|
|
|
DISPID dispIdMember,
|
|
|
|
REFIID riid,
|
|
|
|
LCID lcid,
|
|
|
|
WORD wFlags,
|
|
|
|
DISPPARAMS* pDispParams,
|
|
|
|
VARIANT* pVarResult,
|
|
|
|
EXCEPINFO* pExcepInfo,
|
|
|
|
UINT* puArgErr )
|
|
|
|
{
|
2008-02-19 02:28:08 +01:00
|
|
|
parse_error_t *This = impl_from_IXMLDOMParseError( iface );
|
|
|
|
ITypeInfo *typeinfo;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
|
|
|
|
lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
|
|
|
|
|
|
|
hr = get_typeinfo(IXMLDOMParseError_tid, &typeinfo);
|
|
|
|
if(SUCCEEDED(hr))
|
|
|
|
{
|
2010-12-29 02:52:22 +01:00
|
|
|
hr = ITypeInfo_Invoke(typeinfo, &This->IXMLDOMParseError_iface, dispIdMember, wFlags,
|
|
|
|
pDispParams, pVarResult, pExcepInfo, puArgErr);
|
2008-02-19 02:28:08 +01:00
|
|
|
ITypeInfo_Release(typeinfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
return hr;
|
2005-11-08 14:10:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI parseError_get_errorCode(
|
|
|
|
IXMLDOMParseError *iface,
|
2009-03-09 23:28:16 +01:00
|
|
|
LONG *code )
|
2005-11-08 14:10:49 +01:00
|
|
|
{
|
|
|
|
parse_error_t *This = impl_from_IXMLDOMParseError( iface );
|
|
|
|
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(
|
|
|
|
IXMLDOMParseError *iface,
|
|
|
|
BSTR *url )
|
|
|
|
{
|
2010-02-17 07:40:40 +01:00
|
|
|
parse_error_t *This = impl_from_IXMLDOMParseError( iface );
|
|
|
|
FIXME("(%p)->(%p)\n", This, url);
|
2005-11-08 14:10:49 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI parseError_get_reason(
|
|
|
|
IXMLDOMParseError *iface,
|
|
|
|
BSTR *reason )
|
|
|
|
{
|
2006-02-21 12:52:25 +01:00
|
|
|
parse_error_t *This = impl_from_IXMLDOMParseError( iface );
|
|
|
|
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(
|
|
|
|
IXMLDOMParseError *iface,
|
|
|
|
BSTR *srcText )
|
|
|
|
{
|
2010-02-17 07:40:40 +01:00
|
|
|
parse_error_t *This = impl_from_IXMLDOMParseError( iface );
|
|
|
|
FIXME("(%p)->(%p)\n", This, srcText);
|
2005-11-08 14:10:49 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI parseError_get_line(
|
|
|
|
IXMLDOMParseError *iface,
|
2009-03-09 23:28:16 +01:00
|
|
|
LONG *line )
|
2005-11-08 14:10:49 +01:00
|
|
|
{
|
2010-02-17 07:40:40 +01:00
|
|
|
parse_error_t *This = impl_from_IXMLDOMParseError( iface );
|
|
|
|
FIXME("(%p)->(%p)\n", This, line);
|
2005-11-08 14:10:49 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI parseError_get_linepos(
|
|
|
|
IXMLDOMParseError *iface,
|
2009-03-09 23:28:16 +01:00
|
|
|
LONG *linepos )
|
2005-11-08 14:10:49 +01:00
|
|
|
{
|
2010-02-17 07:40:40 +01:00
|
|
|
parse_error_t *This = impl_from_IXMLDOMParseError( iface );
|
|
|
|
FIXME("(%p)->(%p)\n", This, linepos);
|
2005-11-08 14:10:49 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI parseError_get_filepos(
|
|
|
|
IXMLDOMParseError *iface,
|
2009-03-09 23:28:16 +01:00
|
|
|
LONG *filepos )
|
2005-11-08 14:10:49 +01:00
|
|
|
{
|
2010-02-17 07:40:40 +01:00
|
|
|
parse_error_t *This = impl_from_IXMLDOMParseError( iface );
|
|
|
|
FIXME("(%p)->(%p)\n", This, filepos);
|
2005-11-08 14:10:49 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct IXMLDOMParseErrorVtbl parseError_vtbl =
|
|
|
|
{
|
|
|
|
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,
|
|
|
|
parseError_get_filepos
|
|
|
|
};
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
2010-12-29 02:52:22 +01:00
|
|
|
This->IXMLDOMParseError_iface.lpVtbl = &parseError_vtbl;
|
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;
|
|
|
|
|
2010-12-29 02:52:22 +01:00
|
|
|
return &This->IXMLDOMParseError_iface;
|
2005-11-08 14:10:49 +01:00
|
|
|
}
|