-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathTOKEN_STRUCTS.cs
61 lines (50 loc) · 1.51 KB
/
TOKEN_STRUCTS.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
using GetInjectedThreads.Enums;
using System;
using System.Runtime.InteropServices;
namespace GetInjectedThreads.Structs
{
// Token Structs reference
// https://docs.microsoft.com/en-us/windows/win32/api/securitybaseapi/nf-securitybaseapi-gettokeninformation
[StructLayout(LayoutKind.Sequential)]
struct TOKEN_USER
{
public SID_AND_ATTRIBUTES User;
}
[StructLayout(LayoutKind.Sequential)]
public struct SID_AND_ATTRIBUTES
{
public IntPtr Sid;
public int Attributes;
}
[StructLayout(LayoutKind.Sequential)]
public struct TOKEN_PRIVILEGES
{
public Int32 PrivilegeCount;
// https://docs.microsoft.com/en-us/dotnet/standard/native-interop/customize-struct-marshaling
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 50)]
public LUID_AND_ATTRIBUTES[] Privileges;
}
[StructLayout(LayoutKind.Sequential)]
public struct LUID
{
public PRIVILEGE_CONSTANT LowPart;
public Int32 HighPart;
}
[StructLayout(LayoutKind.Sequential)]
public struct LUID_AND_ATTRIBUTES
{
public LUID Luid;
public UInt32 Attributes;
}
[StructLayout(LayoutKind.Sequential)]
public struct TOKEN_MANDATORY_LABEL
{
public SID_AND_ATTRIBUTES label;
}
[StructLayout(LayoutKind.Sequential)]
// https://docs.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-token_origin
public struct TOKEN_ORIGIN
{
public LUID OriginatingLogonSession;
}
}