RtlRemovePrivileges - NtDoc

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

// private
/**
 * The RtlRemovePrivileges routine removes from a token all privileges except those in a caller-supplied keep list.
 *
 * \param TokenHandle A handle to the token from which privileges are removed.
 * \param PrivilegesToKeep A pointer to an array of privilege identifiers to retain.
 * \param PrivilegeCount The number of entries in the PrivilegesToKeep array.
 * \return NTSTATUS Successful or errant status.
 */
NTSYSAPI
NTSTATUS
NTAPI
RtlRemovePrivileges(
    _In_ HANDLE TokenHandle,
    _In_ PULONG PrivilegesToKeep,
    _In_ ULONG PrivilegeCount
    );

#endif

View code on GitHub

NtDoc

Removes all privileges from the token except for the specified ones.

Parameters

Notable return values

Remarks

Note that this function does not support token pseudo-handles such as NtCurrentProcessToken. If you want to adjust the current process/thread token, you need to open it first.

Implementation details

This function enumerates available privileges via NtQueryInformationToken with TokenPrivileges and then modifies them via NtAdjustPrivilegesToken.

See also