CoGetInterfaceAndReleaseStream  5A09.S

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,

//Pointer to the stream from which the object is to be marshaled

    REFIID riid,

//Reference to the identifier of the interface

    LPVOID * ppv

//Indirect pointer to the interface

   );

 

 

Parameters

pStm

[in] Pointer to the IStream interface on the stream to be unmarshaled.

riid

[in] Reference to the identifier of the interface requested from the unmarshaled object.

ppv

[out] Indirect pointer to the unmarshaled interface.

 

Return Values

This function supports the standard return value E_INVALIDARG, as well as the following:

S_OK

Indicates the output interface was unmarshaled and the stream was released.

 

This function can also return any of the values returned by CoUnmarshalInterface1LJ9LBY.

 

Remarks

The CoGetInterfaceAndReleaseStream function performs the following tasks:

  1.  Calls CoUnmarshalInterface to unmarshal an interface pointer previously passed in a call to CoMarshalInterThreadInterfaceInStreamFPWIGD.

  2.  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.

 

See Also

CoMarshalInterThreadInterfaceInStream, CoUnmarshalInterface