Expand Minimize

CoSwitchCallContext function

Switches the call context object used by CoGetCallContext.

Syntax


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

Parameters

pNewObject [in, optional]

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. This parameter may be NULL if you are calling CoSwitchCallContext to switch back to the original call context but there was no original call context.

ppOldObject [out]

The 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 marshaller. The returned pointer will be NULL if there was no call in progress.

Return value

This function can return the following values.

Return codeDescription
S_OK

The function was successful.

E_OUT_OF_MEMORY

Out of memory.

 

Remarks

Custom marshallers call CoSwitchCallContext to change the call context object used by the CoGetCallContext function. Before dispatching an arriving call, custom marshallers 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 marshallers should support the IServerSecurity interface.

Windows Phone 8: This API is supported.

Windows Phone 8.1: This API is supported.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps | Windows Store apps]

Minimum supported server

Windows 2000 Server [desktop apps | Windows Store apps]

Header

Objbase.h

Library

Ole32.lib

DLL

Ole32.dll

See also

CoGetCallContext
IServerSecurity
Security in COM

 

 

Community Additions

ADD
Show:
© 2014 Microsoft