diff --git a/dlls/scrobj/scrobj.c b/dlls/scrobj/scrobj.c index b0a8dc7d559..e9262c53dce 100644 --- a/dlls/scrobj/scrobj.c +++ b/dlls/scrobj/scrobj.c @@ -1072,7 +1072,61 @@ static HRESULT WINAPI scriptlet_InvokeEx(IDispatchEx *iface, DISPID id, LCID lci VARIANT *res, EXCEPINFO *pei, IServiceProvider *caller) { struct scriptlet_instance *This = impl_from_IDispatchEx(iface); - FIXME("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, flags, pdp, res, pei, caller); + struct object_member *member; + + TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, flags, pdp, res, pei, caller); + + if (id < 1 || id > This->member_cnt) + { + WARN("Unknown id %xu\n", id); + return DISP_E_MEMBERNOTFOUND; + } + member = &This->members[id - 1]; + + switch (member->type) + { + case MEMBER_METHOD: + if ((flags & ~DISPATCH_PROPERTYGET) != DISPATCH_METHOD) + { + FIXME("unsupported method flags %x\n", flags); + return DISP_E_MEMBERNOTFOUND; + } + return IDispatchEx_InvokeEx(member->u.method.host->script_dispatch, member->u.method.id, lcid, + DISPATCH_METHOD, pdp, res, pei, caller); + case MEMBER_PROPERTY: + if (flags & DISPATCH_PROPERTYGET) + { + if (!member->u.property.get.host) + { + FIXME("No %s getter\n", debugstr_w(member->name)); + return DISP_E_MEMBERNOTFOUND; + } + return IDispatchEx_InvokeEx(member->u.property.get.host->script_dispatch, member->u.property.get.id, lcid, + DISPATCH_METHOD, pdp, res, pei, caller); + } + if (flags & DISPATCH_PROPERTYPUT) + { + DISPPARAMS dp; + + if (!member->u.property.put.host) + { + FIXME("No %s setter\n", debugstr_w(member->name)); + return DISP_E_MEMBERNOTFOUND; + } + if (pdp->cNamedArgs != 1 || pdp->rgdispidNamedArgs[0] != DISPID_PROPERTYPUT) + { + FIXME("no propput argument\n"); + return E_FAIL; + } + dp = *pdp; + dp.cNamedArgs = 0; + return IDispatchEx_InvokeEx(member->u.property.put.host->script_dispatch, member->u.property.put.id, lcid, + DISPATCH_METHOD, &dp, res, pei, caller); + } + + FIXME("unsupported flags %x\n", flags); + } + return DISP_E_MEMBERNOTFOUND; } diff --git a/dlls/scrobj/tests/scrobj.c b/dlls/scrobj/tests/scrobj.c index d61815ef655..023aa30f92d 100644 --- a/dlls/scrobj/tests/scrobj.c +++ b/dlls/scrobj/tests/scrobj.c @@ -890,11 +890,8 @@ static void test_create_object(void) dp.cArgs = 1; dp.rgvarg = &v; hres = IDispatchEx_InvokeEx(dispex, vb_add_one_id, 0, DISPATCH_PROPERTYGET|DISPATCH_METHOD, &dp, &r, &ei, NULL); - todo_wine ok(hres == S_OK, "InvokeEx failed: %08x\n", hres); - todo_wine ok(V_VT(&r) == VT_I4, "V_VT(r) = %d\n", V_VT(&r)); - todo_wine ok(V_I4(&r) == 3, "V_I4(r) = %d\n", V_I4(&r)); memset(&ei, 0, sizeof(ei)); @@ -905,11 +902,8 @@ static void test_create_object(void) dp.cArgs = 1; dp.rgvarg = &v; hres = IDispatchEx_InvokeEx(dispex, js_add_two_id, 0, DISPATCH_PROPERTYGET|DISPATCH_METHOD, &dp, &r, &ei, NULL); - todo_wine ok(hres == S_OK, "InvokeEx failed: %08x\n", hres); - todo_wine ok(V_VT(&r) == VT_I4, "V_VT(r) = %d\n", V_VT(&r)); - todo_wine ok(V_I4(&r) == 6, "V_I4(r) = %d\n", V_I4(&r)); memset(&ei, 0, sizeof(ei)); @@ -921,13 +915,9 @@ static void test_create_object(void) dp.rgvarg = &v; SET_EXPECT(InvokeEx); hres = IDispatchEx_InvokeEx(dispex, wt_test_id, 0x100, DISPATCH_PROPERTYGET|DISPATCH_METHOD, &dp, &r, &ei, (void*)0xdeadbeef); - todo_wine ok(hres == S_OK, "InvokeEx failed: %08x\n", hres); - todo_wine CHECK_CALLED(InvokeEx); - todo_wine ok(V_VT(&r) == VT_BOOL, "V_VT(r) = %d\n", V_VT(&r)); - todo_wine ok(V_BOOL(&r) == VARIANT_TRUE, "V_I4(r) = %d\n", V_I4(&r)); memset(&ei, 0, sizeof(ei)); @@ -935,13 +925,9 @@ static void test_create_object(void) V_VT(&r) = VT_ERROR; SET_EXPECT(InvokeEx); hres = IDispatchEx_InvokeEx(dispex, wt_test_id, 0x100, DISPATCH_METHOD, &dp, &r, &ei, (void*)0xdeadbeef); - todo_wine ok(hres == S_OK, "InvokeEx failed: %08x\n", hres); - todo_wine CHECK_CALLED(InvokeEx); - todo_wine ok(V_VT(&r) == VT_BOOL, "V_VT(r) = %d\n", V_VT(&r)); - todo_wine ok(V_BOOL(&r) == VARIANT_TRUE, "V_I4(r) = %d\n", V_I4(&r)); memset(&ei, 0, sizeof(ei)); @@ -953,13 +939,9 @@ static void test_create_object(void) dp.rgvarg = &v; SET_EXPECT(InvokeEx_get_gsProp); hres = IDispatchEx_InvokeEx(dispex, wt_gsprop_id, 0, DISPATCH_PROPERTYGET|DISPATCH_METHOD, &dp, &r, &ei, NULL); - todo_wine ok(hres == S_OK, "InvokeEx failed: %08x\n", hres); - todo_wine CHECK_CALLED(InvokeEx_get_gsProp); - todo_wine ok(V_VT(&r) == VT_BOOL, "V_VT(r) = %d\n", V_VT(&r)); - todo_wine ok(V_BOOL(&r) == VARIANT_TRUE, "V_I4(r) = %d\n", V_I4(&r)); memset(&ei, 0, sizeof(ei)); @@ -973,13 +955,9 @@ static void test_create_object(void) dp.cNamedArgs = 1; SET_EXPECT(InvokeEx_put_gsProp); hres = IDispatchEx_InvokeEx(dispex, wt_gsprop_id, 0, DISPATCH_PROPERTYPUT, &dp, &r, &ei, NULL); - todo_wine ok(hres == S_OK, "InvokeEx failed: %08x\n", hres); - todo_wine CHECK_CALLED(InvokeEx_put_gsProp); - todo_wine ok(V_VT(&r) == VT_BOOL, "V_VT(r) = %d\n", V_VT(&r)); - todo_wine ok(V_BOOL(&r) == VARIANT_FALSE, "V_I4(r) = %d\n", V_I4(&r)); hres = IDispatchEx_InvokeEx(dispex, wt_test_id, 0x100, DISPATCH_PROPERTYGET, &dp, &r, &ei, (void*)0xdeadbeef);