ole32: PropVariantClear should always reset contents of the passed in PROPVARIANT.
This commit is contained in:
parent
7de7fc653b
commit
0946c154fa
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue