msxml3: Added IXMLDOMParseError2 support.

This commit is contained in:
Nikolay Sivov 2011-12-14 15:42:23 +03:00 committed by Alexandre Julliard
parent 19a86feaa1
commit 0151f4741a
4 changed files with 94 additions and 42 deletions

View File

@ -126,7 +126,7 @@ static tid_id_t tid_ids[] = {
{ &IID_IXMLDOMNamedNodeMap, LibXml2 }, { &IID_IXMLDOMNamedNodeMap, LibXml2 },
{ &IID_IXMLDOMNode, LibXml2 }, { &IID_IXMLDOMNode, LibXml2 },
{ &IID_IXMLDOMNodeList, LibXml2 }, { &IID_IXMLDOMNodeList, LibXml2 },
{ &IID_IXMLDOMParseError, LibXml2 }, { &IID_IXMLDOMParseError2, LibXml2 },
{ &IID_IXMLDOMProcessingInstruction, LibXml2 }, { &IID_IXMLDOMProcessingInstruction, LibXml2 },
{ &IID_IXMLDOMSchemaCollection, LibXml2 }, { &IID_IXMLDOMSchemaCollection, LibXml2 },
{ &IID_IXMLDOMSchemaCollection2, LibXml2 }, { &IID_IXMLDOMSchemaCollection2, LibXml2 },

View File

@ -53,7 +53,7 @@ typedef enum tid_t {
IXMLDOMNamedNodeMap_tid, IXMLDOMNamedNodeMap_tid,
IXMLDOMNode_tid, IXMLDOMNode_tid,
IXMLDOMNodeList_tid, IXMLDOMNodeList_tid,
IXMLDOMParseError_tid, IXMLDOMParseError2_tid,
IXMLDOMProcessingInstruction_tid, IXMLDOMProcessingInstruction_tid,
IXMLDOMSchemaCollection_tid, IXMLDOMSchemaCollection_tid,
IXMLDOMSchemaCollection2_tid, IXMLDOMSchemaCollection2_tid,

View File

@ -45,29 +45,30 @@ WINE_DEFAULT_DEBUG_CHANNEL(msxml);
typedef struct typedef struct
{ {
DispatchEx dispex; DispatchEx dispex;
IXMLDOMParseError IXMLDOMParseError_iface; IXMLDOMParseError2 IXMLDOMParseError2_iface;
LONG ref; LONG ref;
LONG code, line, linepos, filepos; LONG code, line, linepos, filepos;
BSTR url, reason, srcText; BSTR url, reason, srcText;
} parse_error_t; } parse_error_t;
static inline parse_error_t *impl_from_IXMLDOMParseError( IXMLDOMParseError *iface ) static inline parse_error_t *impl_from_IXMLDOMParseError2( IXMLDOMParseError2 *iface )
{ {
return CONTAINING_RECORD(iface, parse_error_t, IXMLDOMParseError_iface); return CONTAINING_RECORD(iface, parse_error_t, IXMLDOMParseError2_iface);
} }
static HRESULT WINAPI parseError_QueryInterface( static HRESULT WINAPI parseError_QueryInterface(
IXMLDOMParseError *iface, IXMLDOMParseError2 *iface,
REFIID riid, REFIID riid,
void** ppvObject ) void** ppvObject )
{ {
parse_error_t *This = impl_from_IXMLDOMParseError( iface ); parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject); TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);
if ( IsEqualGUID( riid, &IID_IUnknown ) || if ( IsEqualGUID( riid, &IID_IUnknown ) ||
IsEqualGUID( riid, &IID_IDispatch ) || IsEqualGUID( riid, &IID_IDispatch ) ||
IsEqualGUID( riid, &IID_IXMLDOMParseError ) ) IsEqualGUID( riid, &IID_IXMLDOMParseError ) ||
IsEqualGUID( riid, &IID_IXMLDOMParseError2 ) )
{ {
*ppvObject = iface; *ppvObject = iface;
} }
@ -82,24 +83,24 @@ static HRESULT WINAPI parseError_QueryInterface(
return E_NOINTERFACE; return E_NOINTERFACE;
} }
IXMLDOMParseError_AddRef( iface ); IXMLDOMParseError2_AddRef( iface );
return S_OK; return S_OK;
} }
static ULONG WINAPI parseError_AddRef( static ULONG WINAPI parseError_AddRef(
IXMLDOMParseError *iface ) IXMLDOMParseError2 *iface )
{ {
parse_error_t *This = impl_from_IXMLDOMParseError( iface ); parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
ULONG ref = InterlockedIncrement( &This->ref ); ULONG ref = InterlockedIncrement( &This->ref );
TRACE("(%p)->(%d)\n", This, ref); TRACE("(%p)->(%d)\n", This, ref);
return ref; return ref;
} }
static ULONG WINAPI parseError_Release( static ULONG WINAPI parseError_Release(
IXMLDOMParseError *iface ) IXMLDOMParseError2 *iface )
{ {
parse_error_t *This = impl_from_IXMLDOMParseError( iface ); parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
ULONG ref = InterlockedDecrement( &This->ref ); ULONG ref = InterlockedDecrement( &This->ref );
TRACE("(%p)->(%d)\n", This, ref); TRACE("(%p)->(%d)\n", This, ref);
@ -116,39 +117,39 @@ static ULONG WINAPI parseError_Release(
} }
static HRESULT WINAPI parseError_GetTypeInfoCount( static HRESULT WINAPI parseError_GetTypeInfoCount(
IXMLDOMParseError *iface, IXMLDOMParseError2 *iface,
UINT* pctinfo ) UINT* pctinfo )
{ {
parse_error_t *This = impl_from_IXMLDOMParseError( iface ); parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo); return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
} }
static HRESULT WINAPI parseError_GetTypeInfo( static HRESULT WINAPI parseError_GetTypeInfo(
IXMLDOMParseError *iface, IXMLDOMParseError2 *iface,
UINT iTInfo, UINT iTInfo,
LCID lcid, LCID lcid,
ITypeInfo** ppTInfo ) ITypeInfo** ppTInfo )
{ {
parse_error_t *This = impl_from_IXMLDOMParseError( iface ); parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface,
iTInfo, lcid, ppTInfo); iTInfo, lcid, ppTInfo);
} }
static HRESULT WINAPI parseError_GetIDsOfNames( static HRESULT WINAPI parseError_GetIDsOfNames(
IXMLDOMParseError *iface, IXMLDOMParseError2 *iface,
REFIID riid, REFIID riid,
LPOLESTR* rgszNames, LPOLESTR* rgszNames,
UINT cNames, UINT cNames,
LCID lcid, LCID lcid,
DISPID* rgDispId ) DISPID* rgDispId )
{ {
parse_error_t *This = impl_from_IXMLDOMParseError( iface ); parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface,
riid, rgszNames, cNames, lcid, rgDispId); riid, rgszNames, cNames, lcid, rgDispId);
} }
static HRESULT WINAPI parseError_Invoke( static HRESULT WINAPI parseError_Invoke(
IXMLDOMParseError *iface, IXMLDOMParseError2 *iface,
DISPID dispIdMember, DISPID dispIdMember,
REFIID riid, REFIID riid,
LCID lcid, LCID lcid,
@ -158,16 +159,16 @@ static HRESULT WINAPI parseError_Invoke(
EXCEPINFO* pExcepInfo, EXCEPINFO* pExcepInfo,
UINT* puArgErr ) UINT* puArgErr )
{ {
parse_error_t *This = impl_from_IXMLDOMParseError( iface ); parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface,
dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
} }
static HRESULT WINAPI parseError_get_errorCode( static HRESULT WINAPI parseError_get_errorCode(
IXMLDOMParseError *iface, IXMLDOMParseError2 *iface,
LONG *code ) LONG *code )
{ {
parse_error_t *This = impl_from_IXMLDOMParseError( iface ); parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
TRACE("(%p)->(%p)\n", This, code); TRACE("(%p)->(%p)\n", This, code);
*code = This->code; *code = This->code;
@ -179,19 +180,19 @@ static HRESULT WINAPI parseError_get_errorCode(
} }
static HRESULT WINAPI parseError_get_url( static HRESULT WINAPI parseError_get_url(
IXMLDOMParseError *iface, IXMLDOMParseError2 *iface,
BSTR *url ) BSTR *url )
{ {
parse_error_t *This = impl_from_IXMLDOMParseError( iface ); parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
FIXME("(%p)->(%p)\n", This, url); FIXME("(%p)->(%p)\n", This, url);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI parseError_get_reason( static HRESULT WINAPI parseError_get_reason(
IXMLDOMParseError *iface, IXMLDOMParseError2 *iface,
BSTR *reason ) BSTR *reason )
{ {
parse_error_t *This = impl_from_IXMLDOMParseError( iface ); parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
TRACE("(%p)->(%p)\n", This, reason); TRACE("(%p)->(%p)\n", This, reason);
if(!This->reason) if(!This->reason)
@ -204,10 +205,10 @@ static HRESULT WINAPI parseError_get_reason(
} }
static HRESULT WINAPI parseError_get_srcText( static HRESULT WINAPI parseError_get_srcText(
IXMLDOMParseError *iface, IXMLDOMParseError2 *iface,
BSTR *srcText ) BSTR *srcText )
{ {
parse_error_t *This = impl_from_IXMLDOMParseError( iface ); parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
TRACE("(%p)->(%p)\n", This, srcText); TRACE("(%p)->(%p)\n", This, srcText);
@ -219,10 +220,10 @@ static HRESULT WINAPI parseError_get_srcText(
} }
static HRESULT WINAPI parseError_get_line( static HRESULT WINAPI parseError_get_line(
IXMLDOMParseError *iface, IXMLDOMParseError2 *iface,
LONG *line ) LONG *line )
{ {
parse_error_t *This = impl_from_IXMLDOMParseError( iface ); parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
TRACE("(%p)->(%p): stub\n", This, line); TRACE("(%p)->(%p): stub\n", This, line);
@ -233,10 +234,10 @@ static HRESULT WINAPI parseError_get_line(
} }
static HRESULT WINAPI parseError_get_linepos( static HRESULT WINAPI parseError_get_linepos(
IXMLDOMParseError *iface, IXMLDOMParseError2 *iface,
LONG *linepos ) LONG *linepos )
{ {
parse_error_t *This = impl_from_IXMLDOMParseError( iface ); parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
TRACE("(%p)->(%p)\n", This, linepos); TRACE("(%p)->(%p)\n", This, linepos);
@ -247,15 +248,52 @@ static HRESULT WINAPI parseError_get_linepos(
} }
static HRESULT WINAPI parseError_get_filepos( static HRESULT WINAPI parseError_get_filepos(
IXMLDOMParseError *iface, IXMLDOMParseError2 *iface,
LONG *filepos ) LONG *filepos )
{ {
parse_error_t *This = impl_from_IXMLDOMParseError( iface ); parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
FIXME("(%p)->(%p)\n", This, filepos); FIXME("(%p)->(%p)\n", This, filepos);
return E_NOTIMPL; return E_NOTIMPL;
} }
static const struct IXMLDOMParseErrorVtbl parseError_vtbl = 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 =
{ {
parseError_QueryInterface, parseError_QueryInterface,
parseError_AddRef, parseError_AddRef,
@ -270,17 +308,21 @@ static const struct IXMLDOMParseErrorVtbl parseError_vtbl =
parseError_get_srcText, parseError_get_srcText,
parseError_get_line, parseError_get_line,
parseError_get_linepos, parseError_get_linepos,
parseError_get_filepos parseError_get_filepos,
parseError_get_errorXPath,
parseError_get_AllErrors,
parseError_errorParameters,
parseError_get_errorParametersCount
}; };
static const tid_t parseError_iface_tids[] = { static const tid_t parseError_iface_tids[] = {
IXMLDOMParseError_tid, IXMLDOMParseError2_tid,
0 0
}; };
static dispex_static_data_t parseError_dispex = { static dispex_static_data_t parseError_dispex = {
NULL, NULL,
IXMLDOMParseError_tid, IXMLDOMParseError2_tid,
NULL, NULL,
parseError_iface_tids parseError_iface_tids
}; };
@ -294,7 +336,7 @@ IXMLDOMParseError *create_parseError( LONG code, BSTR url, BSTR reason, BSTR src
if ( !This ) if ( !This )
return NULL; return NULL;
This->IXMLDOMParseError_iface.lpVtbl = &parseError_vtbl; This->IXMLDOMParseError2_iface.lpVtbl = &XMLDOMParseError2Vtbl;
This->ref = 1; This->ref = 1;
This->code = code; This->code = code;
@ -305,7 +347,7 @@ IXMLDOMParseError *create_parseError( LONG code, BSTR url, BSTR reason, BSTR src
This->linepos = linepos; This->linepos = linepos;
This->filepos = filepos; This->filepos = filepos;
init_dispex(&This->dispex, (IUnknown*)&This->IXMLDOMParseError_iface, &parseError_dispex); init_dispex(&This->dispex, (IUnknown*)&This->IXMLDOMParseError2_iface, &parseError_dispex);
return &This->IXMLDOMParseError_iface; return (IXMLDOMParseError*)&This->IXMLDOMParseError2_iface;
} }

View File

@ -10886,6 +10886,7 @@ static void test_dispex(void)
static void test_parseerror(void) static void test_parseerror(void)
{ {
IXMLDOMParseError2 *error2;
IXMLDOMParseError *error; IXMLDOMParseError *error;
IXMLDOMDocument *doc; IXMLDOMDocument *doc;
HRESULT hr; HRESULT hr;
@ -10905,7 +10906,16 @@ static void test_parseerror(void)
EXPECT_HR(hr, E_INVALIDARG); EXPECT_HR(hr, E_INVALIDARG);
IXMLDOMParseError_Release(error); IXMLDOMParseError_Release(error);
IXMLDOMDocument_Release(doc);
doc = create_document_version(60, &IID_IXMLDOMDocument);
if (!doc) return;
hr = IXMLDOMDocument_get_parseError(doc, &error);
EXPECT_HR(hr, S_OK);
hr = IXMLDOMParseError_QueryInterface(error, &IID_IXMLDOMParseError2, (void**)&error2);
EXPECT_HR(hr, S_OK);
IXMLDOMParseError2_Release(error2);
IXMLDOMParseError_Release(error);
IXMLDOMDocument_Release(doc); IXMLDOMDocument_Release(doc);
} }