CoImpersonateClient

Windows Mobile 6.5
A version of this page is also available for
4/8/2010

This function allows the server to impersonate the client of the current call for the duration of the call.


HRESULT CoImpersonateClient( )

None.

This function supports the standard return values, including the following value:

S_OK

Indicates success.

This method 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.

One call to CoRevertToSelf (or IServerSecurity::RevertToSelf) will undo any number of ImpersonateClient calls.

To determine whether the platform supports this function, see Determining Supported COM APIs.

Headerobjbase.h
Libraryole32.lib
Windows Embedded CEWindows CE 3.0 and later
Windows MobileWindows Mobile Version 5.0 and later

Community Additions

Show: