From 5cf20ceffd2a2906b6b1c8b06d276e8436d746b7 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Wed, 19 Mar 2014 13:15:14 +0100 Subject: [PATCH] jscript: Represent NULL VT_UNKNOWN VARIANT as NULL VT_DISPATCH. --- dlls/jscript/jsutils.c | 3 +++ dlls/jscript/tests/run.c | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/dlls/jscript/jsutils.c b/dlls/jscript/jsutils.c index 87bad26fe95..a324c963068 100644 --- a/dlls/jscript/jsutils.c +++ b/dlls/jscript/jsutils.c @@ -327,6 +327,9 @@ HRESULT variant_to_jsval(VARIANT *var, jsval_t *r) *r = jsval_disp(disp); return S_OK; } + }else { + *r = jsval_disp(NULL); + return S_OK; } /* fall through */ default: diff --git a/dlls/jscript/tests/run.c b/dlls/jscript/tests/run.c index 0db3660f0b5..a92282a0d6b 100644 --- a/dlls/jscript/tests/run.c +++ b/dlls/jscript/tests/run.c @@ -1156,7 +1156,7 @@ static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, return S_OK; case DISPID_GLOBAL_TESTARGTYPES: { - VARIANT args[3]; + VARIANT args[4]; DISPPARAMS dp = {args, NULL, sizeof(args)/sizeof(*args), 0}; HRESULT hres; @@ -1190,6 +1190,8 @@ static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, V_INT(args+1) = 22; V_VT(args+2) = VT_UNKNOWN; V_UNKNOWN(args+2) = (IUnknown*)&testObj; + V_VT(args+3) = VT_UNKNOWN; + V_UNKNOWN(args+3) = NULL; 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); @@ -2140,10 +2142,12 @@ 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(d,i,s) {" + parse_script_a("testArgTypes(dispUnk, intProp(), intProp, getShort(), shortProp, function(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');" "});"); CHECK_CALLED(global_testargtypes_i);