Commit 6ab3f1ae authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

msxml3: Return stream reference from get_output() if stream is set.

parent 729afb18
...@@ -755,6 +755,8 @@ static HRESULT WINAPI mxwriter_get_output(IMXWriter *iface, VARIANT *dest) ...@@ -755,6 +755,8 @@ static HRESULT WINAPI mxwriter_get_output(IMXWriter *iface, VARIANT *dest)
TRACE("(%p)->(%p)\n", This, dest); TRACE("(%p)->(%p)\n", This, dest);
if (!dest) return E_POINTER;
if (!This->dest) if (!This->dest)
{ {
HRESULT hr = flush_output_buffer(This); HRESULT hr = flush_output_buffer(This);
...@@ -766,10 +768,13 @@ static HRESULT WINAPI mxwriter_get_output(IMXWriter *iface, VARIANT *dest) ...@@ -766,10 +768,13 @@ static HRESULT WINAPI mxwriter_get_output(IMXWriter *iface, VARIANT *dest)
return S_OK; return S_OK;
} }
else
FIXME("not implemented when stream is set up\n");
return E_NOTIMPL; /* we only support IStream output so far */
V_VT(dest) = VT_UNKNOWN;
V_UNKNOWN(dest) = (IUnknown*)This->dest;
IStream_AddRef(This->dest);
return S_OK;
} }
static HRESULT WINAPI mxwriter_put_encoding(IMXWriter *iface, BSTR encoding) static HRESULT WINAPI mxwriter_put_encoding(IMXWriter *iface, BSTR encoding)
......
...@@ -2821,6 +2821,7 @@ static void test_mxwriter_flush(void) ...@@ -2821,6 +2821,7 @@ static void test_mxwriter_flush(void)
VARIANT dest; VARIANT dest;
HRESULT hr; HRESULT hr;
char *buff; char *buff;
LONG ref;
hr = CoCreateInstance(&CLSID_MXXMLWriter, NULL, CLSCTX_INPROC_SERVER, hr = CoCreateInstance(&CLSID_MXXMLWriter, NULL, CLSCTX_INPROC_SERVER,
&IID_IMXWriter, (void**)&writer); &IID_IMXWriter, (void**)&writer);
...@@ -2930,6 +2931,18 @@ static void test_mxwriter_flush(void) ...@@ -2930,6 +2931,18 @@ static void test_mxwriter_flush(void)
todo_wine todo_wine
ok(pos2.QuadPart != 0, "unexpected stream beginning\n"); ok(pos2.QuadPart != 0, "unexpected stream beginning\n");
hr = IMXWriter_get_output(writer, NULL);
EXPECT_HR(hr, E_POINTER);
ref = get_refcount(stream);
V_VT(&dest) = VT_EMPTY;
hr = IMXWriter_get_output(writer, &dest);
EXPECT_HR(hr, S_OK);
ok(V_VT(&dest) == VT_UNKNOWN, "got vt type %d\n", V_VT(&dest));
ok(V_UNKNOWN(&dest) == (IUnknown*)stream, "got pointer %p\n", V_UNKNOWN(&dest));
ok(ref+1 == get_refcount(stream), "expected increased refcount\n");
VariantClear(&dest);
hr = ISAXContentHandler_endDocument(content); hr = ISAXContentHandler_endDocument(content);
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment