Commit 8277c248 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

vbscript: Store entire EXCEPINFO in script context.

parent 925e56ac
......@@ -2477,7 +2477,7 @@ static HRESULT Err_Number(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARI
return E_NOTIMPL;
}
hres = This->desc->ctx->err_number;
hres = This->desc->ctx->ei.scode;
return return_int(res, HRESULT_FACILITY(hres) == FACILITY_VBS ? HRESULT_CODE(hres) : hres);
}
......@@ -2494,7 +2494,7 @@ static HRESULT Err_Clear(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIA
if(!This->desc)
return E_UNEXPECTED;
This->desc->ctx->err_number = S_OK;
clear_ei(&This->desc->ctx->ei);
return S_OK;
}
......
......@@ -247,6 +247,14 @@ static HRESULT add_dynamic_var(exec_ctx_t *ctx, const WCHAR *name,
return S_OK;
}
void clear_ei(EXCEPINFO *ei)
{
SysFreeString(ei->bstrSource);
SysFreeString(ei->bstrDescription);
SysFreeString(ei->bstrHelpFile);
memset(ei, 0, sizeof(*ei));
}
static inline VARIANT *stack_pop(exec_ctx_t *ctx)
{
assert(ctx->top);
......@@ -1321,7 +1329,7 @@ static HRESULT interp_errmode(exec_ctx_t *ctx)
TRACE("%d\n", err_mode);
ctx->resume_next = err_mode;
ctx->script->err_number = S_OK;
clear_ei(&ctx->script->ei);
return S_OK;
}
......@@ -2158,7 +2166,7 @@ HRESULT exec_script(script_ctx_t *ctx, function_t *func, vbdisp_t *vbthis, DISPP
op = exec.instr->op;
hres = op_funcs[op](&exec);
if(FAILED(hres)) {
ctx->err_number = hres = map_hres(hres);
ctx->ei.scode = hres = map_hres(hres);
if(exec.resume_next) {
unsigned stack_off;
......
......@@ -153,6 +153,7 @@ static void release_script(script_ctx_t *ctx)
class_desc_t *class_desc;
collect_objects(ctx);
clear_ei(&ctx->ei);
release_dynamic_vars(ctx->global_vars);
ctx->global_vars = NULL;
......
......@@ -192,7 +192,7 @@ struct _script_ctx_t {
class_desc_t err_desc;
vbdisp_t *err_obj;
HRESULT err_number;
EXCEPINFO ei;
dynamic_var_t *global_vars;
function_t *global_funcs;
......@@ -358,6 +358,7 @@ HRESULT compile_script(script_ctx_t*,const WCHAR*,const WCHAR*,DWORD,vbscode_t**
HRESULT exec_script(script_ctx_t*,function_t*,vbdisp_t*,DISPPARAMS*,VARIANT*) DECLSPEC_HIDDEN;
void release_dynamic_vars(dynamic_var_t*) DECLSPEC_HIDDEN;
IDispatch *lookup_named_item(script_ctx_t*,const WCHAR*,unsigned) DECLSPEC_HIDDEN;
void clear_ei(EXCEPINFO*) DECLSPEC_HIDDEN;
typedef struct {
UINT16 len;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment