Export (0) Print
Expand All
Expand Minimize

SetTokenInformation function

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 [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

Header

Winbase.h (include Windows.h)

Library

Advapi32.lib

DLL

Advapi32.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

 

 

Community Additions

ADD
Show:
© 2014 Microsoft