Jacek Caban : vbscript: Lookup global object before host-provided objects.
Alexandre Julliard
julliard at winehq.org
Thu Sep 22 13:39:48 CDT 2011
Module: wine
Branch: master
Commit: abb2d2872112e7e1242c4b94c388572885ce8440
URL: http://source.winehq.org/git/wine.git/?a=commit;h=abb2d2872112e7e1242c4b94c388572885ce8440
Author: Jacek Caban <jacek at codeweavers.com>
Date: Thu Sep 22 14:25:15 2011 +0200
vbscript: Lookup global object before host-provided objects.
---
dlls/vbscript/interp.c | 44 +++++++++++++++++++++++---------------------
1 files changed, 23 insertions(+), 21 deletions(-)
diff --git a/dlls/vbscript/interp.c b/dlls/vbscript/interp.c
index 08ea83e..678b51a 100644
--- a/dlls/vbscript/interp.c
+++ b/dlls/vbscript/interp.c
@@ -126,12 +126,14 @@ 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))
return S_OK;
- hres = disp_get_id(ctx->this_obj, name, invoke_type, TRUE, &id);
- if(SUCCEEDED(hres)) {
- ref->type = REF_DISP;
- ref->u.d.disp = ctx->this_obj;
- ref->u.d.id = id;
- return S_OK;
+ if(ctx->func->type != FUNC_GLOBAL) {
+ hres = disp_get_id(ctx->this_obj, name, invoke_type, TRUE, &id);
+ if(SUCCEEDED(hres)) {
+ ref->type = REF_DISP;
+ ref->u.d.disp = ctx->this_obj;
+ ref->u.d.id = id;
+ return S_OK;
+ }
}
if(ctx->func->type != FUNC_GLOBAL && lookup_dynamic_vars(ctx->script->global_vars, name, ref))
@@ -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) {
- 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);
if(SUCCEEDED(hres)) {
ref->type = REF_DISP;
@@ -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;
return S_OK;
}
More information about the wine-cvs
mailing list