msxml3: Add custom handling for DISPID_VALUE for node list.

This commit is contained in:
Nikolay Sivov 2012-12-17 10:16:41 +04:00 committed by Alexandre Julliard
parent d5e735554b
commit aaa8186a2e
2 changed files with 87 additions and 20 deletions

View File

@ -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;
case DISPATCH_PROPERTYGET:
{
IXMLDOMNode *disp = NULL;
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;
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;
}
}
}
else if (id == DISPID_VALUE)
{
switch(flags)
{
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));

View File

@ -10003,6 +10003,34 @@ static void test_dispex(void)
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(did == DISPID_VALUE, "got %d\n", did);
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;
@ -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 */