From d241788d28e15b6a58899585f906a6471bf9caf2 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Mon, 14 Mar 2016 10:11:02 +0300 Subject: [PATCH] msxml3: Accept VT_UNKNOWN input for IXMLDOMSchemaCollection::add(). Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/msxml3/schema.c | 10 +++++----- dlls/msxml3/tests/schema.c | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/dlls/msxml3/schema.c b/dlls/msxml3/schema.c index 7a1f8b376d8..41d16408717 100644 --- a/dlls/msxml3/schema.c +++ b/dlls/msxml3/schema.c @@ -1226,12 +1226,13 @@ static HRESULT WINAPI schema_cache_add(IXMLDOMSchemaCollection2* iface, BSTR uri break; case VT_DISPATCH: + case VT_UNKNOWN: { xmlDocPtr doc = NULL; cache_entry* entry; CacheEntryType type; IXMLDOMNode* domnode = NULL; - IDispatch_QueryInterface(V_DISPATCH(&var), &IID_IXMLDOMNode, (void**)&domnode); + IUnknown_QueryInterface(V_UNKNOWN(&var), &IID_IXMLDOMNode, (void**)&domnode); if (domnode) doc = xmlNodePtr_from_domnode(domnode, XML_DOCUMENT_NODE)->doc; @@ -1275,10 +1276,9 @@ static HRESULT WINAPI schema_cache_add(IXMLDOMSchemaCollection2* iface, BSTR uri break; default: - { - heap_free(name); - return E_INVALIDARG; - } + FIXME("arg type is not supported, %s\n", debugstr_variant(&var)); + heap_free(name); + return E_INVALIDARG; } heap_free(name); return S_OK; diff --git a/dlls/msxml3/tests/schema.c b/dlls/msxml3/tests/schema.c index 43ddc3cb851..bd5c3595d66 100644 --- a/dlls/msxml3/tests/schema.c +++ b/dlls/msxml3/tests/schema.c @@ -506,6 +506,7 @@ static void test_schema_refs(void) VARIANT_BOOL b; BSTR str; LONG len; + HRESULT hr; doc = create_document(&IID_IXMLDOMDocument2); if (!doc) @@ -557,6 +558,24 @@ static void test_schema_refs(void) ole_check(IXMLDOMSchemaCollection_get_length(cache, &len)); ok(len == 0, "got %d\n", len); + /* same, but with VT_UNKNOWN type */ + V_VT(&v) = VT_UNKNOWN; + V_UNKNOWN(&v) = (IUnknown*)doc; + hr = IXMLDOMSchemaCollection_add(cache, NULL, v); + ok(hr == S_OK, "got 0x%08x\n", hr); + + len = -1; + hr = IXMLDOMSchemaCollection_get_length(cache, &len); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(len == 1, "got %d\n", len); + + hr = IXMLDOMSchemaCollection_remove(cache, NULL); + ok(hr == S_OK, "got 0x%08x\n", hr); + len = -1; + hr = IXMLDOMSchemaCollection_get_length(cache, &len); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(len == 0, "got %d\n", len); + str = SysAllocString(xdr_schema_uri); ole_check(IXMLDOMSchemaCollection_add(cache, str, _variantdoc_(doc)));