loader [skip ci]
This commit is contained in:
parent
d2d5fb6654
commit
c998bf633b
@ -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());
|
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);
|
const auto target = utils::nt::library::load(filename);
|
||||||
if (!target)
|
if (!target)
|
||||||
@ -40,10 +40,7 @@ FARPROC loader::load_library(const std::string& filename) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
const auto base = size_t(target.get_ptr());
|
const auto base = size_t(target.get_ptr());
|
||||||
if(base != 0x140000000)
|
*base_address = base;
|
||||||
{
|
|
||||||
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);
|
this->load_imports(target, target);
|
||||||
this->load_tls(target, target);
|
this->load_tls(target, target);
|
||||||
|
@ -5,7 +5,7 @@ class loader final
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FARPROC load(const utils::nt::library& library, const std::string& buffer) const;
|
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<void*(const std::string&, const std::string&)>& resolver);
|
void set_import_resolver(const std::function<void*(const std::string&, const std::string&)>& resolver);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user