Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
Win32.cs
Go to the documentation of this file.
3
5
6internal static class Win32
7{
8 internal static int OpenThreadToken(TokenAccessLevels dwDesiredAccess, System.Security.Principal.WinSecurityContext dwOpenAs, out SafeTokenHandle phThreadToken)
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 }
38
39 internal static int SetThreadToken(SafeTokenHandle hToken)
40 {
41 int result = 0;
42 if (!global::Interop.Advapi32.SetThreadToken(IntPtr.Zero, hToken))
43 {
45 }
46 return result;
47 }
48}
static int SetThreadToken(SafeTokenHandle hToken)
Definition Win32.cs:39
static int OpenThreadToken(TokenAccessLevels dwDesiredAccess, System.Security.Principal.WinSecurityContext dwOpenAs, out SafeTokenHandle phThreadToken)
Definition Win32.cs:8
static readonly IntPtr Zero
Definition IntPtr.cs:18