The IMAPISupport::IStorageFromStream method implements a storage object to access a stream.
HRESULT IStorageFromStream(
LPUNKNOWN lpUnkIn,
LPCIID lpInterface,
ULONG ulFlags,
LPSTORAGE FAR * lppStorageOut
);
The IMAPISupport::IStorageFromStream method is implemented for all service provider support objects. Service providers call IStorageFromStream to create a storage object to use for opening particular properties. Service providers that have their own implementation of IStorage do not need to call IStorageFromStream.
The storage object created by IStorageFromStream calls the stream's IUnknown::AddRef method to increment its reference count and then decrements the count when the storage is released.
When the IMAPIProp::OpenProperty method of one of your objects is called to open a property with the IStorage interface, perform the following tasks:
If you implement additional interfaces that use the storage object, create an object that wraps the storage object and implement a higher level IUnknown::QueryInterface method.
Do not allow a property to be opened with the IStream interface if it was created with IStorage. Conversely, do not allow a property to be opened with the IStorage interface if it was created with IStream.
With one exception, it is acceptable to use the IStreamDocfile interface to stream a storage object from one container to another, but the IID_IStreamDocfile interface identifier must be passed in the OpenProperty method's lpInterface parameter.