HrIStorageFromStream 

The HrIStorageFromStream function layers an IStorage interface onto an IStream object.

Quick Info

Header file:

MAPIUTIL.H

Implemented by:

MAPI

Called by:

Client applications and service providers

 

HRESULT HrIStorageFromStream(

    LPUNKNOWN lpUnkIn,

 

    PIID lpInterface,

 

    ULONG ulFlags,

 

    LPSTORAGE FAR * lppStorageOut

 

   );

 

 

Parameters

lpUnkIn

[in] Pointer to the IUnknown object that implements the stream object.

lpInterface

[in] Pointer to the interface identifier (IID) for the object that implements the stream object. Any of the following values can be passed in the lpInterface parameter: NULL, IID_IStream, or IID_ILockBytes. Passing NULL in lpInterface is the same as passing IID_IStream.

ulFlags

[in] Bitmask of flags that controls how the storage is to be created relative to the stream. The default setting is that the storage has read-only access and occurs within the stream starting at position zero. The following flags can be set:

STGSTRM_CREATE

Creates a new storage object for the stream object.

STGSTRM_CURRENT

Starts storage at the current position of the stream.

STGSTRM_MODIFY

Allows the calling service provider to write to the returned storage.

STGSTRM_RESET

Starts storage at position zero.

lppStorageOut

[out] Pointer to a pointer to the returned IStorage object.

 

Return Values

S_OK

The call succeeded and has returned the expected value or values.

 

Remarks

Store providers support the HrIStorageFromStream function using the IStorage interface for attachments. Store providers must implement the IStream interface. HrIStorageFromStream provides the IStorage interface for the IStream object. It is possible to pass either an ILockBytes or an IStream interface in lpUnkIn.