forked from jmsfire/ByPass_BattleEye
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathNatives.cs
executable file
·73 lines (68 loc) · 2.57 KB
/
Natives.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
62
63
64
65
66
67
68
69
70
71
72
73
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace ElevateHandle
{
public static unsafe class NT
{
[DllImport("ntdll.dll", SetLastError = true)]
public static extern uint NtQuerySystemInformation(uint InfoClass, ulong Info, uint Size, out uint Length);
[DllImport("kernel32", SetLastError = true, CharSet = CharSet.Ansi)]
public static extern ulong LoadLibrary([MarshalAs(UnmanagedType.LPStr)]string lpFileName);
[DllImport("kernel32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
public static extern ulong GetProcAddress(ulong hModule, string procName);
[DllImport("ntdll.dll", SetLastError = true)]
public static extern uint RtlGetVersion(_OSVERSIONINFOEXW* lpVersionInformation);
[StructLayout(LayoutKind.Sequential)]
public struct _RTL_PROCESS_MODULES
{
public uint NumberOfModules;
public _RTL_PROCESS_MODULE_INFORMATION Modules;
}
[StructLayout(LayoutKind.Sequential)]
public struct _RTL_PROCESS_MODULE_INFORMATION
{
public void* Section;
public void* MappedBase;
public void* ImageBase;
public uint ImageSize;
public uint Flags;
public ushort LoadOrderIndex;
public ushort InitOrderIndex;
public ushort LoadCount;
public ushort OffsetToFileName;
public fixed sbyte FullPathName[256];
}
[StructLayout(LayoutKind.Sequential)]
public struct ProcessContext
{
public uint ProcessId;
public ulong DirectoryBase;
public ulong KernelEntry;
}
[StructLayout(LayoutKind.Sequential)]
public struct _OSVERSIONINFOEXW
{
public uint dwOSVersionInfoSize;
public uint dwMajorVersion;
public uint dwMinorVersion;
public uint dwBuildNumber;
public uint dwPlatformId;
public fixed byte szCSDVersion[128 * 2/*WCHAR*/]; // Maintenance string for PSS usage
public ushort wServicePackMajor;
public ushort wServicePackMinor;
public ushort wSuiteMask;
public byte wProductType;
public byte wReserved;
}
[StructLayout(LayoutKind.Sequential)]
public struct _HANDLE_TABLE_ENTRY
{
public ulong Object;
public ulong GrantedAccess;
}
}
}