From 34b2fcd4cc0c62e1346f3296b7c2f9ddcbd9d635 Mon Sep 17 00:00:00 2001 From: Skull Merlin <86374920+skkuull@users.noreply.github.com> Date: Fri, 18 Mar 2022 02:54:50 +0200 Subject: [PATCH] loader [skip ci] --- src/client/loader/loader.cpp | 7 ++----- src/client/loader/loader.hpp | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/client/loader/loader.cpp b/src/client/loader/loader.cpp index 1bc7b41c..4ec12c7c 100644 --- a/src/client/loader/loader.cpp +++ b/src/client/loader/loader.cpp @@ -31,7 +31,7 @@ FARPROC loader::load(const utils::nt::library& library, const std::string& buffe return FARPROC(library.get_ptr() + source.get_relative_entry_point()); } -FARPROC loader::load_library(const std::string& filename) const +FARPROC loader::load_library(const std::string& filename, uint64_t* base_address) const { const auto target = utils::nt::library::load(filename); if (!target) @@ -40,10 +40,7 @@ FARPROC loader::load_library(const std::string& filename) const } 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)}; - } + *base_address = base; this->load_imports(target, target); this->load_tls(target, target); diff --git a/src/client/loader/loader.hpp b/src/client/loader/loader.hpp index 2c5d86f9..0c0b5a12 100644 --- a/src/client/loader/loader.hpp +++ b/src/client/loader/loader.hpp @@ -5,7 +5,7 @@ class loader final { public: FARPROC load(const utils::nt::library& library, const std::string& buffer) const; - FARPROC load_library(const std::string& filename) const; + FARPROC load_library(const std::string& filename, uint64_t* base_address) const; void set_import_resolver(const std::function& resolver);