Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ GetCurrentToken()

static SafeAccessTokenHandle System.Security.Principal.WindowsIdentity.GetCurrentToken ( TokenAccessLevels desiredAccess,
bool threadOnly,
out bool isImpersonating,
out int hr )
inlinestaticprivate

Definition at line 717 of file WindowsIdentity.cs.

718 {
719 isImpersonating = true;
720 hr = 0;
722 bool flag = global::Interop.Advapi32.OpenThreadToken(desiredAccess, WinSecurityContext.Both, out tokenHandle);
723 if (!flag)
724 {
726 }
727 if (!flag && hr == GetHRForWin32Error(1008))
728 {
729 isImpersonating = false;
730 if (!threadOnly)
731 {
732 return GetCurrentProcessToken(desiredAccess, out hr);
733 }
734 }
735 return tokenHandle;
736 }
static int GetHRForWin32Error(int dwLastError)
static SafeAccessTokenHandle GetCurrentProcessToken(TokenAccessLevels desiredAccess, out int hr)

References System.Runtime.Serialization.Dictionary, System.Security.Principal.WindowsIdentity.GetCurrentProcessToken(), System.Runtime.InteropServices.Marshal.GetHRForLastWin32Error(), and System.Security.Principal.WindowsIdentity.GetHRForWin32Error().

Referenced by System.Security.Principal.WindowsIdentity.GetCurrentInternal(), and System.Security.Principal.WindowsIdentity.RunImpersonatedInternal().