[This is preliminary documentation and subject to change.]
Allows the server to impersonate the client of the current call for the duration of the call.
HRESULT CoImpersonateClient( )
This function supports the standard return value E_INVALIDARG, as well as the following:
Allows the server to impersonate the client of the current call for the duration of the call. If you do not call CoRevertToSelf, COM 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 (which is 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();
CoImpersonateClient 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. In NT 5, one call to CoRevertToSelf (or IServerSecurity::RevertToSelf) will undo any number of ImpersonateClient calls.
For more information, see Impersonation and Cloaking.
Windows NT: Use version 4.0 or later.
Windows: Use Windows 95 or later. Available as a redistributable for Windows 95.
Windows CE: Unsupported.
Header: Declared in objbase.h.
Import Library: Included as a resource in ole32.dll.
IServerSecurity::ImpersonateClient, Security in COM