#ifndef _NTSEAPI_H
NTSYSCALLAPI
NTSTATUS
NTAPI
NtSetInformationToken(
_In_ HANDLE TokenHandle,
_In_ TOKEN_INFORMATION_CLASS TokenInformationClass,
_In_reads_bytes_(TokenInformationLength) PVOID TokenInformation,
_In_ ULONG TokenInformationLength
);
View code on GitHub
#ifndef _NTZWAPI_H
NTSYSCALLAPI
NTSTATUS
NTAPI
ZwSetInformationToken(
_In_ HANDLE TokenHandle,
_In_ TOKEN_INFORMATION_CLASS TokenInformationClass,
_In_reads_bytes_(TokenInformationLength) PVOID TokenInformation,
_In_ ULONG TokenInformationLength
);
View code on GitHub
Sets various information about the specified token. This function is partially documented in Windows Driver Kit here and here.
TokenHandle
- a handle to the token. For most information classes, the handle must grant TOKEN_ADJUST_DEFAULT
access.TokenInformationClass
- the type of information to set.TokenInformation
- a pointer to the buffer with the data specific to the request.TokenInformationLength
- the size of the provided buffer in bytes.For the list of supported info classes and required token access, see TOKEN_INFORMATION_CLASS
.
STATUS_TOKEN_ALREADY_IN_USE
indicates that the specified type of information cannot be changed for a token that is currently used as a primary token for a process.Note that as opposed to NtQueryInformationToken
, this function does not support token pseudo-handles.