ole32: Add support for getting stream based objects from a flushed clipboard.

This commit is contained in:
Huw Davies 2009-04-16 12:34:07 +01:00 committed by Alexandre Julliard
parent f8a9ca2cfa
commit 25d7ecde47
1 changed files with 29 additions and 0 deletions

View File

@ -958,6 +958,33 @@ static HRESULT get_stgmed_for_global(HGLOBAL h, STGMEDIUM *med)
return hr;
}
/************************************************************************
* get_stgmed_for_stream
*
* Returns a stg medium with a stream based on the handle
*/
static HRESULT get_stgmed_for_stream(HGLOBAL h, STGMEDIUM *med)
{
HRESULT hr;
HGLOBAL dst;
med->pUnkForRelease = NULL;
med->tymed = TYMED_NULL;
hr = dup_global_mem(h, GMEM_MOVEABLE, &dst);
if(FAILED(hr)) return hr;
hr = CreateStreamOnHGlobal(dst, TRUE, &med->u.pstm);
if(FAILED(hr))
{
GlobalFree(dst);
return hr;
}
med->tymed = TYMED_ISTREAM;
return hr;
}
/************************************************************************
* snapshot_GetData
*/
@ -1005,6 +1032,8 @@ static HRESULT WINAPI snapshot_GetData(IDataObject *iface, FORMATETC *fmt,
if(mask & TYMED_HGLOBAL)
hr = get_stgmed_for_global(h, med);
else if(mask & TYMED_ISTREAM)
hr = get_stgmed_for_stream(h, med);
else
{
FIXME("Unhandled tymed - emum tymed %x req tymed %x\n", entry->fmtetc.tymed, fmt->tymed);