Robert Wilhelm : vbscript: Support VT_BSTR in stack_pop_bool.

Alexandre Julliard julliard at winehq.org
Tue Apr 12 13:38:03 CDT 2022


Module: wine
Branch: oldstable
Commit: d4024e428b4323552980317d9f47a4faae94bde0
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=d4024e428b4323552980317d9f47a4faae94bde0

Author: Robert Wilhelm <robert.wilhelm at gmx.net>
Date:   Tue Nov  2 21:39:40 2021 +0100

vbscript: Support VT_BSTR in stack_pop_bool.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51911
Signed-off-by: Robert Wilhelm <robert.wilhelm at gmx.net>
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit b9e38a41eabbe444ba55eab7a0a5573dfb7f9a6b)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>

---

 dlls/vbscript/interp.c       |  7 +++++++
 dlls/vbscript/tests/lang.vbs | 16 ++++++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/dlls/vbscript/interp.c b/dlls/vbscript/interp.c
index f648f073bc8..173335062f5 100644
--- a/dlls/vbscript/interp.c
+++ b/dlls/vbscript/interp.c
@@ -416,6 +416,7 @@ static int stack_pop_bool(exec_ctx_t *ctx, BOOL *b)
 {
     variant_val_t val;
     HRESULT hres;
+    VARIANT_BOOL vb;
 
     hres = stack_pop_val(ctx, &val);
     if(FAILED(hres))
@@ -436,6 +437,12 @@ static int stack_pop_bool(exec_ctx_t *ctx, BOOL *b)
     case VT_I4:
         *b = V_I4(val.v);
         break;
+    case VT_BSTR:
+        hres = VarBoolFromStr(V_BSTR(val.v), ctx->script->lcid, 0, &vb);
+        if(FAILED(hres))
+            return hres;
+        *b=vb;
+        break;
     default:
         FIXME("unsupported for %s\n", debugstr_variant(val.v));
         release_val(&val);
diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs
index d7865301784..ceaf63f7e8d 100644
--- a/dlls/vbscript/tests/lang.vbs
+++ b/dlls/vbscript/tests/lang.vbs
@@ -357,6 +357,22 @@ while empty
    ok false, "while empty executed"
 wend
 
+x = 0
+if "0" then
+   ok false, "if ""0"" executed"
+else
+   x = 1
+end if
+Call ok(x = 1, "if ""0"" else not executed")
+
+x = 0
+if "-1" then
+   x = 1
+else
+   ok false, "if ""-1"" else executed"
+end if
+Call ok(x = 1, "if ""-1"" not executed")
+
 x = 0
 WHILE x < 3 : x = x + 1 : Wend
 Call ok(x = 3, "x not equal to 3")




More information about the wine-cvs mailing list