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);
|
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 */
|
#endif /* __WINE_OLE_COMPOBJ_H */
|
||||||
|
|
|
@ -56,14 +56,14 @@ static void release_statdata(STATDATA *data)
|
||||||
|
|
||||||
static HRESULT copy_statdata(STATDATA *dst, const STATDATA *src)
|
static HRESULT copy_statdata(STATDATA *dst, const STATDATA *src)
|
||||||
{
|
{
|
||||||
*dst = *src;
|
HRESULT hr;
|
||||||
if(src->formatetc.ptd)
|
|
||||||
{
|
hr = copy_formatetc( &dst->formatetc, &src->formatetc );
|
||||||
dst->formatetc.ptd = CoTaskMemAlloc(src->formatetc.ptd->tdSize);
|
if (FAILED(hr)) return hr;
|
||||||
if(!dst->formatetc.ptd) return E_OUTOFMEMORY;
|
dst->advf = src->advf;
|
||||||
memcpy(dst->formatetc.ptd, src->formatetc.ptd, src->formatetc.ptd->tdSize);
|
dst->pAdvSink = src->pAdvSink;
|
||||||
}
|
if (dst->pAdvSink) IAdviseSink_AddRef( dst->pAdvSink );
|
||||||
if(dst->pAdvSink) IAdviseSink_AddRef(dst->pAdvSink);
|
dst->dwConnection = src->dwConnection;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue