Functions


CoImpersonateClient Function

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

Syntax

C++
HRESULT CoImpersonateClient(void);

Parameters

This function has no parameters.

Return Value

This function supports the standard return values, including S_OK.

Remarks

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 calls to impersonate the client.

Requirements

Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderObjbase.h
LibraryOle32.lib
DLLOle32.dll

See Also

Cloaking
Impersonation
Impersonation and Asynchronous Calls
IServerSecurity::ImpersonateClient
Security in COM

Send comments about this topic to Microsoft

Build date: 11/12/2009

Tags :


Page view tracker