Nikolay Sivov : msxml3/xmldoc: IPersistStreamInit::InitNew() seems to do nothing for IXMLDocument.

Alexandre Julliard julliard at winehq.org
Thu Jan 14 11:33:36 CST 2010


Module: wine
Branch: master
Commit: 6c1275a57cef4c5a03ff9df2c346a349e095397d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=6c1275a57cef4c5a03ff9df2c346a349e095397d

Author: Nikolay Sivov <bunglehead at gmail.com>
Date:   Wed Jan 13 00:30:46 2010 +0300

msxml3/xmldoc: IPersistStreamInit::InitNew() seems to do nothing for IXMLDocument.

---

 dlls/msxml3/tests/xmldoc.c |   25 +++++++++++++++++++++++--
 dlls/msxml3/xmldoc.c       |    5 +++--
 2 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/dlls/msxml3/tests/xmldoc.c b/dlls/msxml3/tests/xmldoc.c
index 426ef6f..9611f7c 100644
--- a/dlls/msxml3/tests/xmldoc.c
+++ b/dlls/msxml3/tests/xmldoc.c
@@ -355,6 +355,7 @@ static void test_createElement(void)
 static void test_persiststreaminit(void)
 {
     IXMLDocument *doc = NULL;
+    IXMLElement *element = NULL;
     IPersistStreamInit *psi = NULL;
     IStream *stream = NULL;
     STATSTG stat;
@@ -362,6 +363,8 @@ static void test_persiststreaminit(void)
     ULARGE_INTEGER size;
     CHAR path[MAX_PATH];
     CLSID id;
+    BSTR str;
+    static const WCHAR testW[] = {'t','e','s','t',0};
 
     hr = CoCreateInstance(&CLSID_XMLDocument, NULL, CLSCTX_INPROC_SERVER,
                           &IID_IXMLDocument, (LPVOID*)&doc);
@@ -382,7 +385,10 @@ static void test_persiststreaminit(void)
     todo_wine ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
 
     hr = IPersistStreamInit_GetClassID(psi, NULL);
-    ok(hr == E_POINTER, "Expected E_INVALIDARG, got %08x\n", hr);
+    ok(hr == E_POINTER, "Expected E_POINTER, got %08x\n", hr);
+
+    hr = IPersistStreamInit_IsDirty(psi);
+    todo_wine ok(hr == S_FALSE, "Expected S_FALSE, got %08x\n", hr);
 
     create_xml_file("bank.xml");
     GetFullPathNameA("bank.xml", MAX_PATH, path, NULL);
@@ -400,6 +406,9 @@ static void test_persiststreaminit(void)
     if(hr == XML_E_INVALIDATROOTLEVEL)
         goto cleanup;
 
+    hr = IPersistStreamInit_IsDirty(psi);
+    todo_wine ok(hr == S_FALSE, "Expected S_FALSE, got %08x\n", hr);
+
     /* try to save document */
     stream = NULL;
     hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
@@ -413,9 +422,21 @@ static void test_persiststreaminit(void)
     todo_wine ok(stat.cbSize.QuadPart > 0, "Expected >0\n");
     IStream_Release(stream);
 
+    str = SysAllocString(testW);
+    hr = IXMLDocument_get_root(doc, &element);
+    ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
+    hr = IXMLElement_put_text(element, str);
+    SysFreeString(str);
+
+    hr = IPersistStreamInit_IsDirty(psi);
+    todo_wine ok(hr == S_FALSE, "Expected S_FALSE, got %08x\n", hr);
+
     /* reset internal stream */
     hr = IPersistStreamInit_InitNew(psi);
-    todo_wine ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
+    ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
+
+    hr = IPersistStreamInit_IsDirty(psi);
+    todo_wine ok(hr == S_FALSE, "Expected S_FALSE, got %08x\n", hr);
 
     stream = NULL;
     hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
diff --git a/dlls/msxml3/xmldoc.c b/dlls/msxml3/xmldoc.c
index 7f5e41d..2ca874b 100644
--- a/dlls/msxml3/xmldoc.c
+++ b/dlls/msxml3/xmldoc.c
@@ -670,8 +670,9 @@ static HRESULT WINAPI xmldoc_IPersistStreamInit_GetSizeMax(
 static HRESULT WINAPI xmldoc_IPersistStreamInit_InitNew(
     IPersistStreamInit *iface)
 {
-    FIXME("(%p): stub!\n", iface);
-    return E_NOTIMPL;
+    xmldoc *This = impl_from_IPersistStreamInit(iface);
+    TRACE("(%p)\n", This);
+    return S_OK;
 }
 
 static const IPersistStreamInitVtbl xmldoc_IPersistStreamInit_VTable =




More information about the wine-cvs mailing list