ole32: Zero STGMEDIUM before calling IDataObject::GetData.

Signed-off-by: Thomas Faber <thomas.faber@reactos.org>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Thomas Faber 2017-02-23 17:55:00 +01:00 committed by Alexandre Julliard
parent a6bfecd401
commit 87dba2bbd0
2 changed files with 12 additions and 2 deletions

View File

@ -741,7 +741,7 @@ static HRESULT get_data_from_storage(IDataObject *data, FORMATETC *fmt, HGLOBAL
hr = IDataObject_GetDataHere(data, &stg_fmt, &med);
if(FAILED(hr))
{
med.u.pstg = NULL;
memset(&med, 0, sizeof(med));
hr = IDataObject_GetData(data, &stg_fmt, &med);
if(FAILED(hr)) goto end;
@ -789,7 +789,7 @@ static HRESULT get_data_from_stream(IDataObject *data, FORMATETC *fmt, HGLOBAL *
LARGE_INTEGER offs;
ULARGE_INTEGER pos;
med.u.pstm = NULL;
memset(&med, 0, sizeof(med));
hr = IDataObject_GetData(data, &stm_fmt, &med);
if(FAILED(hr)) goto error;
@ -826,6 +826,7 @@ static HRESULT get_data_from_global(IDataObject *data, FORMATETC *fmt, HGLOBAL *
mem_fmt = *fmt;
mem_fmt.tymed = TYMED_HGLOBAL;
memset(&med, 0, sizeof(med));
hr = IDataObject_GetData(data, &mem_fmt, &med);
if(FAILED(hr)) return hr;
@ -853,6 +854,7 @@ static HRESULT get_data_from_enhmetafile(IDataObject *data, FORMATETC *fmt, HGLO
mem_fmt = *fmt;
mem_fmt.tymed = TYMED_ENHMF;
memset(&med, 0, sizeof(med));
hr = IDataObject_GetData(data, &mem_fmt, &med);
if(FAILED(hr)) return hr;
@ -880,6 +882,7 @@ static HRESULT get_data_from_metafilepict(IDataObject *data, FORMATETC *fmt, HGL
mem_fmt = *fmt;
mem_fmt.tymed = TYMED_MFPICT;
memset(&med, 0, sizeof(med));
hr = IDataObject_GetData(data, &mem_fmt, &med);
if(FAILED(hr)) return hr;
@ -909,6 +912,7 @@ static HRESULT get_data_from_bitmap(IDataObject *data, FORMATETC *fmt, HBITMAP *
mem_fmt = *fmt;
mem_fmt.tymed = TYMED_GDI;
memset(&med, 0, sizeof(med));
hr = IDataObject_GetData(data, &mem_fmt, &med);
if(FAILED(hr)) return hr;
@ -1394,6 +1398,8 @@ static HRESULT WINAPI snapshot_GetData(IDataObject *iface, FORMATETC *fmt,
if ( !fmt || !med ) return E_INVALIDARG;
memset(med, 0, sizeof(*med));
if ( !OpenClipboard(NULL)) return CLIPBRD_E_CANT_OPEN;
if(!This->data)

View File

@ -246,6 +246,10 @@ static HRESULT WINAPI DataObjectImpl_GetData(IDataObject* iface, FORMATETC *pfor
DataObjectImpl_GetData_calls++;
ok(pmedium->tymed == 0, "pmedium->tymed = %u\n", pmedium->tymed);
ok(U(*pmedium).hGlobal == NULL, "pmedium->hGlobal = %p\n", U(*pmedium).hGlobal);
ok(pmedium->pUnkForRelease == NULL, "pmedium->pUnkForRelease = %p\n", pmedium->pUnkForRelease);
if(pformatetc->lindex != -1)
return DV_E_FORMATETC;