Signed-off-by: Daniel Lehman dlehman25@gmail.com --- dlls/shcore/main.c | 4 +++- dlls/shlwapi/tests/istream.c | 2 -- 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/shcore/main.c b/dlls/shcore/main.c index f9722135fce..d5fce76eade 100644 --- a/dlls/shcore/main.c +++ b/dlls/shcore/main.c @@ -555,7 +555,9 @@ static HRESULT WINAPI shstream_QueryInterface(IStream *iface, REFIID riid, void
TRACE("(%p)->(%s, %p)\n", stream, debugstr_guid(riid), out);
- if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IStream)) + if (IsEqualIID(riid, &IID_IUnknown) || + IsEqualIID(riid, &IID_IStream) || + IsEqualIID(riid, &IID_ISequentialStream)) { *out = iface; IStream_AddRef(iface); diff --git a/dlls/shlwapi/tests/istream.c b/dlls/shlwapi/tests/istream.c index 0888e7eb3a7..bbd198c8fde 100644 --- a/dlls/shlwapi/tests/istream.c +++ b/dlls/shlwapi/tests/istream.c @@ -270,7 +270,6 @@ static void test_stream_qi(IStream *stream)
unk = NULL; hr = IStream_QueryInterface(stream, &IID_ISequentialStream, (void **)&unk); -todo_wine ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE) /* XP */, "Failed to get ISequentialStream interface, hr %#x.\n", hr); if (unk) IUnknown_Release(unk); @@ -755,7 +754,6 @@ static void test_SHCreateMemStream(void) ok(stream != NULL, "Failed to create a stream.\n");
hr = IStream_QueryInterface(stream, &IID_ISequentialStream, (void **)&unk); -todo_wine ok(hr == S_OK || broken(hr == E_NOINTERFACE) /* WinXP */, "Failed to QI, hr %#x.\n", hr); if (unk) IUnknown_Release(unk);
Signed-off-by: Daniel Lehman dlehman25@gmail.com --- dlls/msxml3/domdoc.c | 9 ++++++- dlls/msxml3/node.c | 6 ++--- dlls/msxml3/tests/domdoc.c | 50 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 4 deletions(-)
diff --git a/dlls/msxml3/domdoc.c b/dlls/msxml3/domdoc.c index d447bd2b1d8..80c32e9ba99 100644 --- a/dlls/msxml3/domdoc.c +++ b/dlls/msxml3/domdoc.c @@ -1524,8 +1524,10 @@ static HRESULT WINAPI domdoc_transformNodeToObject( case VT_UNKNOWN: case VT_DISPATCH: { + ISequentialStream *stream; IXMLDOMDocument *doc; HRESULT hr; + BSTR str;
if (!V_UNKNOWN(&output)) return E_INVALIDARG; @@ -1535,7 +1537,6 @@ static HRESULT WINAPI domdoc_transformNodeToObject( if (IUnknown_QueryInterface(V_UNKNOWN(&output), &IID_IXMLDOMDocument, (void **)&doc) == S_OK) { VARIANT_BOOL b; - BSTR str;
if (FAILED(hr = node_transform_node(&This->node, stylesheet, &str))) return hr; @@ -1544,6 +1545,12 @@ static HRESULT WINAPI domdoc_transformNodeToObject( SysFreeString(str); return hr; } + else if (IUnknown_QueryInterface(V_UNKNOWN(&output), &IID_ISequentialStream, (void**)&stream) == S_OK) + { + hr = node_transform_node_params(&This->node, stylesheet, NULL, stream, NULL); + ISequentialStream_Release(stream); + return hr; + } else { FIXME("Unsupported destination type.\n"); diff --git a/dlls/msxml3/node.c b/dlls/msxml3/node.c index 35777d65918..67f322eb0e5 100644 --- a/dlls/msxml3/node.c +++ b/dlls/msxml3/node.c @@ -1512,9 +1512,9 @@ HRESULT node_transform_node_params(const xmlnode *This, IXMLDOMNode *stylesheet, xmlnode *sheet;
if (!libxslt_handle) return E_NOTIMPL; - if (!stylesheet || !p) return E_INVALIDARG; + if (!stylesheet || (!p && !stream)) return E_INVALIDARG;
- *p = NULL; + if (p) *p = NULL;
sheet = get_node_obj(stylesheet); if(!sheet) return E_FAIL; @@ -1572,7 +1572,7 @@ HRESULT node_transform_node_params(const xmlnode *This, IXMLDOMNode *stylesheet, else xmlFreeDoc(sheet_doc);
- if(!*p) *p = SysAllocStringLen(NULL, 0); + if (p && !*p) *p = SysAllocStringLen(NULL, 0);
return hr; #else diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c index 101a775ca36..eb2fcc4c15f 100644 --- a/dlls/msxml3/tests/domdoc.c +++ b/dlls/msxml3/tests/domdoc.c @@ -13030,7 +13030,12 @@ static void test_transformNodeToObject(void) { IUnknown transformdest = { &transformdestvtbl }; IXMLDOMDocument *doc, *doc2, *doc3; + ISequentialStream *sstream; + LARGE_INTEGER off; + WCHAR buffer[256]; + IStream *istream; VARIANT_BOOL b; + ULONG nread; HRESULT hr; VARIANT v;
@@ -13063,6 +13068,51 @@ static void test_transformNodeToObject(void) hr = IXMLDOMDocument_transformNodeToObject(doc, (IXMLDOMNode *)doc2, v); ok(hr == S_OK, "Failed to transform node, hr %#x.\n", hr);
+ /* IStream */ + istream = SHCreateMemStream(NULL, 0); + V_VT(&v) = VT_UNKNOWN; + V_UNKNOWN(&v) = (IUnknown *)istream; + hr = IXMLDOMDocument_transformNodeToObject(doc, (IXMLDOMNode *)doc2, v); + ok(hr == S_OK, "Failed to transform node, hr %#x.\n", hr); + + off.QuadPart = 0; + hr = IStream_Seek(istream, off, STREAM_SEEK_SET, NULL); + ok(hr == S_OK, "Failed to seek, hr %#x.\n", hr); + + nread = 0; + memset(buffer, 0xcc, sizeof(buffer)); + hr = IStream_Read(istream, buffer, sizeof(buffer), &nread); + ok(hr == S_OK, "Failed to read, hr %#x.\n", hr); + buffer[nread/2] = 0; + ok(buffer[0] == 0xfeff, "got %x\n", buffer[0]); + ok(compareIgnoreReturns(&buffer[1], _bstr_(szTransformOutput)), "got output %s\n", wine_dbgstr_w(buffer)); + IStream_Release(istream); + + /* ISequentialStream */ + istream = SHCreateMemStream(NULL, 0); + sstream = NULL; + hr = IStream_QueryInterface(istream, &IID_ISequentialStream, (void**)&sstream); + ok(hr == S_OK, "Failed to QI, hr %#x.\n", hr); + + V_VT(&v) = VT_UNKNOWN; + V_UNKNOWN(&v) = (IUnknown *)sstream; + hr = IXMLDOMDocument_transformNodeToObject(doc, (IXMLDOMNode *)doc2, v); + ok(hr == S_OK, "Failed to transform node, hr %#x.\n", hr); + + off.QuadPart = 0; + hr = IStream_Seek(istream, off, STREAM_SEEK_SET, NULL); + ok(hr == S_OK, "Failed to seek, hr %#x.\n", hr); + + nread = 0; + memset(buffer, 0xcc, sizeof(buffer)); + hr = ISequentialStream_Read(sstream, buffer, sizeof(buffer), &nread); + ok(hr == S_OK, "Failed to read, hr %#x.\n", hr); + buffer[nread/2] = 0; + ok(buffer[0] == 0xfeff, "got %x\n", buffer[0]); + ok(compareIgnoreReturns(&buffer[1], _bstr_(szTransformOutput)), "got output %s\n", wine_dbgstr_w(buffer)); + ISequentialStream_Release(sstream); + IStream_Release(istream); + IXMLDOMDocument_Release(doc3); IXMLDOMDocument_Release(doc2); IXMLDOMDocument_Release(doc);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com