Jacek Caban : vbscript: Use global object property to expose Err object.

Alexandre Julliard julliard at winehq.org
Fri Oct 18 14:01:15 CDT 2019


Module: wine
Branch: master
Commit: 087adea7dc503dadf55046622adf05d43555e822
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=087adea7dc503dadf55046622adf05d43555e822

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Oct 18 16:20:03 2019 +0200

vbscript: Use global object property to expose Err object.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/vbscript/global.c | 16 ++++++++++++++++
 dlls/vbscript/interp.c |  8 --------
 2 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/dlls/vbscript/global.c b/dlls/vbscript/global.c
index 50f54f38a6..0f85f66bad 100644
--- a/dlls/vbscript/global.c
+++ b/dlls/vbscript/global.c
@@ -2486,6 +2486,21 @@ static HRESULT Global_GetRef(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt,
     return E_NOTIMPL;
 }
 
+static HRESULT Global_Err(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
+{
+    TRACE("\n");
+
+    if(args_cnt) {
+        FIXME("Setter not supported\n");
+        return E_NOTIMPL;
+    }
+
+    V_VT(res) = VT_DISPATCH;
+    V_DISPATCH(res) = &This->ctx->err_obj->IDispatch_iface;
+    IDispatch_AddRef(V_DISPATCH(res));
+    return S_OK;
+}
+
 static const string_constant_t vbCr          = {1, {'\r'}};
 static const string_constant_t vbCrLf        = {2, {'\r','\n'}};
 static const string_constant_t vbNewLine     = {2, {'\r','\n'}};
@@ -2526,6 +2541,7 @@ static const builtin_prop_t global_props[] = {
     {L"DateValue",                 Global_DateValue, 0, 1},
     {L"Day",                       Global_Day, 0, 1},
     {L"Erase",                     Global_Erase, 0, 1},
+    {L"Err",                       Global_Err, BP_GETPUT},
     {L"Escape",                    Global_Escape, 0, 1},
     {L"Eval",                      Global_Eval, 0, 1},
     {L"Execute",                   Global_Execute, 0, 1},
diff --git a/dlls/vbscript/interp.c b/dlls/vbscript/interp.c
index 45dcb45303..251fd785cf 100644
--- a/dlls/vbscript/interp.c
+++ b/dlls/vbscript/interp.c
@@ -104,8 +104,6 @@ static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, vbdisp_invoke_type_
     DISPID id;
     HRESULT hres;
 
-    static const WCHAR errW[] = {'e','r','r',0};
-
     if(invoke_type == VBDISP_LET
             && (ctx->func->type == FUNC_FUNCTION || ctx->func->type == FUNC_PROPGET || ctx->func->type == FUNC_DEFGET)
             && !wcsicmp(name, ctx->func->name)) {
@@ -175,12 +173,6 @@ static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, vbdisp_invoke_type_
         }
     }
 
-    if(!wcsicmp(name, errW)) {
-        ref->type = REF_OBJ;
-        ref->u.obj = &ctx->script->err_obj->IDispatch_iface;
-        return S_OK;
-    }
-
     hres = get_builtin_id(ctx->script->global_obj, name, &id);
     if(SUCCEEDED(hres)) {
         ref->type = REF_DISP;




More information about the wine-cvs mailing list