IStorage::OpenStream
Opens an existing stream object within this storage object in the specified access mode.
HRESULT OpenStream(
const WCHAR * pwcsName, //Points to name of stream to open
void * reserved1, //Reserved; must be NULL
DWORD grfMode, //Access mode for the new stream
DWORD reserved2, //Reserved; must be zero
IStream ** ppstm //Address of output variable that
// receives the IStream interface pointer
);
Parameters
-
pwcsName
-
[in] Points to a wide character string that contains the name of the stream to open.
-
reserved1
-
[in] Reserved for future use; must be NULL.
-
grfMode
-
[in] Specifies the access mode to be assigned to the open stream. See the STGM enumeration values for descriptions of the possible values. . Whatever other modes you may choose, you must at least specify STGM_SHARE_EXCLUSIVE when calling this method.
-
reserved2
-
[in] Reserved for future use; must be zero.
-
ppstm
-
[out] Address of IStream* pointer variable that receives the interface pointer to the newly-opened stream object. If an error occurs, *ppstm must be set to NULL.
Return Values
-
S_OK
-
The stream was successfully opened.
-
E_PENDING
-
Asynchronous Storage only: Part or all of the stream's data is currently unavailable. For more information see IFillLockBytes and Asynchronous Storage.
-
STG_E_ACCESSDENIED
-
Insufficient permissions to open stream.
-
STG_E_FILENOTFOUND
-
The stream with specified name does not exist.
-
STG_E_INSUFFICIENTMEMORY
-
The stream was not opened due to a lack of memory.
-
STG_E_INVALIDFLAG
-
The value specified for the grfMode flag is not a valid STGM enumeration value.
-
STG_E_INVALIDFUNCTION
-
The specified combination of grfMode flags is not supported. For example, if this method is called without the STGM_SHARE_EXCLUSIVE flag.
-
STG_E_INVALIDNAME
-
Invalid value for pwcsName.
-
STG_E_INVALIDPOINTER
-
The pointer specified for the stream object was invalid.
-
STG_E_INVALIDPARAMETER
-
One of the parameters was invalid.
-
STG_E_REVERTED
-
The storage object has been invalidated by a revert operation above it in the transaction tree.
-
STG_E_TOOMANYOPENFILES
-
The stream was not opened because there are too many open files.
Remarks
IStorage::OpenStream opens an existing stream object within this storage object in the access mode specified in grfMode. There are restrictions on the permissions that can be given in grfMode. For example, the permissions on this storage object restrict the permissions on its streams. In general, access restrictions on streams should be stricter than those on their parent storages. Compound-file streams must be opened with STGM_SHARE_EXCLUSIVE.
QuickInfo
Windows NT: Use version 3.1 or later.
Windows: Use Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in objidl.h.
See Also
IStorage - Compound File Implementation, IStorage::CreateStream, IStream