Share via


CAccessToken::OpenCOMClientToken

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

bool OpenCOMClientToken( 
   DWORD dwDesiredAccess, 
   bool bImpersonate = false, 
   bool bOpenAsSelf = true 
) throw(...);

Parameters

  • 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 COM 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

Header: atlsecurity.h

See Also

Reference

CAccessToken Class

CAccessToken::OpenNamedPipeClientToken

CAccessToken::OpenRPCClientToken