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

◆ OpenThreadToken()

static int System.Security.Principal.Win32.OpenThreadToken ( TokenAccessLevels dwDesiredAccess,
System::Security::Principal::WinSecurityContext dwOpenAs,
out SafeTokenHandle phThreadToken )
inlinestaticpackage

Definition at line 8 of file Win32.cs.

9 {
10 int num = 0;
11 bool bOpenAsSelf = true;
12 if (dwOpenAs == System.Security.Principal.WinSecurityContext.Thread)
13 {
14 bOpenAsSelf = false;
15 }
16 if (!global::Interop.Advapi32.OpenThreadToken((IntPtr)(-2), dwDesiredAccess, bOpenAsSelf, out phThreadToken))
17 {
18 if (dwOpenAs == System.Security.Principal.WinSecurityContext.Both)
19 {
20 bOpenAsSelf = false;
21 num = 0;
22 if (!global::Interop.Advapi32.OpenThreadToken((IntPtr)(-2), dwDesiredAccess, bOpenAsSelf, out phThreadToken))
23 {
25 }
26 }
27 else
28 {
30 }
31 }
32 if (num != 0)
33 {
34 phThreadToken = null;
35 }
36 return num;
37 }

References System.Runtime.InteropServices.Marshal.GetHRForLastWin32Error().

Referenced by System.Security.AccessControl.Privilege.TlsContents.TlsContents().