Search
Module:
Directory

Desktop Functions:

Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Support Forum
Download Visual Studio Add-In

Terms of Use
Privacy Policy
TOKEN_PRIVILEGES (Structures)
.
Summary
Contains information about a set of privileges for an access token.

C# Definitions:

public const UInt32 SE_PRIVILEGE_ENABLED_BY_DEFAULT    = 0x00000001;
public const UInt32 SE_PRIVILEGE_ENABLED        = 0x00000002;
public const UInt32 SE_PRIVILEGE_REMOVED        = 0x00000004;
public const UInt32 SE_PRIVILEGE_USED_FOR_ACCESS    = 0x80000000;

public struct TOKEN_PRIVILEGES {
    public UInt32 PrivilegeCount;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst=ANYSIZE_ARRAY)]
    public LUID_AND_ATTRIBUTES [] Privileges;
}

Alternate simple structure for single privilege setting:

[StructLayout(LayoutKind.Sequential)]
public struct TOKEN_PRIVILEGES
{
    public UInt32 PrivilegeCount;
    public LUID Luid;
    public UInt32 Attributes;
}

VB Definition:

Structure TOKEN_PRIVILEGES
   Public PrivilegeCount As Integer
   Public TheLuid As LUID
   Public Attributes As Integer
End Structure

User-Defined Field Types:

LUID

LUID_AND_ATTRIBUTES

WINNT (for ANYSIZE_ARRAY)

Notes:

Do NOT define LUID as UInt64! Use the structure LUID consisted of two UInt32 because of memory alignment.

VB.Net Sample Code:

   ' Token Privilege
   Dim tp As New TOKEN_PRIVILEGES

   tp.PrivilegeCount = 1
   tp.TheLuid = luid_Restore
   tp.Attributes = SE_PRIVILEGE_ENABLED

Alternative Managed API:

Documentation

Please edit this page!

Do you have...

  • helpful tips?
  • corrections to the existing content?
  • alternate definitions?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing any supporting types needed.


NEW: ANTS Memory Profiler 5 just released!

Memory Profiling made simple!

Download your free trial now. This download also contains the FREE PInvoke.net VS Add-in

Download Now
 
Access PInvoke.net directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version
Revisions