vbscript: Support DISP_E_EXCEPTION Invoke[Ex] return value.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2019-10-31 19:16:29 +01:00 committed by Alexandre Julliard
parent 9115c37b46
commit fa0c84ae0b
3 changed files with 41 additions and 5 deletions

View File

@ -457,4 +457,20 @@ end sub
call testVBErrorCodes call testVBErrorCodes
on error resume next
throwWithDesc
ok err.number = &hdeadbeef&, "err.number = " & hex(err.number)
ok err.description = "test", "err.description = " & err.description
ok err.helpcontext = 10, "err.helpcontext = " & err.helpcontext
ok err.helpfile = "test.chm", "err.helpfile = " & err.helpfile
throwWithDesc = 1
ok err.number = &hdeadbeef&, "err.number = " & hex(err.number)
ok err.description = "test", "err.description = " & err.description
ok err.helpcontext = 10, "err.helpcontext = " & err.helpcontext
ok err.helpfile = "test.chm", "err.helpfile = " & err.helpfile
on error goto 0
call reportSuccess() call reportSuccess()

View File

@ -139,6 +139,7 @@ DEFINE_EXPECT(OnLeaveScript);
#define DISPID_GLOBAL_WEEKSTARTDAY 1021 #define DISPID_GLOBAL_WEEKSTARTDAY 1021
#define DISPID_GLOBAL_GLOBALCALLBACK 1022 #define DISPID_GLOBAL_GLOBALCALLBACK 1022
#define DISPID_GLOBAL_TESTERROROBJECT 1023 #define DISPID_GLOBAL_TESTERROROBJECT 1023
#define DISPID_GLOBAL_THROWWITHDESC 1024
#define DISPID_TESTOBJ_PROPGET 2000 #define DISPID_TESTOBJ_PROPGET 2000
#define DISPID_TESTOBJ_PROPPUT 2001 #define DISPID_TESTOBJ_PROPPUT 2001
@ -1105,7 +1106,8 @@ static HRESULT WINAPI Global_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD
{ L"testArray", DISPID_GLOBAL_TESTARRAY }, { L"testArray", DISPID_GLOBAL_TESTARRAY },
{ L"throwInt", DISPID_GLOBAL_THROWINT }, { L"throwInt", DISPID_GLOBAL_THROWINT },
{ L"testOptionalArg", DISPID_GLOBAL_TESTOPTIONALARG }, { L"testOptionalArg", DISPID_GLOBAL_TESTOPTIONALARG },
{ L"testErrorObject", DISPID_GLOBAL_TESTERROROBJECT } { L"testErrorObject", DISPID_GLOBAL_TESTERROROBJECT },
{ L"throwWithDesc", DISPID_GLOBAL_THROWWITHDESC }
}; };
test_grfdex(grfdex, fdexNameCaseInsensitive); test_grfdex(grfdex, fdexNameCaseInsensitive);
@ -1463,6 +1465,13 @@ static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid,
} }
return hres; return hres;
case DISPID_GLOBAL_THROWWITHDESC:
pei->scode = 0xdeadbeef;
pei->bstrDescription = SysAllocString(L"test");
pei->bstrHelpFile = SysAllocString(L"test.chm");
pei->dwHelpContext = 10;
return DISP_E_EXCEPTION;
} }
case DISPID_GLOBAL_TESTOPTIONALARG: { case DISPID_GLOBAL_TESTOPTIONALARG: {

View File

@ -952,15 +952,21 @@ HRESULT disp_call(script_ctx_t *ctx, IDispatch *disp, DISPID id, DISPPARAMS *dp,
return invoke_vbdisp(vbdisp, id, flags, FALSE, dp, retv); return invoke_vbdisp(vbdisp, id, flags, FALSE, dp, retv);
hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex); hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex);
if(FAILED(hres)) { if(SUCCEEDED(hres)) {
hres = IDispatchEx_InvokeEx(dispex, id, ctx->lcid, flags, dp, retv, &ei, NULL /* CALLER_FIXME */);
IDispatchEx_Release(dispex);
}else {
UINT err = 0; UINT err = 0;
TRACE("using IDispatch\n"); TRACE("using IDispatch\n");
return IDispatch_Invoke(disp, id, &IID_NULL, ctx->lcid, flags, dp, retv, &ei, &err); hres = IDispatch_Invoke(disp, id, &IID_NULL, ctx->lcid, flags, dp, retv, &ei, &err);
} }
hres = IDispatchEx_InvokeEx(dispex, id, ctx->lcid, flags, dp, retv, &ei, NULL /* CALLER_FIXME */); if(hres == DISP_E_EXCEPTION) {
IDispatchEx_Release(dispex); clear_ei(&ctx->ei);
ctx->ei = ei;
hres = SCRIPT_E_RECORDED;
}
return hres; return hres;
} }
@ -994,5 +1000,10 @@ HRESULT disp_propput(script_ctx_t *ctx, IDispatch *disp, DISPID id, WORD flags,
hres = IDispatch_Invoke(disp, id, &IID_NULL, ctx->lcid, flags, dp, NULL, &ei, &err); hres = IDispatch_Invoke(disp, id, &IID_NULL, ctx->lcid, flags, dp, NULL, &ei, &err);
} }
if(hres == DISP_E_EXCEPTION) {
clear_ei(&ctx->ei);
ctx->ei = ei;
hres = SCRIPT_E_RECORDED;
}
return hres; return hres;
} }