lib for 3.3

This commit is contained in:
HolographicHat
2022-12-07 12:13:27 +08:00
parent 349e15fe25
commit e2f1f1e343
6 changed files with 38 additions and 24 deletions

View File

@@ -1,6 +1,17 @@
#include "pch.h"
#include "util.h"
VOID DisableVMProtect() {
DWORD oldProtect = 0;
auto ntdll = GetModuleHandleA("ntdll.dll");
BYTE callcode = ((BYTE*)GetProcAddress(ntdll, "NtQuerySection"))[4] - 1;
BYTE restore[] = { 0x4C, 0x8B, 0xD1, 0xB8, callcode };
auto nt_vp = (BYTE*)GetProcAddress(ntdll, "NtProtectVirtualMemory");
VirtualProtect(nt_vp, sizeof(restore), PAGE_EXECUTE_READWRITE, &oldProtect);
memcpy(nt_vp, restore, sizeof(restore));
VirtualProtect(nt_vp, sizeof(restore), oldProtect, &oldProtect);
}
#pragma region StringConvert
string IlStringToString(Il2CppString* str, UINT codePage) {