Jacek Caban : vbscript: Leave converting object to trivial values up to calee.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Mar 3 09:42:11 CST 2015


Module: wine
Branch: master
Commit: bd42594da9b6b5fc2af94f2fc8ce40223c956450
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=bd42594da9b6b5fc2af94f2fc8ce40223c956450

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue Mar  3 14:41:30 2015 +0100

vbscript: Leave converting object to trivial values up to calee.

---

 dlls/vbscript/interp.c | 35 +++++++++++++++++++++++++----------
 1 file changed, 25 insertions(+), 10 deletions(-)

diff --git a/dlls/vbscript/interp.c b/dlls/vbscript/interp.c
index 1fe7304..64f998d 100644
--- a/dlls/vbscript/interp.c
+++ b/dlls/vbscript/interp.c
@@ -697,6 +697,29 @@ static HRESULT interp_mcallv(exec_ctx_t *ctx)
     return do_mcall(ctx, NULL);
 }
 
+static HRESULT assign_value(exec_ctx_t *ctx, VARIANT *dst, VARIANT *src, WORD flags)
+{
+    HRESULT hres;
+
+    hres = VariantCopyInd(dst, src);
+    if(FAILED(hres))
+        return hres;
+
+    if(V_VT(dst) == VT_DISPATCH && !(flags & DISPATCH_PROPERTYPUTREF)) {
+        DISPPARAMS dp = {NULL};
+        VARIANT value;
+
+        hres = disp_call(ctx->script, V_DISPATCH(dst), DISPID_VALUE, &dp, &value);
+        IDispatch_Release(V_DISPATCH(dst));
+        if(FAILED(hres))
+            return hres;
+
+        *dst = value;
+    }
+
+    return S_OK;
+}
+
 static HRESULT assign_ident(exec_ctx_t *ctx, BSTR name, WORD flags, DISPPARAMS *dp)
 {
     ref_t ref;
@@ -746,7 +769,7 @@ static HRESULT assign_ident(exec_ctx_t *ctx, BSTR name, WORD flags, DISPPARAMS *
             return E_NOTIMPL;
         }
 
-        hres = VariantCopyInd(v, dp->rgvarg);
+        hres = assign_value(ctx, v, dp->rgvarg, flags);
         break;
     }
     case REF_DISP:
@@ -776,7 +799,7 @@ static HRESULT assign_ident(exec_ctx_t *ctx, BSTR name, WORD flags, DISPPARAMS *
             TRACE("creating variable %s\n", debugstr_w(name));
             hres = add_dynamic_var(ctx, name, FALSE, &new_var);
             if(SUCCEEDED(hres))
-                hres = VariantCopyInd(new_var, dp->rgvarg);
+                hres = assign_value(ctx, new_var, dp->rgvarg, flags);
         }
     }
 
@@ -792,10 +815,6 @@ static HRESULT interp_assign_ident(exec_ctx_t *ctx)
 
     TRACE("%s\n", debugstr_w(arg));
 
-    hres = stack_assume_val(ctx, arg_cnt);
-    if(FAILED(hres))
-        return hres;
-
     vbstack_to_dp(ctx, arg_cnt, TRUE, &dp);
     hres = assign_ident(ctx, arg, DISPATCH_PROPERTYPUT, &dp);
     if(FAILED(hres))
@@ -852,10 +871,6 @@ static HRESULT interp_assign_member(exec_ctx_t *ctx)
         return E_FAIL;
     }
 
-    hres = stack_assume_val(ctx, arg_cnt);
-    if(FAILED(hres))
-        return hres;
-
     hres = disp_get_id(obj, identifier, VBDISP_LET, FALSE, &id);
     if(SUCCEEDED(hres)) {
         vbstack_to_dp(ctx, arg_cnt, TRUE, &dp);




More information about the wine-cvs mailing list