Verify mapped binary base #221

This commit is contained in:
Maurice Heumann 2021-06-13 08:56:55 +02:00
parent 56633a8dcc
commit 091176d85d

View File

@ -36,7 +36,13 @@ FARPROC loader::load_library(const std::string& filename) const
const auto target = utils::nt::library::load(filename);
if (!target)
{
throw std::runtime_error("Failed to map binary!");
throw std::runtime_error{"Failed to map binary!"};
}
const auto base = size_t(target.get_ptr());
if(base != 0x140000000)
{
throw std::runtime_error{utils::string::va("Binary was mapped at 0x%llX (instead of 0x%llX). Something is severely broken :(", base, 0x140000000)};
}
this->load_imports(target, target);