Huw Davies : inetcomm: Add IStream_CopyTo to the sub-stream implementation.
Alexandre Julliard
julliard at winehq.org
Fri Feb 15 05:35:58 CST 2008
Module: wine
Branch: master
Commit: cc0a458f92422a0039e46149d4f1ae30ab92a035
URL: http://source.winehq.org/git/wine.git/?a=commit;h=cc0a458f92422a0039e46149d4f1ae30ab92a035
Author: Huw Davies <huw at codeweavers.com>
Date: Thu Feb 14 13:53:49 2008 +0000
inetcomm: Add IStream_CopyTo to the sub-stream implementation.
---
dlls/inetcomm/mimeole.c | 42 ++++++++++++++++++++++++++++++++++++++++--
1 files changed, 40 insertions(+), 2 deletions(-)
diff --git a/dlls/inetcomm/mimeole.c b/dlls/inetcomm/mimeole.c
index 1fd9983..a0da6b9 100644
--- a/dlls/inetcomm/mimeole.c
+++ b/dlls/inetcomm/mimeole.c
@@ -1251,8 +1251,46 @@ static HRESULT WINAPI sub_stream_CopyTo(
ULARGE_INTEGER *pcbRead,
ULARGE_INTEGER *pcbWritten)
{
- FIXME("stub\n");
- return E_NOTIMPL;
+ HRESULT hr = S_OK;
+ BYTE tmpBuffer[128];
+ ULONG bytesRead, bytesWritten, copySize;
+ ULARGE_INTEGER totalBytesRead;
+ ULARGE_INTEGER totalBytesWritten;
+
+ TRACE("(%p)->(%p, %d, %p, %p)\n", iface, pstm, cb.LowPart, pcbRead, pcbWritten);
+
+ totalBytesRead.QuadPart = 0;
+ totalBytesWritten.QuadPart = 0;
+
+ while ( cb.QuadPart > 0 )
+ {
+ if ( cb.QuadPart >= sizeof(tmpBuffer) )
+ copySize = sizeof(tmpBuffer);
+ else
+ copySize = cb.u.LowPart;
+
+ hr = IStream_Read(iface, tmpBuffer, copySize, &bytesRead);
+ if (FAILED(hr)) break;
+
+ totalBytesRead.QuadPart += bytesRead;
+
+ if (bytesRead)
+ {
+ hr = IStream_Write(pstm, tmpBuffer, bytesRead, &bytesWritten);
+ if (FAILED(hr)) break;
+ totalBytesWritten.QuadPart += bytesWritten;
+ }
+
+ if (bytesRead != copySize)
+ cb.QuadPart = 0;
+ else
+ cb.QuadPart -= bytesRead;
+ }
+
+ if (pcbRead) pcbRead->QuadPart = totalBytesRead.QuadPart;
+ if (pcbWritten) pcbWritten->QuadPart = totalBytesWritten.QuadPart;
+
+ return hr;
}
static HRESULT WINAPI sub_stream_Commit(
More information about the wine-cvs
mailing list