Small fixes
This commit is contained in:
parent
e28c72e643
commit
5c2db6e8df
@ -377,39 +377,7 @@ namespace arxan
|
||||
const auto og_data = utils::hook::query_original_data(address, 1);
|
||||
return og_data[0];
|
||||
}
|
||||
|
||||
void patch_check_type_1_xor()
|
||||
{
|
||||
const auto checks = "8B 00 33 45 ??"_sig;
|
||||
for(size_t i = 0; i < checks.count(); ++i)
|
||||
{
|
||||
auto* addr = checks.get(i);
|
||||
|
||||
utils::hook::jump(addr, utils::hook::assemble([addr](utils::hook::assembler& a)
|
||||
{
|
||||
a.push(rax);
|
||||
a.pushad64();
|
||||
|
||||
a.mov(rcx, rax);
|
||||
a.call_aligned(get_integrity_data_dword);
|
||||
|
||||
a.mov(rcx, qword_ptr(rsp, 128));
|
||||
a.movzx(ecx, eax);
|
||||
a.mov(qword_ptr(rsp, 128), rcx);
|
||||
|
||||
a.popad64();
|
||||
a.pop(rax);
|
||||
|
||||
// xor eax, [rbp+??h]
|
||||
a.embedUInt8(addr[3]);
|
||||
a.embedUInt8(addr[4]);
|
||||
a.embedUInt8(addr[5]);
|
||||
|
||||
a.jmp(addr + 5);
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void patch_check_type_1_direct()
|
||||
{
|
||||
auto patch_addr = [](uint8_t* addr)
|
||||
|
@ -97,3 +97,15 @@ size_t operator"" _g(const size_t val)
|
||||
assert(base && "Failed to resolve base");
|
||||
return base + (val - 0x140000000);
|
||||
}
|
||||
|
||||
size_t reverse_g(const size_t val)
|
||||
{
|
||||
static auto base = size_t(utils::nt::library{}.get_ptr());
|
||||
assert(base && "Failed to resolve base");
|
||||
return (val - base) + 0x140000000;
|
||||
}
|
||||
|
||||
size_t reverse_g(const void* val)
|
||||
{
|
||||
return reverse_g(reinterpret_cast<size_t>(val));
|
||||
}
|
||||
|
@ -57,4 +57,6 @@ namespace \
|
||||
static component_loader::installer<name> __component; \
|
||||
}
|
||||
|
||||
size_t operator"" _g(const size_t val);
|
||||
size_t operator"" _g(size_t val);
|
||||
size_t reverse_g(size_t val);
|
||||
size_t reverse_g(const void* val);
|
||||
|
@ -126,7 +126,11 @@ namespace utils::hook
|
||||
{
|
||||
if(!is_relatively_far(address, memory.get_ptr()))
|
||||
{
|
||||
return memory.allocate(size);
|
||||
const auto buffer = memory.allocate(size);
|
||||
if(buffer)
|
||||
{
|
||||
return buffer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user