-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathNativeAPI.cs
More file actions
22 lines (17 loc) · 839 Bytes
/
NativeAPI.cs
File metadata and controls
22 lines (17 loc) · 839 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
using System;
using System.Runtime.InteropServices;
namespace HookLib
{
internal class NativeAPI
{
private const String KERNEL32 = "kernel32.dll";
[DllImport(KERNEL32, SetLastError = true)]
internal static extern IntPtr GetModuleHandle(string lib);
[DllImport(KERNEL32, SetLastError = true)]
internal static extern IntPtr GetProcAddress(IntPtr Module, string Function);
[DllImport(KERNEL32, SetLastError = true)]
internal static extern bool WriteProcessMemory(IntPtr ProcessHandle, IntPtr Address, byte[] CodeToInject, uint Size, int NumberOfBytes);
[DllImport(KERNEL32, SetLastError = true)]
internal static extern bool ReadProcessMemory(IntPtr ProcHandle, IntPtr BaseAddress, byte[] Buffer, uint size, int NumOfBytes);
}
}