This function unmarshals a buffer containing an interface pointer and releases the stream when an interface pointer has been marshaled from another thread to the calling thread.
HRESULT CoGetInterfaceAndReleaseStream( LPSTREAM pStm, REFIID riid, LPVOID* ppv );
[in] Pointer to the IStream interface on the stream to be unmarshaled.
[in] Reference to the identifier of the interface requested from the unmarshaled object.
[out] Address of pointer variable that receives the interface pointer requested in riid. Upon successful return, *ppv contains the requested interface pointer to the unmarshaled interface.
This function supports the standard return value E_INVALIDARG, as well as the following:
Indicates the output interface was unmarshaled and the stream was released.
This function can also return any of the values returned by CoUnmarshalInterface.
The CoGetInterfaceAndReleaseStream function performs the following tasks:
Calls CoUnmarshalInterface to unmarshal an interface pointer previously passed in a call to CoMarshalInterThreadInterfaceInStream.
Releases the stream pointer. Even if the unmarshaling fails, the stream is still released because there is no effective way to recover from a failure of this kind.
To determine whether the platform supports this function, see Determining Supported COM APIs.