Commit aaa8186a authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

msxml3: Add custom handling for DISPID_VALUE for node list.

parent d5e73555
......@@ -329,28 +329,62 @@ static HRESULT xmlnodelist_invoke(IUnknown *iface, DISPID id, LCID lcid, WORD fl
TRACE("(%p)->(%x %x %x %p %p %p)\n", This, id, lcid, flags, params, res, ei);
V_VT(res) = VT_DISPATCH;
V_DISPATCH(res) = NULL;
if (id < DISPID_DOM_COLLECTION_BASE || id > DISPID_DOM_COLLECTION_MAX)
return DISP_E_UNKNOWNNAME;
switch(flags)
if (id >= DISPID_DOM_COLLECTION_BASE && id <= DISPID_DOM_COLLECTION_MAX)
{
case INVOKE_PROPERTYGET:
switch(flags)
{
IXMLDOMNode *disp = NULL;
IXMLDOMNodeList_get_item(&This->IXMLDOMNodeList_iface, id - DISPID_DOM_COLLECTION_BASE, &disp);
V_DISPATCH(res) = (IDispatch*)disp;
break;
case DISPATCH_PROPERTYGET:
{
IXMLDOMNode *disp = NULL;
V_VT(res) = VT_DISPATCH;
IXMLDOMNodeList_get_item(&This->IXMLDOMNodeList_iface, id - DISPID_DOM_COLLECTION_BASE, &disp);
V_DISPATCH(res) = (IDispatch*)disp;
break;
}
default:
{
FIXME("unimplemented flags %x\n", flags);
break;
}
}
default:
}
else if (id == DISPID_VALUE)
{
switch(flags)
{
FIXME("unimplemented flags %x\n", flags);
break;
case DISPATCH_METHOD|DISPATCH_PROPERTYGET:
case DISPATCH_PROPERTYGET:
case DISPATCH_METHOD:
{
IXMLDOMNode *item;
VARIANT index;
HRESULT hr;
if (params->cArgs - params->cNamedArgs != 1) return DISP_E_BADPARAMCOUNT;
VariantInit(&index);
hr = VariantChangeType(&index, params->rgvarg, 0, VT_I4);
if(FAILED(hr))
{
FIXME("failed to convert arg, %s\n", debugstr_variant(params->rgvarg));
return hr;
}
IXMLDOMNodeList_get_item(&This->IXMLDOMNodeList_iface, V_I4(&index), &item);
V_VT(res) = VT_DISPATCH;
V_DISPATCH(res) = (IDispatch*)item;
break;
}
default:
{
FIXME("DISPID_VALUE: unimplemented flags %x\n", flags);
break;
}
}
}
else
return DISP_E_UNKNOWNNAME;
TRACE("ret %p\n", V_DISPATCH(res));
......
......@@ -10005,6 +10005,34 @@ static void test_dispex(void)
V_VT(&arg) = VT_I4;
V_I2(&arg) = 0;
dispparams.cArgs = 0;
dispparams.cNamedArgs = 0;
dispparams.rgdispidNamedArgs = NULL;
dispparams.rgvarg = &arg;
V_VT(&ret) = VT_EMPTY;
V_DISPATCH(&ret) = (void*)0x1;
hr = IDispatchEx_Invoke(dispex, DISPID_VALUE, &IID_NULL, 0, DISPATCH_METHOD, &dispparams, &ret, NULL, NULL);
ok(hr == DISP_E_BADPARAMCOUNT, "got 0x%08x\n", hr);
ok(V_VT(&ret) == VT_EMPTY, "got %d\n", V_VT(&ret));
ok(V_DISPATCH(&ret) == (void*)0x1, "got %p\n", V_DISPATCH(&ret));
V_VT(&arg) = VT_I4;
V_I2(&arg) = 0;
dispparams.cArgs = 2;
dispparams.cNamedArgs = 0;
dispparams.rgdispidNamedArgs = NULL;
dispparams.rgvarg = &arg;
V_VT(&ret) = VT_EMPTY;
V_DISPATCH(&ret) = (void*)0x1;
hr = IDispatchEx_Invoke(dispex, DISPID_VALUE, &IID_NULL, 0, DISPATCH_METHOD, &dispparams, &ret, NULL, NULL);
ok(hr == DISP_E_BADPARAMCOUNT, "got 0x%08x\n", hr);
ok(V_VT(&ret) == VT_EMPTY, "got %d\n", V_VT(&ret));
ok(V_DISPATCH(&ret) == (void*)0x1, "got %p\n", V_DISPATCH(&ret));
V_VT(&arg) = VT_I4;
V_I2(&arg) = 0;
dispparams.cArgs = 1;
dispparams.cNamedArgs = 0;
dispparams.rgdispidNamedArgs = NULL;
......@@ -10013,7 +10041,6 @@ static void test_dispex(void)
V_VT(&ret) = VT_EMPTY;
V_DISPATCH(&ret) = (void*)0x1;
hr = IDispatchEx_Invoke(dispex, DISPID_VALUE, &IID_NULL, 0, DISPATCH_METHOD, &dispparams, &ret, NULL, NULL);
todo_wine
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(V_VT(&ret) == VT_DISPATCH, "got %d\n", V_VT(&ret));
ok(V_DISPATCH(&ret) == NULL, "got %p\n", V_DISPATCH(&ret));
......@@ -10025,6 +10052,13 @@ todo_wine
ok(V_VT(&ret) == VT_DISPATCH, "got %d\n", V_VT(&ret));
ok(V_DISPATCH(&ret) == NULL, "got %p\n", V_DISPATCH(&ret));
V_VT(&ret) = VT_EMPTY;
V_DISPATCH(&ret) = (void*)0x1;
hr = IDispatchEx_Invoke(dispex, DISPID_VALUE, &IID_NULL, 0, DISPATCH_PROPERTYGET|DISPATCH_METHOD, &dispparams, &ret, NULL, NULL);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(V_VT(&ret) == VT_DISPATCH, "got %d\n", V_VT(&ret));
ok(V_DISPATCH(&ret) == NULL, "got %p\n", V_DISPATCH(&ret));
dispparams.cArgs = 0;
dispparams.cNamedArgs = 0;
dispparams.rgdispidNamedArgs = NULL;
......@@ -10046,10 +10080,9 @@ todo_wine
V_I4(&ret) = 1;
hr = IDispatchEx_Invoke(dispex, DISPID_DOM_NODELIST_LENGTH, &IID_NULL, 0, DISPATCH_METHOD, &dispparams, &ret, NULL, NULL);
ok(hr == DISP_E_MEMBERNOTFOUND, "got 0x%08x\n", hr);
todo_wine {
ok(V_VT(&ret) == VT_EMPTY, "got %d\n", V_VT(&ret));
ok(V_I4(&ret) == 1, "got %d\n", V_I4(&ret));
}
IXMLDOMNodeList_Release(node_list);
/* IXMLDOMParseError */
......
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