>From 4788ed9fb9e96f88a3d86b892c68bb0032931ac8 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <nsivov@codeweavers.com>
Date: Tue, 13 Mar 2012 11:12:16 +0300
Subject: [PATCH 4/4] Implement ISAXAttributes_getQName() for MXAttributes

---
 dlls/msxml3/mxwriter.c        |   12 ++++++++++--
 dlls/msxml3/tests/saxreader.c |   13 +++----------
 2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/dlls/msxml3/mxwriter.c b/dlls/msxml3/mxwriter.c
index 6217d45..f749eb5 100644
--- a/dlls/msxml3/mxwriter.c
+++ b/dlls/msxml3/mxwriter.c
@@ -1756,8 +1756,16 @@ static HRESULT WINAPI SAXAttributes_getLocalName(ISAXAttributes *iface, int nInd
 static HRESULT WINAPI SAXAttributes_getQName(ISAXAttributes *iface, int index, const WCHAR **qname, int *length)
 {
     mxattributes *This = impl_from_ISAXAttributes( iface );
-    FIXME("(%p)->(%d %p %p): stub\n", This, index, qname, length);
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%d %p %p)\n", This, index, qname, length);
+
+    if (index >= This->length) return E_INVALIDARG;
+    if (!qname || !length) return E_POINTER;
+
+    *qname = This->attr[index].qname;
+    *length = SysStringLen(This->attr[index].qname);
+
+    return S_OK;
 }
 
 static HRESULT WINAPI SAXAttributes_getName(ISAXAttributes *iface, int nIndex, const WCHAR **pUri, int *pUriLength,
diff --git a/dlls/msxml3/tests/saxreader.c b/dlls/msxml3/tests/saxreader.c
index 27200cb..8b0a3c4 100644
--- a/dlls/msxml3/tests/saxreader.c
+++ b/dlls/msxml3/tests/saxreader.c
@@ -3366,11 +3366,9 @@ static void test_mxattr_clear(void)
     EXPECT_HR(hr, S_OK);
 
     hr = ISAXAttributes_getQName(saxattr, 0, NULL, NULL);
-todo_wine
     EXPECT_HR(hr, E_INVALIDARG);
 
     hr = ISAXAttributes_getQName(saxattr, 0, &ptr, &len);
-todo_wine
     EXPECT_HR(hr, E_INVALIDARG);
 
     hr = IMXAttributes_addAttribute(mxattr, _bstr_("uri"), _bstr_("local"),
@@ -3384,24 +3382,19 @@ todo_wine
 
     len = -1;
     hr = ISAXAttributes_getQName(saxattr, 0, NULL, &len);
-todo_wine
     EXPECT_HR(hr, E_POINTER);
     ok(len == -1, "got %d\n", len);
 
     ptr = (void*)0xdeadbeef;
     hr = ISAXAttributes_getQName(saxattr, 0, &ptr, NULL);
-todo_wine
     EXPECT_HR(hr, E_POINTER);
     ok(ptr == (void*)0xdeadbeef, "got %p\n", ptr);
 
     len = 0;
     hr = ISAXAttributes_getQName(saxattr, 0, &ptr, &len);
-todo_wine {
     EXPECT_HR(hr, S_OK);
     ok(len == 5, "got %d\n", len);
-    if (hr == S_OK)
-        ok(!lstrcmpW(ptr, _bstr_("qname")), "got %s\n", wine_dbgstr_w(ptr));
-}
+    ok(!lstrcmpW(ptr, _bstr_("qname")), "got %s\n", wine_dbgstr_w(ptr));
 
     hr = IMXAttributes_clear(mxattr);
 todo_wine
@@ -3416,11 +3409,11 @@ todo_wine
     len = -1;
     ptr = (void*)0xdeadbeef;
     hr = ISAXAttributes_getQName(saxattr, 0, &ptr, &len);
-todo_wine
+todo_wine {
     EXPECT_HR(hr, E_INVALIDARG);
     ok(len == -1, "got %d\n", len);
     ok(ptr == (void*)0xdeadbeef, "got %p\n", ptr);
-
+}
     IMXAttributes_Release(mxattr);
     ISAXAttributes_Release(saxattr);
     free_bstrs();
-- 
1.5.6.5


