Compartir a través de


CAccessToken::OpenRPCClientToken

Call this method from within a server handling a call from an RPC client to initialize the CAccessToken with the access token from the client.

bool OpenRPCClientToken(
   RPC_BINDING_HANDLE BindingHandle,
   DWORD dwDesiredAccess,
   bool bImpersonate = false,
   bool bOpenAsSelf = true
) throw(...);

Parameters

  • BindingHandle
    Binding handle on the server that represents a binding to a client.

  • dwDesiredAccess
    Specifies an access mask that specifies the requested types of access to the access token. These requested access types are compared with the token's DACL to determine which accesses are granted or denied.

  • bImpersonate
    If true, the current thread will impersonate the calling RPC client if this call completes successfully. If false, the access token will be opened, but the thread will not have an impersonation token when this call completes.

  • bOpenAsSelf
    Indicates whether the access check is to be made against the security context of the thread calling the GetThreadToken method or against the security context of the process for the calling thread.

    If this parameter is false, the access check is performed using the security context for the calling thread. If the thread is impersonating a client, this security context can be that of a client process. If this parameter is true, the access check is made using the security context of the process for the calling thread.

Return Value

Returns true on success, false on failure.

Remarks

The CAutoRevertImpersonation Class can be used to automatically revert impersonated access tokens created by setting the bImpersonate flag to true.

Requirements

Library: rpcrt4.lib

See Also

Concepts

CAccessToken Class

CAccessToken Members

CAccessToken::OpenCOMClientToken

CAccessToken::OpenNamedPipeClientToken