SetTokenInformation function
Applies to: desktop apps only
The SetTokenInformation function sets various types of information for a specified access token. The information that this function sets replaces existing information. The calling process must have appropriate access rights to set the information.
Syntax
BOOL WINAPI SetTokenInformation( __in HANDLE TokenHandle, __in TOKEN_INFORMATION_CLASS TokenInformationClass, __in LPVOID TokenInformation, __in DWORD TokenInformationLength );
Parameters
- TokenHandle [in]
-
A handle to the access token for which information is to be set.
- TokenInformationClass [in]
-
A value from the TOKEN_INFORMATION_CLASS enumerated type that identifies the type of information the function sets. The valid values from TOKEN_INFORMATION_CLASS are described in the TokenInformation parameter.
- TokenInformation [in]
-
A pointer to a buffer that contains the information set in the access token. The structure of this buffer depends on the type of information specified by the TokenInformationClass parameter.
- TokenInformationLength [in]
-
Specifies the length, in bytes, of the buffer pointed to by TokenInformation.
Return value
If the function succeeds, the function returns nonzero.
If the function fails, it returns zero. To get extended error information, call GetLastError.
Remarks
To set privilege information, an application can call the AdjustTokenPrivileges function. To set a token's groups, an application can call the AdjustTokenGroups function.
Token-type information can be set only when an access token is created.
Requirements
|
Minimum supported client | Windows XP |
|---|---|
|
Minimum supported server | Windows Server 2003 |
|
Header |
|
|
Library |
|
|
DLL |
|
See also
- Access Control Overview
- Basic Access Control Functions
- AdjustTokenGroups
- AdjustTokenPrivileges
- GetTokenInformation
- OpenProcessToken
- OpenThreadToken
- TOKEN_DEFAULT_DACL
- TOKEN_INFORMATION_CLASS
- TOKEN_OWNER
- TOKEN_PRIMARY_GROUP
Send comments about this topic to Microsoft
Build date: 3/7/2012
- 7/29/2009
- Guillaume Ray
- 8/3/2009
- Thomas Lee