The Labs \ Source Viewer \ SSCLI \ System.Runtime.Remoting.Channels \ TokenInformationClass

  1. // ==++==
  2. //
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. //
  14. // ==--==
  15. //==========================================================================
  16. using System.Runtime.InteropServices;
  17. using System.Text;
  18. namespace System.Runtime.Remoting.Channels
  19. {
  20.    
  21.     static internal class NativeMethods
  22.     {
  23.         private const string ADVAPI32 = "advapi32.dll";
  24.        
  25.         [DllImport(ADVAPI32, SetLastError = true)]
  26.         static internal extern bool IsValidSid(IntPtr sidPointer);
  27.        
  28.         [DllImport(ADVAPI32, SetLastError = true)]
  29.         static internal extern IntPtr GetSidIdentifierAuthority(IntPtr sidPointer);
  30.        
  31.         [DllImport(ADVAPI32, SetLastError = true)]
  32.         static internal extern IntPtr GetSidSubAuthorityCount(IntPtr sidPointer);
  33.        
  34.         [DllImport(ADVAPI32, SetLastError = true)]
  35.         static internal extern IntPtr GetSidSubAuthority(IntPtr sidPointer, int count);
  36.        
  37.         [DllImport(ADVAPI32, SetLastError = true)]
  38.         static internal extern bool GetTokenInformation(IntPtr tokenHandle, int tokenInformationClass, IntPtr sidAndAttributesPointer, int tokenInformationLength, ref int returnLength);
  39.        
  40.         internal const int ThreadTokenAllAccess = 983040 | 511;
  41.         internal const int BufferTooSmall = 122;
  42.         internal enum TokenInformationClass
  43.         {
  44.             TokenUser = 1,
  45.             TokenGroups,
  46.             TokenPrivileges,
  47.             TokenOwner,
  48.             TokenPrimaryGroup,
  49.             TokenDefaultDacl,
  50.             TokenSource,
  51.             TokenType,
  52.             TokenImpersonationLevel,
  53.             TokenStatistics,
  54.             TokenRestrictedSids,
  55.             TokenSessionId,
  56.             TokenGroupsAndPrivileges,
  57.             TokenSessionReference,
  58.             TokenSandBoxInert
  59.         }
  60.        
  61.     }
  62. }

Developer Fusion