From 78b65f3146f96f2682b7ae6805ed471448c76aba Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Sun, 30 May 2021 16:34:56 +1000 Subject: [PATCH 4/4] vbscript: Add wmi test This shows that the data returned by the EnumKey call isn't the same type as vbscript. At a source leve EnumKey returns a VT_BSTR|VT_ARRAY whereas vbscript converts it a VT_ARRAY|VT_VARIANT*. --- dlls/vbscript/tests/lang.vbs | 18 ++++++++++++++++++ dlls/vbscript/tests/run.c | 5 +++++ 2 files changed, 23 insertions(+) diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs index a716cdbc65f..b8db3f5becf 100644 --- a/dlls/vbscript/tests/lang.vbs +++ b/dlls/vbscript/tests/lang.vbs @@ -1896,4 +1896,22 @@ f1 not 1 = 0 arr (0) = 2 xor -2 +function wmi_array_bstr() +const HKEY_LOCAL_MACHINE = &H80000002 +Dim oReg + +Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv") + +Dim strKeyPath, strSubkey, arrSubKeys +strKeyPath = "Software\Microsoft\NET Framework Setup\NDP" +oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys + +Call ok(getVT(arrSubKeys) = "VT_ARRAY|VT_VARIANT*", "getVT(arrSubKeys) = " & getVT(arrSubKeys)) +For Each strSubkey In arrSubKeys +Next +end function + +Call wmi_array_bstr() + + reportSuccess() diff --git a/dlls/vbscript/tests/run.c b/dlls/vbscript/tests/run.c index bb33e6576ea..9d0fa1ef7d1 100644 --- a/dlls/vbscript/tests/run.c +++ b/dlls/vbscript/tests/run.c @@ -183,6 +183,11 @@ static const char *vt2a(VARIANT *v) sprintf(buf, "%s*", vt2a(V_BYREF(v))); return buf; } + else if(V_VT(v) == (VT_BYREF|VT_VARIANT|VT_ARRAY)) { + static char buf[64]; + sprintf(buf, "%s*", vt2a(V_BYREF(v))); + return buf; + } switch(V_VT(v)) { case VT_EMPTY: -- 2.30.2