[PATCH v2] ole32: Obtain stream size regardless of current position

Micah N Gorrell mgorrell at codeweavers.com
Thu Nov 7 14:59:12 CST 2019


Using STREAM_SEEK_END when attempting to determine the size of a stream
that clipboard data has just been rendered into if the current position
does not return a value. This corrects an issue with Office 2016 where
the current position of the stream is 0 while rendering a target of image/png.

Signed-off-by: Micah N Gorrell <mgorrell at codeweavers.com>
---
 dlls/ole32/clipboard.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/dlls/ole32/clipboard.c b/dlls/ole32/clipboard.c
index 0c02d02a65..917288ebc0 100644
--- a/dlls/ole32/clipboard.c
+++ b/dlls/ole32/clipboard.c
@@ -790,6 +790,7 @@ static HRESULT get_data_from_stream(IDataObject *data, FORMATETC *fmt, HGLOBAL *
         offs.QuadPart = 0;
         IStream_Seek(med.u.pstm, offs, STREAM_SEEK_CUR, &pos);
         IStream_Seek(med.u.pstm, offs, STREAM_SEEK_SET, NULL);
+        if (pos.QuadPart == 0) IStream_Seek(med.u.pstm, offs, STREAM_SEEK_END, NULL);
         hr = IStream_CopyTo(med.u.pstm, stm, pos, NULL, NULL);
         ReleaseStgMedium(&med);
         if(FAILED(hr)) goto error;
-- 
2.23.0




More information about the wine-devel mailing list