HRESULT CoReleaseMarshalData(pstm)
This helper function destroys a previously marshaled data packet. This function must always be called in order to destroy data packets. Examples of when this occurs include:
An internal error during an RPC invocation prevented the UnmarshalInterface() operation from being attempted.
A marshaled-data-packet was removed from a global table.
Following a successful, normal, unmarshal call.
This function works as should be expected: the class ID is obtained from the stream; an instance is created; IMarshal is obtained from that instance; then IMarshal::ReleaseMarshalData() is invoked.
Note for clarity: CoReleaseMarshalData() is not to be called following a normal, successful CoUnmarshalInterface(), as the latter function does this automatically for MSHLFLAGS_NORMAL. However, clients that use IMarshal interface directly, rather than simply going through the functions CoMarshal/UnmarshalInterface(), and so forth, must of course themselves always call IMarshal::ReleaseMarshalData() after calling IMarshal::UnmarshalInterface().
Argument
Type
Description
pstm
IStream*
A pointer to a stream that contains the data packet which is to be destroyed.