forked from exotikcheat/Kernel_VADInjector
-
Notifications
You must be signed in to change notification settings - Fork 13
/
sdk.h
63 lines (35 loc) · 1.17 KB
/
sdk.h
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
#pragma once
#include "SharedMemory.h"
PVOID(NTAPI* NtConvertBetweenAuxiliaryCounterAndPerformanceCounterr)(PVOID, PVOID, PVOID, PVOID);
SHORT gCode = 0;
SHORT gStatus = 0;
namespace Client {
void KernelThread(PVOID LParam) {
INT64 Status{ 0 };
CommunicationData Data{ *(CommunicationData*)LParam };
auto DataPtr = &Data;
HMODULE Module{ LoadLibrary("ntdll.dll") };
if (!Module) {
printf("Failed to load ntdll\n");
return;
}
*(PVOID*)&NtConvertBetweenAuxiliaryCounterAndPerformanceCounterr = GetProcAddress(Module, "NtConvertBetweenAuxiliaryCounterAndPerformanceCounter");
NtConvertBetweenAuxiliaryCounterAndPerformanceCounterr(0, &DataPtr, &Status, NULL);
}
void Connect() {
COMM_DATA Data{ 0 };
PVOID Memory{ VirtualAlloc(NULL, 0x1000, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE) };
if (!Memory) {
printf("Failed to alloc memory\n");
return;
}
Data.ProcID = (HANDLE)GetCurrentProcessId();
Data.Arguments = Memory;
Data.Code = &gCode;
Data.Status = &gStatus;
Data.Unique = DATA_UNIQUE;
CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE)KernelThread, &Data, 0, NULL);
Sleep(500);
SharedMemory::Connect(Data);
}
}