This function reads from a stream, with partial reads treated as failure.


IStream_Read (
    IStream *pstm,
    void *pv, 
    ULONG cb);


The pstm argument provides the address of an IStream interface to some stream object.

The pv argument provides the address of a buffer to read into.

The cb argument provides the number of bytes to read.

Return Value

The function returns zero for success, else an error code.


The function calls the given stream’s Read method. If this method succeeds but does not read the whole amount wanted, then the function fails, with E_FAIL as the error code.


The IStream_Read function is exported from SHLWAPI as ordinal 184 in version 5.00 and higher.

Though this function dates from as long ago as 1999, it was still not documented by Microsoft in the MSDN Library at least as late as the CD edition dated January 2004.

However, the function did eventually get documented, apparently later in 2004. This article now conforms to Microsoft’s nomenclature.