wscript: Added support for calling object by DISPID_VALUE in do_icall.

This commit is contained in:
Jacek Caban 2014-07-21 18:07:40 +02:00 committed by Alexandre Julliard
parent 15dfae71a1
commit e73bd253ea
2 changed files with 42 additions and 1 deletions

View File

@ -561,7 +561,7 @@ static HRESULT do_icall(exec_ctx_t *ctx, VARIANT *res)
v = V_VT(ref.u.v) == (VT_VARIANT|VT_BYREF) ? V_VARIANTREF(ref.u.v) : ref.u.v;
if(arg_cnt) {
SAFEARRAY *array;
SAFEARRAY *array = NULL;
switch(V_VT(v)) {
case VT_ARRAY|VT_BYREF|VT_VARIANT:
@ -570,11 +570,20 @@ static HRESULT do_icall(exec_ctx_t *ctx, VARIANT *res)
case VT_ARRAY|VT_VARIANT:
array = V_ARRAY(ref.u.v);
break;
case VT_DISPATCH:
vbstack_to_dp(ctx, arg_cnt, FALSE, &dp);
hres = disp_call(ctx->script, V_DISPATCH(v), DISPID_VALUE, &dp, res);
if(FAILED(hres))
return hres;
break;
default:
FIXME("arguments not implemented\n");
return E_NOTIMPL;
}
if(!array)
break;
vbstack_to_dp(ctx, arg_cnt, FALSE, &dp);
hres = array_access(ctx, array, &dp, &v);
if(FAILED(hres))

View File

@ -87,6 +87,7 @@ DEFINE_EXPECT(testobj_propget_d);
DEFINE_EXPECT(testobj_propget_i);
DEFINE_EXPECT(testobj_propput_d);
DEFINE_EXPECT(testobj_propput_i);
DEFINE_EXPECT(testobj_value_i);
DEFINE_EXPECT(global_propargput_d);
DEFINE_EXPECT(global_propargput_i);
DEFINE_EXPECT(global_propargput1_d);
@ -718,6 +719,29 @@ static HRESULT WINAPI testObj_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid,
VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
{
switch(id) {
case DISPID_VALUE: {
VARIANT *arg;
int i;
CHECK_EXPECT(testobj_value_i);
ok(wFlags == (DISPATCH_PROPERTYGET|DISPATCH_METHOD), "wFlags = %x\n", wFlags);
ok(pdp != NULL, "pdp == NULL\n");
ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n");
ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs);
ok(pvarRes != NULL, "pvarRes == NULL\n");
ok(pei != NULL, "pei == NULL\n");
for(i=0; i<pdp->cArgs; i++) {
arg = pdp->rgvarg+pdp->cArgs-i-1;
ok(V_VT(arg) == VT_I2, "V_VT(arg) = %d\n", V_VT(arg));
ok(V_I2(arg) == i+1, "V_I2(arg) = %d\n", V_I2(arg));
}
V_VT(pvarRes) = VT_I2;
V_I2(pvarRes) = pdp->cArgs;
return S_OK;
}
case DISPID_TESTOBJ_PROPGET:
CHECK_EXPECT(testobj_propget_i);
@ -2053,6 +2077,14 @@ static void run_tests(void)
strict_dispid_check = FALSE;
SET_EXPECT(testobj_value_i);
parse_script_a("dim n,o\n set o = testObj\n n = o(1,2)\n call ok(n=2, \"n = \" & n)\n");
CHECK_CALLED(testobj_value_i);
SET_EXPECT(testobj_value_i);
parse_script_a("dim n,o\n set o = testObj\n n = o\n call ok(n=0, \"n = \" & n)\n");
CHECK_CALLED(testobj_value_i);
parse_script_a("Sub testsub\n"
"x = 1\n"
"Call ok(x = 1, \"x = \" & x)\n"