>From 9de20371f7667090efbeed41cb31c094568a0269 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <nsivov@codeweavers.com>
Date: Wed, 14 Dec 2011 14:48:52 +0300
Subject: [PATCH 2/3] Added IXMLDOMParseError2 support

---
 dlls/msxml3/dispex.c        |    2 +-
 dlls/msxml3/msxml_private.h |    2 +-
 dlls/msxml3/parseerror.c    |  122 +++++++++++++++++++++++++++++--------------
 dlls/msxml3/tests/domdoc.c  |    9 +++
 4 files changed, 93 insertions(+), 42 deletions(-)

diff --git a/dlls/msxml3/dispex.c b/dlls/msxml3/dispex.c
index 5114222..d13b182 100644
--- a/dlls/msxml3/dispex.c
+++ b/dlls/msxml3/dispex.c
@@ -126,7 +126,7 @@ static tid_id_t tid_ids[] = {
     { &IID_IXMLDOMNamedNodeMap, LibXml2 },
     { &IID_IXMLDOMNode, LibXml2 },
     { &IID_IXMLDOMNodeList, LibXml2 },
-    { &IID_IXMLDOMParseError, LibXml2 },
+    { &IID_IXMLDOMParseError2, LibXml2 },
     { &IID_IXMLDOMProcessingInstruction, LibXml2 },
     { &IID_IXMLDOMSchemaCollection, LibXml2 },
     { &IID_IXMLDOMSchemaCollection2, LibXml2 },
diff --git a/dlls/msxml3/msxml_private.h b/dlls/msxml3/msxml_private.h
index cba00bb..ad9e5c0 100644
--- a/dlls/msxml3/msxml_private.h
+++ b/dlls/msxml3/msxml_private.h
@@ -53,7 +53,7 @@ typedef enum tid_t {
     IXMLDOMNamedNodeMap_tid,
     IXMLDOMNode_tid,
     IXMLDOMNodeList_tid,
-    IXMLDOMParseError_tid,
+    IXMLDOMParseError2_tid,
     IXMLDOMProcessingInstruction_tid,
     IXMLDOMSchemaCollection_tid,
     IXMLDOMSchemaCollection2_tid,
diff --git a/dlls/msxml3/parseerror.c b/dlls/msxml3/parseerror.c
index dd5f914..b5c7948 100644
--- a/dlls/msxml3/parseerror.c
+++ b/dlls/msxml3/parseerror.c
@@ -45,29 +45,30 @@ WINE_DEFAULT_DEBUG_CHANNEL(msxml);
 typedef struct
 {
     DispatchEx dispex;
-    IXMLDOMParseError IXMLDOMParseError_iface;
+    IXMLDOMParseError2 IXMLDOMParseError2_iface;
     LONG ref;
     LONG code, line, linepos, filepos;
     BSTR url, reason, srcText;
 } 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(
-    IXMLDOMParseError *iface,
+    IXMLDOMParseError2 *iface,
     REFIID riid,
     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);
 
     if ( IsEqualGUID( riid, &IID_IUnknown ) ||
          IsEqualGUID( riid, &IID_IDispatch ) ||
-         IsEqualGUID( riid, &IID_IXMLDOMParseError ) )
+         IsEqualGUID( riid, &IID_IXMLDOMParseError ) ||
+         IsEqualGUID( riid, &IID_IXMLDOMParseError2 ) )
     {
         *ppvObject = iface;
     }
@@ -82,24 +83,24 @@ static HRESULT WINAPI parseError_QueryInterface(
         return E_NOINTERFACE;
     }
 
-    IXMLDOMParseError_AddRef( iface );
+    IXMLDOMParseError2_AddRef( iface );
 
     return S_OK;
 }
 
 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 );
     TRACE("(%p)->(%d)\n", This, ref);
     return ref;
 }
 
 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 );
 
     TRACE("(%p)->(%d)\n", This, ref);
