Compartilhar via


CoSwitchCallContext

This function switches the call context object used by CoGetCallContext.

HRESULT CoSwitchCallContext(
  IUnknown* pNewObject,
  IUnknown** ppOldObject 
);

Parameters

  • pNewObject
    [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 you are calling CoSwitchCallContext to switch back to the original call context and there was no original call context.
  • ppOldObject
    [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.

Return Values

S_OK

Success.

E_OUT_OF_MEMORY

Remarks

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.

Requirements

OS Versions: Windows CE 3.0 and later.
Header: Objbase.h.
Link Library: Ole32.lib.

Last updated on Wednesday, April 13, 2005

© 2005 Microsoft Corporation. All rights reserved.