This function switches the call context object used by CoGetCallContext.
HRESULT CoSwitchCallContext( IUnknown* pNewObject, IUnknown** ppOldObject );
[in] A pointer to an interface on the new call context object.
COM will keep a reference to the pointer until CoSwitchCallContext is called with another object.
It may be NULL if your application is calling CoSwitchCallContext to switch back to the original call context and there was no original call context.
[out] Address of pointer variable that receives a pointer to the call context object of the call currently in progress.
This value is returned so that the original call context can be restored by the custom marshaler.
The returned pointer will be NULL if there was no call in progress.
Custom marshalers call CoSwitchCallContext to change the call context object used by CoGetCallContext.
Before dispatching an arriving call, custom marshalers call CoSwitchCallContext, specifying the new context object.
After sending a reply, they must restore the original call context by calling CoSwitchCallContext again, this time passing a pointer to the original context object.
Call context objects provided by custom marshalers should support IServerSecurity.
To determine whether the platform supports this function, see Determining Supported COM APIs.