Commit abb2d287 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

vbscript: Lookup global object before host-provided objects.

parent f61bd1c5
...@@ -126,6 +126,7 @@ static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, vbdisp_invoke_type_ ...@@ -126,6 +126,7 @@ static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, vbdisp_invoke_type_
if(lookup_dynamic_vars(ctx->func->type == FUNC_GLOBAL ? ctx->script->global_vars : ctx->dynamic_vars, name, ref)) if(lookup_dynamic_vars(ctx->func->type == FUNC_GLOBAL ? ctx->script->global_vars : ctx->dynamic_vars, name, ref))
return S_OK; return S_OK;
if(ctx->func->type != FUNC_GLOBAL) {
hres = disp_get_id(ctx->this_obj, name, invoke_type, TRUE, &id); hres = disp_get_id(ctx->this_obj, name, invoke_type, TRUE, &id);
if(SUCCEEDED(hres)) { if(SUCCEEDED(hres)) {
ref->type = REF_DISP; ref->type = REF_DISP;
...@@ -133,6 +134,7 @@ static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, vbdisp_invoke_type_ ...@@ -133,6 +134,7 @@ static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, vbdisp_invoke_type_
ref->u.d.id = id; ref->u.d.id = id;
return S_OK; return S_OK;
} }
}
if(ctx->func->type != FUNC_GLOBAL && lookup_dynamic_vars(ctx->script->global_vars, name, ref)) if(ctx->func->type != FUNC_GLOBAL && lookup_dynamic_vars(ctx->script->global_vars, name, ref))
return S_OK; return S_OK;
...@@ -145,8 +147,22 @@ static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, vbdisp_invoke_type_ ...@@ -145,8 +147,22 @@ static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, vbdisp_invoke_type_
} }
} }
if(!strcmpiW(name, errW)) {
ref->type = REF_OBJ;
ref->u.obj = (IDispatch*)&ctx->script->err_obj->IDispatchEx_iface;
return S_OK;
}
hres = vbdisp_get_id(ctx->script->global_obj, name, invoke_type, TRUE, &id);
if(SUCCEEDED(hres)) {
ref->type = REF_DISP;
ref->u.d.disp = (IDispatch*)&ctx->script->global_obj->IDispatchEx_iface;
ref->u.d.id = id;
return S_OK;
}
LIST_FOR_EACH_ENTRY(item, &ctx->script->named_items, named_item_t, entry) { LIST_FOR_EACH_ENTRY(item, &ctx->script->named_items, named_item_t, entry) {
if((item->flags & SCRIPTITEM_GLOBALMEMBERS) && item->disp != ctx->this_obj) { if((item->flags & SCRIPTITEM_GLOBALMEMBERS)) {
hres = disp_get_id(item->disp, name, invoke_type, FALSE, &id); hres = disp_get_id(item->disp, name, invoke_type, FALSE, &id);
if(SUCCEEDED(hres)) { if(SUCCEEDED(hres)) {
ref->type = REF_DISP; ref->type = REF_DISP;
...@@ -180,20 +196,6 @@ static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, vbdisp_invoke_type_ ...@@ -180,20 +196,6 @@ static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, vbdisp_invoke_type_
} }
} }
if(!strcmpiW(name, errW)) {
ref->type = REF_OBJ;
ref->u.obj = (IDispatch*)&ctx->script->err_obj->IDispatchEx_iface;
return S_OK;
}
hres = vbdisp_get_id(ctx->script->global_obj, name, invoke_type, TRUE, &id);
if(SUCCEEDED(hres)) {
ref->type = REF_DISP;
ref->u.d.disp = (IDispatch*)&ctx->script->global_obj->IDispatchEx_iface;
ref->u.d.id = id;
return S_OK;
}
ref->type = REF_NONE; ref->type = REF_NONE;
return S_OK; return S_OK;
} }
......
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