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