Jacek Caban : vbscript: Move OnEnterScript/OnLeaveScript calls to exec_script.
Alexandre Julliard
julliard at winehq.org
Fri Oct 4 16:34:05 CDT 2019
Module: wine
Branch: master
Commit: e050ff5eb80592774adc56681a16cccf149e3959
URL: https://source.winehq.org/git/wine.git/?a=commit;h=e050ff5eb80592774adc56681a16cccf149e3959
Author: Jacek Caban <jacek at codeweavers.com>
Date: Fri Oct 4 16:30:20 2019 +0200
vbscript: Move OnEnterScript/OnLeaveScript calls to exec_script.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/vbscript/interp.c | 10 ++++++++--
dlls/vbscript/vbdisp.c | 23 +++++++----------------
dlls/vbscript/vbscript.c | 9 +--------
dlls/vbscript/vbscript.h | 2 +-
4 files changed, 17 insertions(+), 27 deletions(-)
diff --git a/dlls/vbscript/interp.c b/dlls/vbscript/interp.c
index 0fb628c59a..82a9f79e8d 100644
--- a/dlls/vbscript/interp.c
+++ b/dlls/vbscript/interp.c
@@ -588,7 +588,7 @@ static HRESULT do_icall(exec_ctx_t *ctx, VARIANT *res)
break;
case REF_FUNC:
vbstack_to_dp(ctx, arg_cnt, FALSE, &dp);
- hres = exec_script(ctx->script, ref.u.f, NULL, &dp, res);
+ hres = exec_script(ctx->script, FALSE, ref.u.f, NULL, &dp, res);
if(FAILED(hres))
return hres;
break;
@@ -2086,7 +2086,7 @@ static void release_exec(exec_ctx_t *ctx)
heap_free(ctx->stack);
}
-HRESULT exec_script(script_ctx_t *ctx, function_t *func, vbdisp_t *vbthis, DISPPARAMS *dp, VARIANT *res)
+HRESULT exec_script(script_ctx_t *ctx, BOOL extern_caller, function_t *func, vbdisp_t *vbthis, DISPPARAMS *dp, VARIANT *res)
{
exec_ctx_t exec = {func->code_ctx};
vbsop_t op;
@@ -2148,6 +2148,9 @@ HRESULT exec_script(script_ctx_t *ctx, function_t *func, vbdisp_t *vbthis, DISPP
return E_OUTOFMEMORY;
}
+ if(extern_caller)
+ IActiveScriptSite_OnEnterScript(ctx->site);
+
if(vbthis) {
exec.this_obj = (IDispatch*)&vbthis->IDispatchEx_iface;
exec.vbthis = vbthis;
@@ -2220,6 +2223,9 @@ HRESULT exec_script(script_ctx_t *ctx, function_t *func, vbdisp_t *vbthis, DISPP
assert(!exec.top);
+ if(extern_caller)
+ IActiveScriptSite_OnLeaveScript(ctx->site);
+
if(SUCCEEDED(hres) && res) {
*res = exec.ret_val;
V_VT(&exec.ret_val) = VT_EMPTY;
diff --git a/dlls/vbscript/vbdisp.c b/dlls/vbscript/vbdisp.c
index 0f6209f43e..fb646e7187 100644
--- a/dlls/vbscript/vbdisp.c
+++ b/dlls/vbscript/vbdisp.c
@@ -260,7 +260,7 @@ static BOOL run_terminator(vbdisp_t *This)
return TRUE;
This->ref++;
- exec_script(This->desc->ctx, This->desc->funcs[This->desc->class_terminate_id].entries[VBDISP_CALLGET],
+ exec_script(This->desc->ctx, FALSE, This->desc->funcs[This->desc->class_terminate_id].entries[VBDISP_CALLGET],
This, &dp, NULL);
return !--This->ref;
}
@@ -426,7 +426,7 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc
return DISP_E_MEMBERNOTFOUND;
}
- return exec_script(This->desc->ctx, func, This, pdp, pvarRes);
+ return exec_script(This->desc->ctx, FALSE, func, This, pdp, pvarRes);
case DISPATCH_METHOD:
case DISPATCH_METHOD|DISPATCH_PROPERTYGET:
@@ -436,7 +436,7 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc
return DISP_E_MEMBERNOTFOUND;
}
- return exec_script(This->desc->ctx, func, This, pdp, pvarRes);
+ return exec_script(This->desc->ctx, FALSE, func, This, pdp, pvarRes);
case DISPATCH_PROPERTYPUT:
case DISPATCH_PROPERTYPUTREF:
case DISPATCH_PROPERTYPUT|DISPATCH_PROPERTYPUTREF: {
@@ -461,7 +461,7 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc
return DISP_E_MEMBERNOTFOUND;
}
- hres = exec_script(This->desc->ctx, func, This, &dp, NULL);
+ hres = exec_script(This->desc->ctx, FALSE, func, This, &dp, NULL);
if(needs_release)
VariantClear(&put_val);
return hres;
@@ -605,7 +605,7 @@ HRESULT create_vbdisp(const class_desc_t *desc, vbdisp_t **ret)
if(SUCCEEDED(hres) && desc->class_initialize_id) {
DISPPARAMS dp = {0};
- hres = exec_script(desc->ctx, desc->funcs[desc->class_initialize_id].entries[VBDISP_CALLGET],
+ hres = exec_script(desc->ctx, FALSE, desc->funcs[desc->class_initialize_id].entries[VBDISP_CALLGET],
vbdisp, &dp, NULL);
}
@@ -621,15 +621,8 @@ HRESULT create_vbdisp(const class_desc_t *desc, vbdisp_t **ret)
static HRESULT Procedure_invoke(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res)
{
script_ctx_t *ctx = This->desc->ctx;
- HRESULT hres;
-
TRACE("\n");
-
- IActiveScriptSite_OnEnterScript(ctx->site);
- hres = exec_script(ctx, This->desc->value_func, NULL, NULL, res);
- IActiveScriptSite_OnLeaveScript(ctx->site);
-
- return hres;
+ return exec_script(ctx, TRUE, This->desc->value_func, NULL, NULL, res);
}
static const builtin_prop_t procedure_props[] = {
@@ -884,9 +877,7 @@ static HRESULT WINAPI ScriptDisp_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc
switch(wFlags) {
case DISPATCH_METHOD:
case DISPATCH_METHOD|DISPATCH_PROPERTYGET:
- IActiveScriptSite_OnEnterScript(This->ctx->site);
- hres = exec_script(This->ctx, ident->u.func, NULL, pdp, pvarRes);
- IActiveScriptSite_OnLeaveScript(This->ctx->site);
+ hres = exec_script(This->ctx, TRUE, ident->u.func, NULL, pdp, pvarRes);
break;
default:
FIXME("Unsupported flags %x\n", wFlags);
diff --git a/dlls/vbscript/vbscript.c b/dlls/vbscript/vbscript.c
index 69dc1a151b..790e61e3f0 100644
--- a/dlls/vbscript/vbscript.c
+++ b/dlls/vbscript/vbscript.c
@@ -78,15 +78,8 @@ static inline BOOL is_started(VBScript *This)
static HRESULT exec_global_code(script_ctx_t *ctx, vbscode_t *code, VARIANT *res)
{
- HRESULT hres;
-
code->pending_exec = FALSE;
-
- IActiveScriptSite_OnEnterScript(ctx->site);
- hres = exec_script(ctx, &code->main_code, NULL, NULL, res);
- IActiveScriptSite_OnLeaveScript(ctx->site);
-
- return hres;
+ return exec_script(ctx, TRUE, &code->main_code, NULL, NULL, res);
}
static void exec_queued_code(script_ctx_t *ctx)
diff --git a/dlls/vbscript/vbscript.h b/dlls/vbscript/vbscript.h
index 59285c572b..c9f49594c7 100644
--- a/dlls/vbscript/vbscript.h
+++ b/dlls/vbscript/vbscript.h
@@ -356,7 +356,7 @@ struct _vbscode_t {
void release_vbscode(vbscode_t*) DECLSPEC_HIDDEN;
HRESULT compile_script(script_ctx_t*,const WCHAR*,const WCHAR*,DWORD,vbscode_t**) DECLSPEC_HIDDEN;
-HRESULT exec_script(script_ctx_t*,function_t*,vbdisp_t*,DISPPARAMS*,VARIANT*) DECLSPEC_HIDDEN;
+HRESULT exec_script(script_ctx_t*,BOOL,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;
More information about the wine-cvs
mailing list