1 instantiation of SafeAccessTokenHandle
System.Security.Principal.Windows (1)
Microsoft\Win32\SafeHandles\SafeAccessTokenHandle.cs (1)
27return new SafeAccessTokenHandle(IntPtr.Zero);
64 references to SafeAccessTokenHandle
mscorlib (1)
src\runtime\src\libraries\shims\mscorlib\ref\mscorlib.cs (1)
22[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.Win32.SafeHandles.SafeAccessTokenHandle))]
System.Security.Principal.Windows (63)
_generated\0\LibraryImports.g.cs (18)
23internal static partial bool OpenProcessToken(nint ProcessToken, global::System.Security.Principal.TokenAccessLevels DesiredAccess, out global::Microsoft.Win32.SafeHandles.SafeAccessTokenHandle TokenHandle) 32global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeAccessTokenHandle>.ManagedToUnmanagedOut __TokenHandle_native__marshaller = new(); 99internal static partial bool GetTokenInformation(global::Microsoft.Win32.SafeHandles.SafeAccessTokenHandle TokenHandle, uint TokenInformationClass, global::Microsoft.Win32.SafeHandles.SafeLocalAllocHandle TokenInformation, uint TokenInformationLength, out uint ReturnLength) 109global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeAccessTokenHandle>.ManagedToUnmanagedIn __TokenHandle_native__marshaller = new(); 194internal static partial bool DuplicateTokenEx(global::Microsoft.Win32.SafeHandles.SafeAccessTokenHandle hExistingToken, uint dwDesiredAccess, nint lpTokenAttributes, uint ImpersonationLevel, uint TokenType, ref global::Microsoft.Win32.SafeHandles.SafeAccessTokenHandle phNewToken) 203global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeAccessTokenHandle>.ManagedToUnmanagedRef __phNewToken_native__marshaller = new(); 204global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeAccessTokenHandle>.ManagedToUnmanagedIn __hExistingToken_native__marshaller = new(); 253internal static partial bool DuplicateHandle(nint hSourceProcessHandle, nint hSourceHandle, nint hTargetProcessHandle, out global::Microsoft.Win32.SafeHandles.SafeAccessTokenHandle lpTargetHandle, uint dwDesiredAccess, bool bInheritHandle, uint dwOptions) 263global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeAccessTokenHandle>.ManagedToUnmanagedOut __lpTargetHandle_native__marshaller = new(); 805private static partial bool OpenThreadToken(nint ThreadHandle, global::System.Security.Principal.TokenAccessLevels dwDesiredAccess, bool bOpenAsSelf, out global::Microsoft.Win32.SafeHandles.SafeAccessTokenHandle phThreadToken) 815global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeAccessTokenHandle>.ManagedToUnmanagedOut __phThreadToken_native__marshaller = new(); 881internal static partial bool ImpersonateLoggedOnUser(global::Microsoft.Win32.SafeHandles.SafeAccessTokenHandle userToken) 888global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeAccessTokenHandle>.ManagedToUnmanagedIn __userToken_native__marshaller = new(); 980internal static partial int LsaLogonUser(global::Microsoft.Win32.SafeHandles.SafeLsaHandle LsaHandle, in global::Interop.Advapi32.LSA_STRING OriginName, global::Interop.SspiCli.SECURITY_LOGON_TYPE LogonType, int AuthenticationPackage, nint AuthenticationInformation, int AuthenticationInformationLength, nint LocalGroups, in global::Interop.SspiCli.TOKEN_SOURCE SourceContext, out global::Microsoft.Win32.SafeHandles.SafeLsaReturnBufferHandle ProfileBuffer, out int ProfileBufferLength, out global::Interop.LUID LogonId, out global::Microsoft.Win32.SafeHandles.SafeAccessTokenHandle Token, out global::Interop.SspiCli.QUOTA_LIMITS Quotas, out int SubStatus) 994global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeAccessTokenHandle>.ManagedToUnmanagedOut __Token_native__marshaller = new(); 1107internal static partial bool CheckTokenMembership(global::Microsoft.Win32.SafeHandles.SafeAccessTokenHandle TokenHandle, byte[] SidToCheck, ref bool IsMember) 1115global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeAccessTokenHandle>.ManagedToUnmanagedIn __TokenHandle_native__marshaller = new();
Microsoft\Win32\SafeHandles\SafeAccessTokenHandle.cs (1)
23public static SafeAccessTokenHandle InvalidHandle
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.CheckTokenMembership.cs (1)
15SafeAccessTokenHandle TokenHandle,
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.DuplicateTokenEx.cs (2)
15SafeAccessTokenHandle hExistingToken, 20ref SafeAccessTokenHandle phNewToken);
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.GetTokenInformation_SafeLocalAllocHandle.cs (1)
15SafeAccessTokenHandle TokenHandle,
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.ImpersonateLoggedOnUser.cs (1)
14internal static partial bool ImpersonateLoggedOnUser(SafeAccessTokenHandle userToken);
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.OpenProcessToken_SafeAccessTokenHandle.cs (1)
18out SafeAccessTokenHandle TokenHandle);
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.OpenThreadToken_SafeAccessTokenHandle.cs (2)
19out SafeAccessTokenHandle phThreadToken); 21internal static bool OpenThreadToken(TokenAccessLevels desiredAccess, WinSecurityContext openAs, out SafeAccessTokenHandle tokenHandle)
src\runtime\src\libraries\Common\src\Interop\Windows\Kernel32\Interop.DuplicateHandle_SafeAccessTokenHandle.cs (1)
18out SafeAccessTokenHandle lpTargetHandle,
src\runtime\src\libraries\Common\src\Interop\Windows\SspiCli\Interop.LsaLogonUser.cs (1)
26out SafeAccessTokenHandle Token,
System\Security\Principal\WindowsIdentity.cs (31)
47private SafeAccessTokenHandle _safeTokenHandle; 92_safeTokenHandle ??= SafeAccessTokenHandle.InvalidHandle; 114_safeTokenHandle = SafeAccessTokenHandle.InvalidHandle; 117private WindowsIdentity(SafeAccessTokenHandle safeTokenHandle) 203out SafeAccessTokenHandle accessTokenHandle, 258private static SafeAccessTokenHandle DuplicateAccessToken(IntPtr accessToken) 277SafeAccessTokenHandle duplicateAccessToken; 294private static SafeAccessTokenHandle DuplicateAccessToken(SafeAccessTokenHandle accessToken) 476using SafeAccessTokenHandle invalidHandle = SafeAccessTokenHandle.InvalidHandle; 477SafeAccessTokenHandle token = invalidHandle; 584using SafeAccessTokenHandle invalidHandle = SafeAccessTokenHandle.InvalidHandle; 672public SafeAccessTokenHandle AccessToken 692public static void RunImpersonated(SafeAccessTokenHandle safeAccessTokenHandle, Action action) 700public static T RunImpersonated<T>(SafeAccessTokenHandle safeAccessTokenHandle, Func<T> func) 715public static Task RunImpersonatedAsync(SafeAccessTokenHandle safeAccessTokenHandle, Func<Task> func) 725public static Task<T> RunImpersonatedAsync<T>(SafeAccessTokenHandle safeAccessTokenHandle, Func<Task<T>> func) 749private static readonly AsyncLocal<SafeAccessTokenHandle?> s_currentImpersonatedToken = new AsyncLocal<SafeAccessTokenHandle?>(CurrentImpersonatedTokenChanged); 751private static void RunImpersonatedInternal(SafeAccessTokenHandle token, Action action) 755SafeAccessTokenHandle previousToken = GetCurrentToken(TokenAccessLevels.MaximumAllowed, false, out bool isImpersonating, out int hr); 794private static void CurrentImpersonatedTokenChanged(AsyncLocalValueChangedArgs<SafeAccessTokenHandle?> args) 811SafeAccessTokenHandle safeTokenHandle = GetCurrentToken(desiredAccess, threadOnly, out bool isImpersonating, out int hr); 852private static SafeAccessTokenHandle GetCurrentToken(TokenAccessLevels desiredAccess, bool threadOnly, out bool isImpersonating, out int hr) 856bool success = Interop.Advapi32.OpenThreadToken(desiredAccess, WinSecurityContext.Both, out SafeAccessTokenHandle safeTokenHandle); 875private static SafeAccessTokenHandle GetCurrentProcessToken(TokenAccessLevels desiredAccess, out int hr) 878if (!Interop.Advapi32.OpenProcessToken(Interop.Kernel32.GetCurrentProcess(), desiredAccess, out SafeAccessTokenHandle safeTokenHandle)) 900private static Interop.LUID GetLogonAuthId(SafeAccessTokenHandle safeTokenHandle) 909private static SafeLocalAllocHandle? GetTokenInformation(SafeAccessTokenHandle tokenHandle, TokenInformationClass tokenInformationClass, bool nullOnInvalidParam = false)
System\Security\Principal\WindowsPrincipal.cs (3)
147using SafeAccessTokenHandle invalidHandle = SafeAccessTokenHandle.InvalidHandle; 148SafeAccessTokenHandle token = invalidHandle;