CheckTokenCapability function

The CheckTokenCapability function checks the capabilities of a given token.

Syntax

BOOL CheckTokenCapability(
  HANDLE TokenHandle,
  PSID   CapabilitySidToCheck,
  PBOOL  HasCapability
);

Parameters

TokenHandle

A handle to an access token. The handle must have TOKEN_QUERY access to the token. The token must be an impersonation token.

If TokenHandle is NULL, CheckTokenCapability uses the impersonation token of the calling thread. If the thread is not impersonating, the function duplicates the thread's primary token to create an impersonation token.

CapabilitySidToCheck

A pointer to a capability SID structure. The CheckTokenCapability function checks the capabilities of this access token.

HasCapability

Receives the results of the check. If the access token has the capability, it returns TRUE, otherwise, it returns FALSE.

Return Value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError

Requirements

   
Minimum supported client Windows 8 [desktop apps only]
Minimum supported server Windows Server 2012 [desktop apps only]
Target Platform Windows
Header securitybaseapi.h
DLL Kernel32.dll