CAccessToken::OpenNamedPipeClientToken
Call this method from within a server taking requests over a named pipe to initialize the CAccessToken with the access token from the client.
bool OpenNamedPipeClientToken(
HANDLE hPipe,
DWORD dwDesiredAccess,
bool bImpersonate = false,
bool bOpenAsSelf = true
) throw(...);
Parameters
hPipe
Handle to a named pipe.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 pipe 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