Commit 11db4919 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

ole32: Add a helper to copy FORMATETC structures.

parent f6ced249
......@@ -334,4 +334,16 @@ static inline BOOL heap_free(void *mem)
return HeapFree(GetProcessHeap(), 0, mem);
}
static inline HRESULT copy_formatetc(FORMATETC *dst, const FORMATETC *src)
{
*dst = *src;
if (src->ptd)
{
dst->ptd = CoTaskMemAlloc( src->ptd->tdSize );
if (!dst->ptd) return E_OUTOFMEMORY;
memcpy( dst->ptd, src->ptd, src->ptd->tdSize );
}
return S_OK;
}
#endif /* __WINE_OLE_COMPOBJ_H */
......@@ -56,14 +56,14 @@ static void release_statdata(STATDATA *data)
static HRESULT copy_statdata(STATDATA *dst, const STATDATA *src)
{
*dst = *src;
if(src->formatetc.ptd)
{
dst->formatetc.ptd = CoTaskMemAlloc(src->formatetc.ptd->tdSize);
if(!dst->formatetc.ptd) return E_OUTOFMEMORY;
memcpy(dst->formatetc.ptd, src->formatetc.ptd, src->formatetc.ptd->tdSize);
}
if(dst->pAdvSink) IAdviseSink_AddRef(dst->pAdvSink);
HRESULT hr;
hr = copy_formatetc( &dst->formatetc, &src->formatetc );
if (FAILED(hr)) return hr;
dst->advf = src->advf;
dst->pAdvSink = src->pAdvSink;
if (dst->pAdvSink) IAdviseSink_AddRef( dst->pAdvSink );
dst->dwConnection = src->dwConnection;
return S_OK;
}
......
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