Function Reference


_StreamCopyTo

Copies bytes from one stream to another using IStream::CopyTo.

_StreamCopyTo(ByRef $oSourceStream, ByRef $pDestStream, $iBytesToCopy, ByRef $iBytesRead, ByRef $iBytesWritten)

Parameters

$oSourceStream Source IStream COM object.
$pDestStream [in/out] Pointer to the destination IStream COM interface.
$iBytesToCopy Number of bytes to copy.
$iBytesRead [out] Number of bytes read from the source.
$iBytesWritten [out] Number of bytes written to the destination.

Return Value

Success: 1
Failure: 0, sets @error to:
1 - Invalid source stream object.
2 - Invalid or failed to create destination stream.
3 - COM error (HRESULT in @extended).
4 - Failed to set destination stream size.
5 - Destination stream not open for writing.

Remarks

The destination stream must be open for writing (verified via grfMode). If $pDestStream is 0, a new stream is created using _WinAPI_CreateStreamOnHGlobal with sufficient size. Caller must release $pDestStream using DllCall("ole32.dll", "ulong", "Release", "ptr", ...) if it was created by this function.

Related

_StreamRead, _StreamWrite, _StreamSeek, _StreamSetSize, _CreateStreamFromPtr