From a1543a3f7b0eafe67ff52e72a6d4c367c57d8944 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Fri, 6 Feb 2015 12:10:00 +0100 Subject: [PATCH] jscript: Fixed handling VT_VARIANT|VY_BYREF types. --- dlls/jscript/jsutils.c | 3 +++ dlls/jscript/tests/run.c | 12 +++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/dlls/jscript/jsutils.c b/dlls/jscript/jsutils.c index 20e659c5135..85f573fd44b 100644 --- a/dlls/jscript/jsutils.c +++ b/dlls/jscript/jsutils.c @@ -246,6 +246,9 @@ HRESULT jsval_copy(jsval_t v, jsval_t *r) HRESULT variant_to_jsval(VARIANT *var, jsval_t *r) { + if(V_VT(var) == (VT_VARIANT|VT_BYREF)) + var = V_VARIANTREF(var); + switch(V_VT(var)) { case VT_EMPTY: *r = jsval_undefined(); diff --git a/dlls/jscript/tests/run.c b/dlls/jscript/tests/run.c index 2044789a04a..97799db5c35 100644 --- a/dlls/jscript/tests/run.c +++ b/dlls/jscript/tests/run.c @@ -1211,7 +1211,7 @@ static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, return S_OK; case DISPID_GLOBAL_TESTARGTYPES: { - VARIANT args[5]; + VARIANT args[6], v; DISPPARAMS dp = {args, NULL, sizeof(args)/sizeof(*args), 0}; HRESULT hres; @@ -1249,6 +1249,10 @@ static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, V_UNKNOWN(args+3) = NULL; V_VT(args+4) = VT_UI4; V_UI4(args+4) = 0xffffffff; + V_VT(args+5) = VT_BYREF|VT_VARIANT; + V_VARIANTREF(args+5) = &v; + V_VT(&v) = VT_I4; + V_I4(&v) = 2; hres = IDispatch_Invoke(V_DISPATCH(pdp->rgvarg), DISPID_VALUE, &IID_NULL, 0, DISPATCH_METHOD, &dp, NULL, NULL, NULL); ok(hres == S_OK, "Invoke failed: %08x\n", hres); @@ -2412,14 +2416,16 @@ static BOOL run_tests(void) CHECK_CALLED(global_propargput_i); SET_EXPECT(global_testargtypes_i); - parse_script_a("testArgTypes(dispUnk, intProp(), intProp, getShort(), shortProp, function(ui4,nullunk,d,i,s) {" + parse_script_a("testArgTypes(dispUnk, intProp(), intProp, getShort(), shortProp, function(i4ref,ui4,nullunk,d,i,s) {" " ok(getVT(i) === 'VT_I4', 'getVT(i) = ' + getVT(i));" " ok(getVT(s) === 'VT_I4', 'getVT(s) = ' + getVT(s));" " ok(getVT(d) === 'VT_DISPATCH', 'getVT(d) = ' + getVT(d));" " ok(getVT(nullunk) === 'VT_DISPATCH', 'getVT(nullunk) = ' + getVT(nullunk));" " ok(nullunk === null, 'nullunk !== null');" - " ok(getVT(ui4) === 'VT_R8', 'getVT(s) = ' + getVT(s));" + " ok(getVT(ui4) === 'VT_R8', 'getVT(ui4) = ' + getVT(ui4));" " ok(ui4 > 0, 'ui4 = ' + ui4);" + " ok(getVT(i4ref) === 'VT_I4', 'getVT(i4ref) = ' + getVT(i4ref));" + " ok(i4ref === 2, 'i4ref = ' + i4ref);" "});"); CHECK_CALLED(global_testargtypes_i);