CoImpersonateClient  W9M2FT

Allows the server to impersonate the client of the current call for the duration of the call.

HRESULT CoImpersonateClient()

 

Return Values

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

S_OK

Indicates success.

 

Remarks

Allows the server to impersonate the client of the current call for the duration of the call. If you do not call CoRevertToSelf, OLE reverts automatically for you. This function will fail unless the object is being called with RPC_C_AUTHN_LEVEL_CONNECT or higher authentication in effect (any authentication level except RPC_C_AUTHN_LEVEL_NONE) This function encapsulates the following sequence of common calls (error handling excluded):

    CoGetCallContext(IID_IServerSecurity, (void**)&pss);

    pss->ImpersonateClient();

    pss->Release();

 

This helper function encapsulates the process of getting a pointer to an instance of IServerSecurity that contains data about the current call, calling its ImpersonateClient method, and then releasing the pointer.

See Also

IServerSecurity::ImpersonateClient, Security in COM