Commit f9bc636d authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

ole32: PropVariantCopy should return DISP_E_BADVARTYPE in case of bad source variant type.

In some rare (notably for some VT_VECTOR) cases Windows implementation returns STG_E_INVALIDPARAMETER, but returning DISP_E_BADVARTYPE should cover most of cases. Signed-off-by: 's avatarDmitry Timoshkov <dmitry@baikal.ru> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 8e77d6a2
......@@ -3041,7 +3041,7 @@ HRESULT WINAPI PropVariantCopy(PROPVARIANT *pvarDest, /* [out] */
hr = PROPVARIANT_ValidateType(pvarSrc->vt);
if (FAILED(hr))
return hr;
return DISP_E_BADVARTYPE;
/* this will deal with most cases */
*pvarDest = *pvarSrc;
......
......@@ -130,7 +130,7 @@ static const char* wine_vtypes[VT_CLSID+1] =
};
static void expect(HRESULT hr, VARTYPE vt, BOOL copy)
static void expect(HRESULT hr, VARTYPE vt, BOOL copy, int line)
{
int idx = vt & VT_TYPEMASK;
BYTE flags;
......@@ -158,7 +158,12 @@ static void expect(HRESULT hr, VARTYPE vt, BOOL copy)
}
if(flags == PROP_INV)
ok(hr == copy ? DISP_E_BADVARTYPE : STG_E_INVALIDPARAMETER, "%s (%s): got %08x\n", wine_vtypes[idx], modifier, hr);
{
if (copy && (vt & VT_VECTOR))
ok(hr == DISP_E_BADVARTYPE || hr == STG_E_INVALIDPARAMETER, "%s (%s): got %08x (line %d)\n", wine_vtypes[idx], modifier, hr, line);
else
ok(hr == (copy ? DISP_E_BADVARTYPE : STG_E_INVALIDPARAMETER), "%s (%s): got %08x (line %d)\n", wine_vtypes[idx], modifier, hr, line);
}
else if(flags == PROP_V0)
ok(hr == S_OK, "%s (%s): got %08x\n", wine_vtypes[idx], modifier, hr);
else if(flags & PROP_TODO)
......@@ -210,7 +215,7 @@ static void test_validtypes(void)
vt = propvar.vt = i;
memset(&copy, 0x77, sizeof(copy));
hr = PropVariantCopy(&copy, &propvar);
expect(hr, vt, TRUE);
expect(hr, vt, TRUE, __LINE__);
if (hr == S_OK)
{
ok(copy.vt == propvar.vt, "expected %d, got %d\n", propvar.vt, copy.vt);
......@@ -224,7 +229,7 @@ static void test_validtypes(void)
ok(!ret || broken(ret) /* win2000 */, "%d: copy should stay unchanged\n", i);
}
hr = PropVariantClear(&propvar);
expect(hr, vt, FALSE);
expect(hr, vt, FALSE, __LINE__);
ok(propvar.vt == 0, "expected 0, got %d\n", propvar.vt);
ok(U(propvar).uhVal.QuadPart == 0, "%u: expected 0, got %#x/%#x\n",
i, U(propvar).uhVal.u.LowPart, U(propvar).uhVal.u.HighPart);
......@@ -234,7 +239,7 @@ static void test_validtypes(void)
vt = propvar.vt = i | VT_ARRAY;
memset(&copy, 0x77, sizeof(copy));
hr = PropVariantCopy(&copy, &propvar);
expect(hr, vt, TRUE);
expect(hr, vt, TRUE, __LINE__);
if (hr == S_OK)
{
ok(copy.vt == propvar.vt, "expected %d, got %d\n", propvar.vt, copy.vt);
......@@ -247,7 +252,7 @@ static void test_validtypes(void)
ok(!ret || broken(ret) /* win2000 */, "%d: copy should stay unchanged\n", i);
}
hr = PropVariantClear(&propvar);
expect(hr, vt, FALSE);
expect(hr, vt, FALSE, __LINE__);
ok(propvar.vt == 0, "expected 0, got %d\n", propvar.vt);
ok(U(propvar).uhVal.QuadPart == 0, "%u: expected 0, got %#x/%#x\n",
i, U(propvar).uhVal.u.LowPart, U(propvar).uhVal.u.HighPart);
......@@ -258,7 +263,7 @@ static void test_validtypes(void)
vt = propvar.vt = i | VT_VECTOR;
memset(&copy, 0x77, sizeof(copy));
hr = PropVariantCopy(&copy, &propvar);
expect(hr, vt, TRUE);
expect(hr, vt, TRUE, __LINE__);
if (hr == S_OK)
{
ok(copy.vt == propvar.vt, "expected %d, got %d\n", propvar.vt, copy.vt);
......@@ -271,7 +276,7 @@ static void test_validtypes(void)
ok(!ret || broken(ret) /* win2000 */, "%d: copy should stay unchanged\n", i);
}
hr = PropVariantClear(&propvar);
expect(hr, vt, FALSE);
expect(hr, vt, FALSE, __LINE__);
ok(propvar.vt == 0, "expected 0, got %d\n", propvar.vt);
ok(U(propvar).uhVal.QuadPart == 0, "%u: expected 0, got %#x/%#x\n",
i, U(propvar).uhVal.u.LowPart, U(propvar).uhVal.u.HighPart);
......@@ -281,7 +286,7 @@ static void test_validtypes(void)
vt = propvar.vt = i | VT_BYREF;
memset(&copy, 0x77, sizeof(copy));
hr = PropVariantCopy(&copy, &propvar);
expect(hr, vt, TRUE);
expect(hr, vt, TRUE, __LINE__);
if (hr == S_OK)
{
ok(copy.vt == propvar.vt, "expected %d, got %d\n", propvar.vt, copy.vt);
......@@ -295,7 +300,7 @@ static void test_validtypes(void)
ok(!ret || broken(ret) /* win2000 */, "%d: copy should stay unchanged\n", i);
}
hr = PropVariantClear(&propvar);
expect(hr, vt, FALSE);
expect(hr, vt, FALSE, __LINE__);
ok(propvar.vt == 0, "expected 0, got %d\n", propvar.vt);
ok(U(propvar).uhVal.QuadPart == 0, "%u: expected 0, got %#x/%#x\n",
i, U(propvar).uhVal.u.LowPart, U(propvar).uhVal.u.HighPart);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment