Module: wine Branch: master Commit: db94448d9785ac5b4425981fa3a043f79e64ee34 URL: https://gitlab.winehq.org/wine/wine/-/commit/db94448d9785ac5b4425981fa3a043f...
Author: Kevin Puetz PuetzKevinA@JohnDeere.com Date: Fri Sep 23 19:38:34 2022 +0000
vbscript: Only set EXCEPINFO strings for cases that map_hres translated.
Add test for E_UNEXPECTED.
---
dlls/vbscript/interp.c | 11 +++++++---- dlls/vbscript/tests/run.c | 26 ++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 4 deletions(-)
diff --git a/dlls/vbscript/interp.c b/dlls/vbscript/interp.c index 1d7482b5013..fae2c0fccbb 100644 --- a/dlls/vbscript/interp.c +++ b/dlls/vbscript/interp.c @@ -2498,10 +2498,13 @@ HRESULT exec_script(script_ctx_t *ctx, BOOL extern_caller, function_t *func, vbd }
ctx->ei.scode = hres; - if(!ctx->ei.bstrSource) - ctx->ei.bstrSource = get_vbscript_string(VBS_RUNTIME_ERROR); - if(!ctx->ei.bstrDescription) - ctx->ei.bstrDescription = get_vbscript_error_string(hres); + if(HRESULT_FACILITY(hres) == FACILITY_VBS) + { + if(!ctx->ei.bstrSource) + ctx->ei.bstrSource = get_vbscript_string(VBS_RUNTIME_ERROR); + if(!ctx->ei.bstrDescription) + ctx->ei.bstrDescription = get_vbscript_error_string(hres); + }
if(exec.resume_next) { unsigned stack_off; diff --git a/dlls/vbscript/tests/run.c b/dlls/vbscript/tests/run.c index 8d7c15ba70b..ef26641d01d 100644 --- a/dlls/vbscript/tests/run.c +++ b/dlls/vbscript/tests/run.c @@ -2477,6 +2477,32 @@ static void test_callbacks(void) free_ei(&ei);
IActiveScriptError_Release(error1); + + store_script_error = &error1; + SET_EXPECT(OnScriptError); + hres = parse_script_ar("throwException &h8000FFFF&"); + ok(hres == E_UNEXPECTED, "got error: %08lx\n", hres); + CHECK_CALLED(OnScriptError); + + memset(&ei, 0xcc, sizeof(ei)); + hres = IActiveScriptError_GetExceptionInfo(error1, &ei); + ok(hres == S_OK, "GetExceptionInfo returned %08lx\n", hres); + ok(!ei.wCode, "wCode = %x\n", ei.wCode); + ok(!ei.wReserved, "wReserved = %x\n", ei.wReserved); + if(is_english) { + ok(!ei.bstrSource, + "bstrSource = %s\n", wine_dbgstr_w(ei.bstrSource)); + ok(!ei.bstrDescription, + "bstrDescription = %s\n", wine_dbgstr_w(ei.bstrDescription)); + } + ok(!ei.bstrHelpFile, "bstrHelpFile = %s\n", wine_dbgstr_w(ei.bstrHelpFile)); + ok(!ei.dwHelpContext, "dwHelpContext = %lx\n", ei.dwHelpContext); + ok(!ei.pvReserved, "pvReserved = %p\n", ei.pvReserved); + ok(!ei.pfnDeferredFillIn, "pfnDeferredFillIn = %p\n", ei.pfnDeferredFillIn); + ok(ei.scode == E_UNEXPECTED, "scode = %lx\n", ei.scode); + free_ei(&ei); + + IActiveScriptError_Release(error1); }
static void test_gc(void)