auto alloc_key_values_target = reinterpret_cast<void*>(get_virtual(interfaces::key_values_system, 2));
hooks::alloc_key_values::fn alloc_key_values_original = nullptr;
if (MH_CreateHook(alloc_key_values_target, &alloc_key_values::hook, reinterpret_cast<void**>(&alloc_key_values_original)) != MH_OK) {
throw std::runtime_error("inicjowanie alloc_key_values nie powiodło się. (nieaktualny indeks?)");
return false;
}
inline std::uintptr_t RelativeToAbsolute(std::uintptr_t relAddr) noexcept {
return static_cast<std::uintptr_t>(relAddr + 4 + *reinterpret_cast<std::int32_t*>(relAddr));
}
static const std::uintptr_t key_values_engine = RelativeToAbsolute(reinterpret_cast<std::uint32_t>(utilities::p attern_scan("engine.dll", "E8 ? ? ? ? 83 C4 08 84 C0 75 10 FF 75 0C")) + 0x1) + 0x4A;
static const std::uintptr_t key_values_client = RelativeToAbsolute(reinterpret_cast<std::uint32_t>(utilities::p attern_scan("client.dll", "E8 ? ? ? ? 83 C4 08 84 C0 75 10") + 0x1)) + 0x3E;
void* __stdcall hooks::alloc_key_values::hook(const std::int32_t size) {
if (const std::uint32_t address = reinterpret_cast<std::uint32_t>(_ReturnAddress());
Adres == key_values_engine || adres == key_values_client)
return nullptr;
return alloc_key_values_original(interfaces::key_values_system, size);
}