@@ -116,39 +117,39 @@ static ULONG WINAPI parseError_Release(
 }
 
 static HRESULT WINAPI parseError_GetTypeInfoCount(
-    IXMLDOMParseError *iface,
+    IXMLDOMParseError2 *iface,
     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);
 }
 
 static HRESULT WINAPI parseError_GetTypeInfo(
-    IXMLDOMParseError *iface,
+    IXMLDOMParseError2 *iface,
     UINT iTInfo,
     LCID lcid,
     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,
         iTInfo, lcid, ppTInfo);
 }
 
 static HRESULT WINAPI parseError_GetIDsOfNames(
-    IXMLDOMParseError *iface,
+    IXMLDOMParseError2 *iface,
     REFIID riid,
     LPOLESTR* rgszNames,
     UINT cNames,
     LCID lcid,
     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,
         riid, rgszNames, cNames, lcid, rgDispId);
 }
 
 static HRESULT WINAPI parseError_Invoke(
-    IXMLDOMParseError *iface,
+    IXMLDOMParseError2 *iface,
     DISPID dispIdMember,
     REFIID riid,
     LCID lcid,
@@ -158,16 +159,16 @@ static HRESULT WINAPI parseError_Invoke(
     EXCEPINFO* pExcepInfo,
     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,
         dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
 }
 
 static HRESULT WINAPI parseError_get_errorCode(
-    IXMLDOMParseError *iface,
+    IXMLDOMParseError2 *iface,
     LONG *code )
 {
-    parse_error_t *This = impl_from_IXMLDOMParseError( iface );
+    parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
     TRACE("(%p)->(%p)\n", This, code);
 
     *code = This->code;
@@ -179,19 +180,19 @@ static HRESULT WINAPI parseError_get_errorCode(
 }
 
 static HRESULT WINAPI parseError_get_url(
-    IXMLDOMParseError *iface,
+    IXMLDOMParseError2 *iface,
     BSTR *url )
 {
-    parse_error_t *This = impl_from_IXMLDOMParseError( iface );
+    parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
     FIXME("(%p)->(%p)\n", This, url);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI parseError_get_reason(
-    IXMLDOMParseError *iface,
+    IXMLDOMParseError2 *iface,
     BSTR *reason )
 {
-    parse_error_t *This = impl_from_IXMLDOMParseError( iface );
+    parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
     TRACE("(%p)->(%p)\n", This, reason);
     
     if(!This->reason)
@@ -204,10 +205,10 @@ static HRESULT WINAPI parseError_get_reason(
 }
 
 static HRESULT WINAPI parseError_get_srcText(
-    IXMLDOMParseError *iface,
+    IXMLDOMParseError2 *iface,
     BSTR *srcText )
 {
-    parse_error_t *This = impl_from_IXMLDOMParseError( iface );
+    parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
 
     TRACE("(%p)->(%p)\n", This, srcText);
 
@@ -219,10 +220,10 @@ static HRESULT WINAPI parseError_get_srcText(
 }
 
 static HRESULT WINAPI parseError_get_line(
-    IXMLDOMParseError *iface,
+    IXMLDOMParseError2 *iface,
     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);
 
@@ -233,10 +234,10 @@ static HRESULT WINAPI parseError_get_line(
 }
 
 static HRESULT WINAPI parseError_get_linepos(
-    IXMLDOMParseError *iface,
+    IXMLDOMParseError2 *iface,
     LONG *linepos )
 {
-    parse_error_t *This = impl_from_IXMLDOMParseError( iface );
+    parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
 
     TRACE("(%p)->(%p)\n", This, linepos);
 
@@ -247,15 +248,52 @@ static HRESULT WINAPI parseError_get_linepos(
 }
 
 static HRESULT WINAPI parseError_get_filepos(
-    IXMLDOMParseError *iface,
+    IXMLDOMParseError2 *iface,
     LONG *filepos )
 {
-    parse_error_t *This = impl_from_IXMLDOMParseError( iface );
+    parse_error_t *This = impl_from_IXMLDOMParseError2( iface );
     FIXME("(%p)->(%p)\n", This, filepos);
     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_AddRef,
@@ -270,17 +308,21 @@ static const struct IXMLDOMParseErrorVtbl parseError_vtbl =
     parseError_get_srcText,
     parseError_get_line,
     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[] = {
-    IXMLDOMParseError_tid,
+    IXMLDOMParseError2_tid,
     0
 };
 
 static dispex_static_data_t parseError_dispex = {
     NULL,
-    IXMLDOMParseError_tid,
+    IXMLDOMParseError2_tid,
     NULL,
     parseError_iface_tids
 };
@@ -294,7 +336,7 @@ IXMLDOMParseError *create_parseError( LONG code, BSTR url, BSTR reason, BSTR src
     if ( !This )
         return NULL;
 
-    This->IXMLDOMParseError_iface.lpVtbl = &parseError_vtbl;
+    This->IXMLDOMParseError2_iface.lpVtbl = &XMLDOMParseError2Vtbl;
     This->ref = 1;
 
     This->code = code;
@@ -305,7 +347,7 @@ IXMLDOMParseError *create_parseError( LONG code, BSTR url, BSTR reason, BSTR src
     This->linepos = linepos;
     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;
 }
diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c
index 19cb758..502dd11 100644
--- a/dlls/msxml3/tests/domdoc.c
+++ b/dlls/msxml3/tests/domdoc.c
@@ -10886,6 +10886,7 @@ static void test_dispex(void)
 
 static void test_parseerror(void)
 {
+    IXMLDOMParseError2 *error2;
     IXMLDOMParseError *error;
     IXMLDOMDocument *doc;
     HRESULT hr;
@@ -10905,7 +10906,15 @@ static void test_parseerror(void)
     EXPECT_HR(hr, E_INVALIDARG);
 
     IXMLDOMParseError_Release(error);
+    IXMLDOMDocument_Release(doc);
 
+    doc = create_document_version(60, &IID_IXMLDOMDocument);
+    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);
 }
 
-- 
1.5.6.5


