Huw Davies : ole32: Add support for getting stream based objects from a flushed clipboard.
Alexandre Julliard
julliard at winehq.org
Thu Apr 16 14:34:51 CDT 2009
Module: wine
Branch: master
Commit: 25d7ecde4751fa65e872c828e4eaf1e74bdf332c
URL: http://source.winehq.org/git/wine.git/?a=commit;h=25d7ecde4751fa65e872c828e4eaf1e74bdf332c
Author: Huw Davies <huw at codeweavers.com>
Date: Thu Apr 16 12:34:07 2009 +0100
ole32: Add support for getting stream based objects from a flushed clipboard.
---
dlls/ole32/clipboard.c | 29 +++++++++++++++++++++++++++++
1 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/dlls/ole32/clipboard.c b/dlls/ole32/clipboard.c
index 57a48fb..9f2f9e7 100644
--- a/dlls/ole32/clipboard.c
+++ b/dlls/ole32/clipboard.c
@@ -959,6 +959,33 @@ static HRESULT get_stgmed_for_global(HGLOBAL h, STGMEDIUM *med)
}
/************************************************************************
+ * 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
*/
static HRESULT WINAPI snapshot_GetData(IDataObject *iface, FORMATETC *fmt,
@@ -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);
More information about the wine-cvs
mailing list