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: ;