oleaut32: VaraintChangeType to support VT_BSTR to VT_UI2|VT_ARRAY
Alistair Leslie-Hughes
leslie_alistair at hotmail.com
Fri Aug 24 02:54:22 CDT 2012
Hi,
Changelog:
oleaut32: VaraintChangeType to support VT_BSTR to VT_UI2|VT_ARRAY
Best Regards
Alistair Leslie-Hughes
-------------- next part --------------
>From 2c1c99a5e74292e98d022b65b74241a9b2db8fab Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date: Fri, 17 Aug 2012 10:21:25 +1000
Subject: [PATCH] VaraintChangeType to support VT_BSTR to VT_UI2|VT_ARRAY
To: wine-patches <wine-patches at winehq.org>
---
dlls/oleaut32/tests/safearray.c | 11 ++++++++++-
dlls/oleaut32/variant.c | 2 +-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/dlls/oleaut32/tests/safearray.c b/dlls/oleaut32/tests/safearray.c
index c484bb8..d38e78a 100644
--- a/dlls/oleaut32/tests/safearray.c
+++ b/dlls/oleaut32/tests/safearray.c
@@ -294,7 +294,7 @@ static void test_safearray(void)
LONG indices[2];
HRESULT hres;
SAFEARRAYBOUND bound, bounds[2];
- VARIANT v;
+ VARIANT v,d;
LPVOID data;
IID iid;
VARTYPE vt;
@@ -557,6 +557,15 @@ static void test_safearray(void)
ok(V_BSTR(&v)[0] == 0x6548,"First letter are not 'He', but %x\n", V_BSTR(&v)[0]);
VariantClear(&v);
+ VariantClear(&d);
+ V_VT(&v) = VT_BSTR;
+ V_BSTR(&v) = SysAllocStringLen(NULL, 0);
+ hres = VariantChangeTypeEx(&d, &v, 0, 0, VT_UI1|VT_ARRAY);
+ ok(hres==S_OK, "CTE VT_BSTR -> VT_UI1|VT_ARRAY failed with %x\n",hres);
+ ok(V_VT(&d) == (VT_UI1|VT_ARRAY),"CTE BSTR -> VT_UI1|VT_ARRAY did not return VT_UI1|VT_ARRAY, but %d.v\n",V_VT(&v));
+ VariantClear(&v);
+ VariantClear(&d);
+
/* check locking functions */
a = SafeArrayCreate(VT_I4, 1, &bound);
ok(a!=NULL,"SAC should not fail\n");
diff --git a/dlls/oleaut32/variant.c b/dlls/oleaut32/variant.c
index 2045eab..8a77593 100644
--- a/dlls/oleaut32/variant.c
+++ b/dlls/oleaut32/variant.c
@@ -526,7 +526,7 @@ static inline HRESULT VARIANT_CoerceArray(VARIANTARG* pd, VARIANTARG* ps, VARTYP
return BstrFromVector(V_ARRAY(ps), &V_BSTR(pd));
if (V_VT(ps) == VT_BSTR && vt == (VT_ARRAY|VT_UI1))
- return VectorFromBstr(V_BSTR(ps), &V_ARRAY(ps));
+ return VectorFromBstr(V_BSTR(ps), &V_ARRAY(pd));
if (V_VT(ps) == vt)
return SafeArrayCopy(V_ARRAY(ps), &V_ARRAY(pd));
--
1.7.9.5
More information about the wine-patches
mailing list