RtlCheckTokenCapability - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
#ifndef _NTRTL_H
#if (PHNT_VERSION >= PHNT_WINDOWS_8)

// rev
/**
 * The RtlCheckTokenCapability routine determines whether a token has the specified capability, identified by its SID.
 *
 * \param TokenHandle An optional handle to the token to test; if NULL, the token of the current thread or process is used.
 * \param CapabilitySidToCheck A pointer to the capability SID to check.
 * \param HasCapability A pointer to a variable that receives whether the token has the capability.
 * \return NTSTATUS Successful or errant status.
 */
NTSYSAPI
NTSTATUS
NTAPI
RtlCheckTokenCapability(
    _In_opt_ HANDLE TokenHandle,
    _In_ PSID CapabilitySidToCheck,
    _Out_ PBOOLEAN HasCapability
    );

#endif
#endif

View code on GitHub

NtDoc

Determines if a token can pass access checks that require the specified capability SID.

Parameters

Pseudo-handles

This function supports the following pseudo-handle values:

Implementation details

This function creates a security descriptor with a DACL that grants access to the user SID and the capability SID and performs an access checks against it via NtAccessCheck. Therefore, unsandboxed tokens are considered to have any capability.

Required OS version

This function was introduced in Windows 8.

Related Win32 API

See also