Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com ---
This is be needed for the next patches in the series.
dlls/vbscript/interp.c | 7 +++---- dlls/vbscript/vbscript.c | 16 ++++++++-------- dlls/vbscript/vbscript.h | 2 +- 3 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/dlls/vbscript/interp.c b/dlls/vbscript/interp.c index 906545c..b328674 100644 --- a/dlls/vbscript/interp.c +++ b/dlls/vbscript/interp.c @@ -114,7 +114,6 @@ static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, vbdisp_invoke_type_ { ScriptDisp *script_obj = ctx->script->script_obj; named_item_t *item; - IDispatch *disp; unsigned i; DISPID id; HRESULT hres; @@ -196,10 +195,10 @@ static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, vbdisp_invoke_type_ return S_OK; }
- disp = lookup_named_item(ctx->script, name, SCRIPTITEM_ISVISIBLE); - if(disp) { + item = lookup_named_item(ctx->script, name, SCRIPTITEM_ISVISIBLE); + if(item && item->disp) { ref->type = REF_OBJ; - ref->u.obj = disp; + ref->u.obj = item->disp; return S_OK; }
diff --git a/dlls/vbscript/vbscript.c b/dlls/vbscript/vbscript.c index 2b691af..0bbff30 100644 --- a/dlls/vbscript/vbscript.c +++ b/dlls/vbscript/vbscript.c @@ -189,7 +189,7 @@ static void exec_queued_code(script_ctx_t *ctx) } }
-IDispatch *lookup_named_item(script_ctx_t *ctx, const WCHAR *name, unsigned flags) +named_item_t *lookup_named_item(script_ctx_t *ctx, const WCHAR *name, unsigned flags) { named_item_t *item; HRESULT hres; @@ -214,7 +214,7 @@ IDispatch *lookup_named_item(script_ctx_t *ctx, const WCHAR *name, unsigned flag } }
- return item->disp; + return item; } }
@@ -870,7 +870,7 @@ static HRESULT WINAPI VBScriptParse_ParseScriptText(IActiveScriptParse *iface, DWORD dwFlags, VARIANT *pvarResult, EXCEPINFO *pexcepinfo) { VBScript *This = impl_from_IActiveScriptParse(iface); - IDispatch *context = NULL; + named_item_t *item = NULL; vbscode_t *code; HRESULT hres;
@@ -882,9 +882,9 @@ static HRESULT WINAPI VBScriptParse_ParseScriptText(IActiveScriptParse *iface, return E_UNEXPECTED;
if(pstrItemName) { - context = lookup_named_item(This->ctx, pstrItemName, 0); - if(!context) { - WARN("Inknown context %s\n", debugstr_w(pstrItemName)); + item = lookup_named_item(This->ctx, pstrItemName, 0); + if(!item) { + WARN("Unknown context %s\n", debugstr_w(pstrItemName)); return E_INVALIDARG; } } @@ -893,8 +893,8 @@ static HRESULT WINAPI VBScriptParse_ParseScriptText(IActiveScriptParse *iface, if(FAILED(hres)) return hres;
- if(context) - IDispatch_AddRef(code->context = context); + if(item && item->disp) + IDispatch_AddRef(code->context = item->disp);
if(!(dwFlags & SCRIPTTEXT_ISEXPRESSION) && !is_started(This)) { code->pending_exec = TRUE; diff --git a/dlls/vbscript/vbscript.h b/dlls/vbscript/vbscript.h index 33ecb45..a3f32fd 100644 --- a/dlls/vbscript/vbscript.h +++ b/dlls/vbscript/vbscript.h @@ -372,7 +372,7 @@ HRESULT compile_script(script_ctx_t*,const WCHAR*,const WCHAR*,DWORD_PTR,unsigne HRESULT compile_procedure(script_ctx_t*,const WCHAR*,const WCHAR*,DWORD_PTR,unsigned,DWORD,class_desc_t**) DECLSPEC_HIDDEN; HRESULT exec_script(script_ctx_t*,BOOL,function_t*,vbdisp_t*,DISPPARAMS*,VARIANT*) DECLSPEC_HIDDEN; void release_dynamic_var(dynamic_var_t*) DECLSPEC_HIDDEN; -IDispatch *lookup_named_item(script_ctx_t*,const WCHAR*,unsigned) DECLSPEC_HIDDEN; +named_item_t *lookup_named_item(script_ctx_t*,const WCHAR*,unsigned) DECLSPEC_HIDDEN; void clear_ei(EXCEPINFO*) DECLSPEC_HIDDEN; HRESULT report_script_error(script_ctx_t*,const vbscode_t*,unsigned) DECLSPEC_HIDDEN; void detach_global_objects(script_ctx_t*) DECLSPEC_HIDDEN;