ole32: Add a helper to copy FORMATETC structures.
Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
f6ced24999
commit
11db49190b
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue