Commit 0946c154 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

ole32: PropVariantClear should always reset contents of the passed in PROPVARIANT.

parent 7de7fc65
......@@ -2919,7 +2919,10 @@ HRESULT WINAPI PropVariantClear(PROPVARIANT * pvar) /* [in/out] */
hr = PROPVARIANT_ValidateType(pvar->vt);
if (FAILED(hr))
{
memset(pvar, 0, sizeof(*pvar));
return hr;
}
switch(pvar->vt)
{
......@@ -3006,12 +3009,14 @@ HRESULT WINAPI PropVariantClear(PROPVARIANT * pvar) /* [in/out] */
}
}
else
{
WARN("Invalid/unsupported type %d\n", pvar->vt);
hr = STG_E_INVALIDPARAMETER;
}
}
ZeroMemory(pvar, sizeof(*pvar));
return S_OK;
memset(pvar, 0, sizeof(*pvar));
return hr;
}
/***********************************************************************
......
......@@ -187,9 +187,7 @@ static void test_validtypes(void)
memset(&propvar, 0x55, sizeof(propvar));
hr = PropVariantClear(&propvar);
ok(hr == STG_E_INVALIDPARAMETER, "expected STG_E_INVALIDPARAMETER, got %08x\n", hr);
todo_wine
ok(propvar.vt == 0, "expected 0, got %d\n", propvar.vt);
todo_wine
ok(U(propvar).uhVal.QuadPart == 0, "expected 0, got %#x/%#x\n",
U(propvar).uhVal.u.LowPart, U(propvar).uhVal.u.HighPart);
......@@ -202,25 +200,16 @@ todo_wine
vt = propvar.vt = i;
hr = PropVariantClear(&propvar);
expect(hr, vt);
if (hr == S_OK) /* FIXME: Remove once Wine is fixed */
ok(U(propvar).uhVal.QuadPart == 0, "%u: expected 0, got %#x/%#x\n",
i, U(propvar).uhVal.u.LowPart, U(propvar).uhVal.u.HighPart);
else
todo_wine
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);
memset(&propvar, 0x55, sizeof(propvar));
U(propvar).pszVal = NULL;
vt = propvar.vt = i | VT_ARRAY;
hr = PropVariantClear(&propvar);
expect(hr, vt);
if (hr == S_OK) /* FIXME: Remove once Wine is fixed */
ok(U(propvar).uhVal.QuadPart == 0, "%u: expected 0, got %#x/%#x\n",
i, U(propvar).uhVal.u.LowPart, U(propvar).uhVal.u.HighPart);
else
todo_wine
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);
......@@ -229,11 +218,7 @@ todo_wine
vt = propvar.vt = i | VT_VECTOR;
hr = PropVariantClear(&propvar);
expect(hr, vt);
if (hr == S_OK) /* FIXME: Remove once Wine is fixed */
ok(U(propvar).uhVal.QuadPart == 0, "%u: expected 0, got %#x/%#x\n",
i, U(propvar).uhVal.u.LowPart, U(propvar).uhVal.u.HighPart);
else
todo_wine
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);
......@@ -242,11 +227,7 @@ todo_wine
vt = propvar.vt = i | VT_BYREF;
hr = PropVariantClear(&propvar);
expect(hr, vt);
if (hr == S_OK) /* FIXME: Remove once Wine is fixed */
ok(U(propvar).uhVal.QuadPart == 0, "%u: expected 0, got %#x/%#x\n",
i, U(propvar).uhVal.u.LowPart, U(propvar).uhVal.u.HighPart);
else
todo_wine
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