[PATCH 0/1] MR899: vbscript-disp_call-map_hres
Map known HRESULT values into their FACILITY_VBS counterparts Unless the callee provided its own Description (e.g. via SetErrorInfo) VBscript maps certain well-known HRESULT values into its own error facility and messages, changing Err.Number and also setting Err.Source to itself (unless already provided, in which case it is left alone) e.g. if the invoked method returns E_NOINTERFACE, The VBScript Err object should show Err.Number: 0x1AE Err.Source: Microsoft VBScript runtime error Err.Description: Class doesn't support Automation Rather than the original HRESULT Err.Number: 0x80004002 -- https://gitlab.winehq.org/wine/wine/-/merge_requests/899
From: Kevin Puetz <PuetzKevinA(a)JohnDeere.com> Map known HRESULT values into their FACILITY_VBS counterparts Unless the callee provided its own Description (e.g. via SetErrorInfo) VBscript maps certain well-known HRESULT values into its own error facility and messages, changing Err.Number and also setting Err.Source to itself (unless already provided, in which case it is left alone) e.g. if the invoked method returns E_NOINTERFACE, The VBScript Err object should show Err.Number: 0x1AE Err.Source: Microsoft VBScript runtime error Err.Description: Class doesn't support Automation Rather than the original HRESULT Err.Number: 0x80004002 --- dlls/vbscript/vbdisp.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dlls/vbscript/vbdisp.c b/dlls/vbscript/vbdisp.c index 1c6f68255bd..ae4f3aaf783 100644 --- a/dlls/vbscript/vbdisp.c +++ b/dlls/vbscript/vbdisp.c @@ -1654,6 +1654,15 @@ HRESULT disp_call(script_ctx_t *ctx, IDispatch *disp, DISPID id, DISPPARAMS *dp, if(hres == DISP_E_EXCEPTION) { clear_ei(&ctx->ei); ctx->ei = ei; + if(!ctx->ei.bstrDescription) { + ctx->ei.scode = hres = map_hres(ei.scode); + if(HRESULT_FACILITY(hres) == FACILITY_VBS) { + ctx->ei.bstrDescription = get_vbscript_error_string(hres); + if(!ctx->ei.bstrSource) { + ctx->ei.bstrSource = get_vbscript_string(VBS_RUNTIME_ERROR); + } + } + } hres = SCRIPT_E_RECORDED; } return hres; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/899
participants (2)
-
Kevin Puetz -
Kevin Puetz (@puetzk)