diff --git a/dlls/vbscript/interp.c b/dlls/vbscript/interp.c index adec28fa905..b69798867d8 100644 --- a/dlls/vbscript/interp.c +++ b/dlls/vbscript/interp.c @@ -266,8 +266,10 @@ static HRESULT do_icall(exec_ctx_t *ctx, VARIANT *res) return hres; break; case REF_FUNC: - FIXME("functions not implemented\n"); - return E_NOTIMPL; + hres = exec_script(ctx->script, ref.u.f, &dp, res); + if(FAILED(hres)) + return hres; + break; case REF_NONE: FIXME("%s not found\n", debugstr_w(identifier)); return DISP_E_UNKNOWNNAME; @@ -812,12 +814,22 @@ OP_LIST #undef X }; -HRESULT exec_script(script_ctx_t *ctx, function_t *func) +HRESULT exec_script(script_ctx_t *ctx, function_t *func, DISPPARAMS *dp, VARIANT *res) { exec_ctx_t exec; vbsop_t op; HRESULT hres = S_OK; + if(res) { + FIXME("returning value is not implemented\n"); + return E_NOTIMPL; + } + + if(dp && arg_cnt(dp)) { + FIXME("arguments not implemented\n"); + return E_NOTIMPL; + } + exec.stack_size = 16; exec.top = 0; exec.stack = heap_alloc(exec.stack_size * sizeof(VARIANT)); diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs index 60ca9880ad3..0c4c10f5725 100644 --- a/dlls/vbscript/tests/lang.vbs +++ b/dlls/vbscript/tests/lang.vbs @@ -175,4 +175,8 @@ Sub testsub End Sub end if +x = false +Call testsub +Call ok(x, "x is false, testsub not called?") + reportSuccess() diff --git a/dlls/vbscript/vbscript.c b/dlls/vbscript/vbscript.c index f6891c7a4e8..cb28a9a53be 100644 --- a/dlls/vbscript/vbscript.c +++ b/dlls/vbscript/vbscript.c @@ -77,7 +77,7 @@ static HRESULT exec_global_code(script_ctx_t *ctx, vbscode_t *code) code->global_executed = TRUE; IActiveScriptSite_OnEnterScript(ctx->site); - hres = exec_script(ctx, &code->global_code); + hres = exec_script(ctx, &code->global_code, NULL, NULL); IActiveScriptSite_OnLeaveScript(ctx->site); return hres; diff --git a/dlls/vbscript/vbscript.h b/dlls/vbscript/vbscript.h index 32b19aba8f5..d541e9de786 100644 --- a/dlls/vbscript/vbscript.h +++ b/dlls/vbscript/vbscript.h @@ -65,6 +65,11 @@ HRESULT disp_get_id(IDispatch*,BSTR,DISPID*); HRESULT disp_call(script_ctx_t*,IDispatch*,DISPID,DISPPARAMS*,VARIANT*); HRESULT disp_propput(script_ctx_t*,IDispatch*,DISPID,VARIANT*); +static inline unsigned arg_cnt(const DISPPARAMS *dp) +{ + return dp->cArgs - dp->cNamedArgs; +} + typedef struct _dynamic_var_t { struct _dynamic_var_t *next; VARIANT v; @@ -179,7 +184,7 @@ struct _vbscode_t { void release_vbscode(vbscode_t*) DECLSPEC_HIDDEN; HRESULT compile_script(script_ctx_t*,const WCHAR*,vbscode_t**) DECLSPEC_HIDDEN; -HRESULT exec_script(script_ctx_t*,function_t*) DECLSPEC_HIDDEN; +HRESULT exec_script(script_ctx_t*,function_t*,DISPPARAMS*,VARIANT*) DECLSPEC_HIDDEN; HRESULT WINAPI VBScriptFactory_CreateInstance(IClassFactory*,IUnknown*,REFIID,void**);