From 2d9f6f7215db832205f8e1da8b5ccaa3eaaafc2d Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Thu, 24 Mar 2016 10:41:24 +0300 Subject: [PATCH] xmllite/writer: Put writer into closed state on WriteAttributeString(). Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/xmllite/tests/writer.c | 10 ++++++++++ dlls/xmllite/writer.c | 2 ++ 2 files changed, 12 insertions(+) diff --git a/dlls/xmllite/tests/writer.c b/dlls/xmllite/tests/writer.c index 81945d160a2..cb379fecbbd 100644 --- a/dlls/xmllite/tests/writer.c +++ b/dlls/xmllite/tests/writer.c @@ -907,6 +907,7 @@ static void test_WriteRaw(void) static void test_writer_state(void) { + static const WCHAR aW[] = {'a',0}; IXmlWriter *writer; IStream *stream; HRESULT hr; @@ -927,6 +928,15 @@ static void test_writer_state(void) IStream_Release(stream); + stream = writer_set_output(writer); + + hr = IXmlWriter_WriteAttributeString(writer, NULL, aW, NULL, aW); + ok(hr == WR_E_INVALIDACTION, "got 0x%08x\n", hr); + + check_writer_state(writer, WR_E_INVALIDACTION); + + IStream_Release(stream); + IXmlWriter_Release(writer); } diff --git a/dlls/xmllite/writer.c b/dlls/xmllite/writer.c index 7895fb022d3..5e3557b7fa7 100644 --- a/dlls/xmllite/writer.c +++ b/dlls/xmllite/writer.c @@ -591,7 +591,9 @@ static HRESULT WINAPI xmlwriter_WriteAttributeString(IXmlWriter *iface, LPCWSTR { case XmlWriterState_Initial: return E_UNEXPECTED; + case XmlWriterState_Ready: case XmlWriterState_DocClosed: + This->state = XmlWriterState_DocClosed; return WR_E_INVALIDACTION; default: ;