msxml3: Fix value of 'fetched' in IEnumVARIANT::Next() for IXMLDOMSelection.
It must be the number of elements returned in 'var', as specified here: https://docs.microsoft.com/en-us/windows/win32/api/oaidl/nf-oaidl-ienumvariant-next Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=40430 Signed-off-by: Alexandre Abgrall <aabgrall98@gmail.com> Signed-off-by: Gijs Vermeulen <gijsvrm@gmail.com> Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
ee54c594e9
commit
72f42516b2
|
@ -519,7 +519,7 @@ static HRESULT WINAPI enumvariant_Next(
|
||||||
ret_count++;
|
ret_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fetched) (*fetched)++;
|
if (fetched) *fetched = ret_count;
|
||||||
|
|
||||||
/* we need to advance one step more for some reason */
|
/* we need to advance one step more for some reason */
|
||||||
if (ret_count)
|
if (ret_count)
|
||||||
|
|
|
@ -9976,9 +9976,9 @@ static void test_selection(void)
|
||||||
IXMLDOMNode *node;
|
IXMLDOMNode *node;
|
||||||
IDispatch *disp;
|
IDispatch *disp;
|
||||||
VARIANT_BOOL b;
|
VARIANT_BOOL b;
|
||||||
|
VARIANT v[3];
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
DISPID did;
|
DISPID did;
|
||||||
VARIANT v;
|
|
||||||
BSTR name;
|
BSTR name;
|
||||||
ULONG ret;
|
ULONG ret;
|
||||||
LONG len;
|
LONG len;
|
||||||
|
@ -10148,33 +10148,32 @@ static void test_selection(void)
|
||||||
EXPECT_HR(hr, S_OK);
|
EXPECT_HR(hr, S_OK);
|
||||||
|
|
||||||
/* no-op if zero count */
|
/* no-op if zero count */
|
||||||
V_VT(&v) = VT_I2;
|
V_VT(&v[0]) = VT_I2;
|
||||||
hr = IEnumVARIANT_Next(enum1, 0, &v, NULL);
|
hr = IEnumVARIANT_Next(enum1, 0, &v[0], NULL);
|
||||||
EXPECT_HR(hr, S_OK);
|
EXPECT_HR(hr, S_OK);
|
||||||
ok(V_VT(&v) == VT_I2, "got var type %d\n", V_VT(&v));
|
ok(V_VT(&v[0]) == VT_I2, "got var type %d\n", V_VT(&v[0]));
|
||||||
|
|
||||||
/* positive count, null array pointer */
|
/* positive count, null array pointer */
|
||||||
hr = IEnumVARIANT_Next(enum1, 1, NULL, NULL);
|
hr = IEnumVARIANT_Next(enum1, 1, NULL, NULL);
|
||||||
EXPECT_HR(hr, E_INVALIDARG);
|
EXPECT_HR(hr, E_INVALIDARG);
|
||||||
|
|
||||||
ret = 1;
|
|
||||||
hr = IEnumVARIANT_Next(enum1, 1, NULL, &ret);
|
hr = IEnumVARIANT_Next(enum1, 1, NULL, &ret);
|
||||||
EXPECT_HR(hr, E_INVALIDARG);
|
EXPECT_HR(hr, E_INVALIDARG);
|
||||||
ok(ret == 0, "got %d\n", ret);
|
ok(ret == 0, "got %d\n", ret);
|
||||||
|
|
||||||
V_VT(&v) = VT_I2;
|
V_VT(&v[0]) = VT_I2;
|
||||||
hr = IEnumVARIANT_Next(enum1, 1, &v, NULL);
|
hr = IEnumVARIANT_Next(enum1, 1, &v[0], NULL);
|
||||||
EXPECT_HR(hr, S_OK);
|
EXPECT_HR(hr, S_OK);
|
||||||
ok(V_VT(&v) == VT_DISPATCH, "got var type %d\n", V_VT(&v));
|
ok(V_VT(&v[0]) == VT_DISPATCH, "got var type %d\n", V_VT(&v[0]));
|
||||||
|
|
||||||
hr = IDispatch_QueryInterface(V_DISPATCH(&v), &IID_IXMLDOMNode, (void**)&node);
|
hr = IDispatch_QueryInterface(V_DISPATCH(&v[0]), &IID_IXMLDOMNode, (void**)&node);
|
||||||
EXPECT_HR(hr, S_OK);
|
EXPECT_HR(hr, S_OK);
|
||||||
hr = IXMLDOMNode_get_nodeName(node, &name);
|
hr = IXMLDOMNode_get_nodeName(node, &name);
|
||||||
EXPECT_HR(hr, S_OK);
|
EXPECT_HR(hr, S_OK);
|
||||||
ok(!lstrcmpW(name, L"a"), "got node name %s\n", wine_dbgstr_w(name));
|
ok(!lstrcmpW(name, L"a"), "got node name %s\n", wine_dbgstr_w(name));
|
||||||
SysFreeString(name);
|
SysFreeString(name);
|
||||||
IXMLDOMNode_Release(node);
|
IXMLDOMNode_Release(node);
|
||||||
VariantClear(&v);
|
VariantClear(&v[0]);
|
||||||
|
|
||||||
/* list cursor is updated */
|
/* list cursor is updated */
|
||||||
hr = IXMLDOMSelection_nextNode(selection, &node);
|
hr = IXMLDOMSelection_nextNode(selection, &node);
|
||||||
|
@ -10185,18 +10184,18 @@ static void test_selection(void)
|
||||||
IXMLDOMNode_Release(node);
|
IXMLDOMNode_Release(node);
|
||||||
SysFreeString(name);
|
SysFreeString(name);
|
||||||
|
|
||||||
V_VT(&v) = VT_I2;
|
V_VT(&v[0]) = VT_I2;
|
||||||
hr = IEnumVARIANT_Next(enum1, 1, &v, NULL);
|
hr = IEnumVARIANT_Next(enum1, 1, &v[0], NULL);
|
||||||
EXPECT_HR(hr, S_OK);
|
EXPECT_HR(hr, S_OK);
|
||||||
ok(V_VT(&v) == VT_DISPATCH, "got var type %d\n", V_VT(&v));
|
ok(V_VT(&v[0]) == VT_DISPATCH, "got var type %d\n", V_VT(&v[0]));
|
||||||
hr = IDispatch_QueryInterface(V_DISPATCH(&v), &IID_IXMLDOMNode, (void**)&node);
|
hr = IDispatch_QueryInterface(V_DISPATCH(&v[0]), &IID_IXMLDOMNode, (void**)&node);
|
||||||
EXPECT_HR(hr, S_OK);
|
EXPECT_HR(hr, S_OK);
|
||||||
hr = IXMLDOMNode_get_nodeName(node, &name);
|
hr = IXMLDOMNode_get_nodeName(node, &name);
|
||||||
EXPECT_HR(hr, S_OK);
|
EXPECT_HR(hr, S_OK);
|
||||||
ok(!lstrcmpW(name, L"b"), "got node name %s\n", wine_dbgstr_w(name));
|
ok(!lstrcmpW(name, L"b"), "got node name %s\n", wine_dbgstr_w(name));
|
||||||
SysFreeString(name);
|
SysFreeString(name);
|
||||||
IXMLDOMNode_Release(node);
|
IXMLDOMNode_Release(node);
|
||||||
VariantClear(&v);
|
VariantClear(&v[0]);
|
||||||
IEnumVARIANT_Release(enum1);
|
IEnumVARIANT_Release(enum1);
|
||||||
|
|
||||||
hr = IXMLDOMSelection_nextNode(selection, &node);
|
hr = IXMLDOMSelection_nextNode(selection, &node);
|
||||||
|
@ -10207,6 +10206,81 @@ static void test_selection(void)
|
||||||
IXMLDOMNode_Release(node);
|
IXMLDOMNode_Release(node);
|
||||||
SysFreeString(name);
|
SysFreeString(name);
|
||||||
|
|
||||||
|
/* getting multiple elements */
|
||||||
|
enum1 = NULL;
|
||||||
|
hr = IXMLDOMSelection_get__newEnum(selection, (IUnknown**)&enum1);
|
||||||
|
EXPECT_HR(hr, S_OK);
|
||||||
|
ok(enum1 != NULL, "got %p\n", enum1);
|
||||||
|
|
||||||
|
V_VT(&v[1]) = VT_EMPTY;
|
||||||
|
V_VT(&v[0]) = VT_EMPTY;
|
||||||
|
hr = IEnumVARIANT_Next(enum1, 2, v, &ret);
|
||||||
|
EXPECT_HR(hr, S_OK);
|
||||||
|
ok(ret == 2, "got %d, expected 2\n", ret);
|
||||||
|
ok(V_VT(&v[0]) == VT_DISPATCH, "got var type %d\n", V_VT(&v[0]));
|
||||||
|
ok(V_VT(&v[1]) == VT_DISPATCH, "got var type %d\n", V_VT(&v[1]));
|
||||||
|
|
||||||
|
hr = IDispatch_QueryInterface(V_DISPATCH(&v[0]), &IID_IXMLDOMNode, (void**)&node);
|
||||||
|
EXPECT_HR(hr, S_OK);
|
||||||
|
hr = IXMLDOMNode_get_nodeName(node, &name);
|
||||||
|
EXPECT_HR(hr, S_OK);
|
||||||
|
ok(!lstrcmpW(name, L"a"), "got node name %s\n", wine_dbgstr_w(name));
|
||||||
|
SysFreeString(name);
|
||||||
|
IXMLDOMNode_Release(node);
|
||||||
|
|
||||||
|
hr = IDispatch_QueryInterface(V_DISPATCH(&v[1]), &IID_IXMLDOMNode, (void**)&node);
|
||||||
|
EXPECT_HR(hr, S_OK);
|
||||||
|
hr = IXMLDOMNode_get_nodeName(node, &name);
|
||||||
|
ok(!lstrcmpW(name, L"b"), "got node name %s\n", wine_dbgstr_w(name));
|
||||||
|
SysFreeString(name);
|
||||||
|
IXMLDOMNode_Release(node);
|
||||||
|
|
||||||
|
VariantClear(&v[1]);
|
||||||
|
VariantClear(&v[0]);
|
||||||
|
|
||||||
|
/* IEnumVARIANT_Next makes the IXMLDOMSelection cursor advance one step more */
|
||||||
|
hr = IXMLDOMSelection_nextNode(selection, &node);
|
||||||
|
EXPECT_HR(hr, S_OK);
|
||||||
|
hr = IXMLDOMNode_get_nodeName(node, &name);
|
||||||
|
EXPECT_HR(hr, S_OK);
|
||||||
|
ok(!lstrcmpW(name, L"d"), "got node name %s\n", wine_dbgstr_w(name));
|
||||||
|
SysFreeString(name);
|
||||||
|
IXMLDOMNode_Release(node);
|
||||||
|
|
||||||
|
/* The IEnumVARIANT cursor is still at position '2', */
|
||||||
|
/* therefore attempting to fetch 4 elements yields 'c' and 'd' */
|
||||||
|
V_VT(&v[2]) = VT_NULL;
|
||||||
|
V_VT(&v[1]) = VT_EMPTY;
|
||||||
|
V_VT(&v[0]) = VT_EMPTY;
|
||||||
|
hr = IEnumVARIANT_Next(enum1, 4, v, &ret);
|
||||||
|
EXPECT_HR(hr, S_FALSE);
|
||||||
|
ok(ret == 2, "got %d, expected 2\n", ret);
|
||||||
|
|
||||||
|
ok(V_VT(&v[0]) == VT_DISPATCH, "got var type %d\n", V_VT(&v[0]));
|
||||||
|
hr = IDispatch_QueryInterface(V_DISPATCH(&v[0]), &IID_IXMLDOMNode, (void**)&node);
|
||||||
|
EXPECT_HR(hr, S_OK);
|
||||||
|
hr = IXMLDOMNode_get_nodeName(node, &name);
|
||||||
|
EXPECT_HR(hr, S_OK);
|
||||||
|
ok(!lstrcmpW(name, L"c"), "got node name %s\n", wine_dbgstr_w(name));
|
||||||
|
SysFreeString(name);
|
||||||
|
IXMLDOMNode_Release(node);
|
||||||
|
|
||||||
|
ok(V_VT(&v[1]) == VT_DISPATCH, "got var type %d\n", V_VT(&v[1]));
|
||||||
|
hr = IDispatch_QueryInterface(V_DISPATCH(&v[1]), &IID_IXMLDOMNode, (void**)&node);
|
||||||
|
EXPECT_HR(hr, S_OK);
|
||||||
|
hr = IXMLDOMNode_get_nodeName(node, &name);
|
||||||
|
EXPECT_HR(hr, S_OK);
|
||||||
|
ok(!lstrcmpW(name, L"d"), "got node name %s\n", wine_dbgstr_w(name));
|
||||||
|
SysFreeString(name);
|
||||||
|
IXMLDOMNode_Release(node);
|
||||||
|
|
||||||
|
ok(V_VT(&v[2]) == VT_EMPTY, "got var type %d, expected %d (VT_EMPTY)\n", V_VT(&v[2]), VT_EMPTY);
|
||||||
|
|
||||||
|
VariantClear(&v[1]);
|
||||||
|
VariantClear(&v[0]);
|
||||||
|
|
||||||
|
IEnumVARIANT_Release(enum1);
|
||||||
|
|
||||||
IXMLDOMSelection_Release(selection);
|
IXMLDOMSelection_Release(selection);
|
||||||
IXMLDOMNodeList_Release(list);
|
IXMLDOMNodeList_Release(list);
|
||||||
IXMLDOMDocument_Release(doc);
|
IXMLDOMDocument_Release(doc);
|
||||||
|
|
Loading…
Reference in New Issue