|
|
|
@ -54,7 +54,7 @@ namespace drv
|
|
|
|
|
return { {}, {} };
|
|
|
|
|
|
|
|
|
|
resolve_imports(image_mapped);
|
|
|
|
|
fix_relocs(image_mapped);
|
|
|
|
|
fix_relocs(image_mapped, alloc_base);
|
|
|
|
|
|
|
|
|
|
if (zero_headers)
|
|
|
|
|
{
|
|
|
|
@ -83,7 +83,7 @@ namespace drv
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
auto hmdm_ctx::fix_relocs(drv_buffer_t& drv_buffer) const -> void
|
|
|
|
|
auto hmdm_ctx::fix_relocs(drv_buffer_t& drv_buffer, uint8_t* alloc_base) const -> void
|
|
|
|
|
{
|
|
|
|
|
const auto dos_header =
|
|
|
|
|
reinterpret_cast<PIMAGE_DOS_HEADER>(drv_buffer.data());
|
|
|
|
@ -128,7 +128,7 @@ namespace drv
|
|
|
|
|
const auto rva = reinterpret_cast<std::uintptr_t*>(reloc_base + offset);
|
|
|
|
|
|
|
|
|
|
*rva = reinterpret_cast<std::uintptr_t>(
|
|
|
|
|
drv_buffer.data() + (*rva - nt_header->OptionalHeader.ImageBase));
|
|
|
|
|
alloc_base + (*rva - nt_header->OptionalHeader.ImageBase));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|