diff --git a/src/main.cpp b/src/main.cpp index 4a0fc1b..afc91b9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -49,20 +49,20 @@ int main() #endif verify_tls(); - module_loader::post_start(); launcher launcher; - const auto mode = launcher.run(); + utils::nt::module self; + const auto mode = launcher.run(); if (mode == launcher::mode::none) return 0; loader loader(mode); - loader.set_import_resolver([](const std::string& module, const std::string& function) -> FARPROC + loader.set_import_resolver([self](const std::string& module, const std::string& function) -> FARPROC { if (module == "steam_api.dll") { - return utils::nt::module().get_proc(function); + return self.get_proc(function); } else if (function == "ExitProcess") { @@ -72,8 +72,8 @@ int main() return nullptr; }); - entry_point = loader.load({}); - if (!entry_point) throw std::runtime_error("Unable to load inject binary into memory"); + entry_point = loader.load(self); + if (!entry_point) throw std::runtime_error("Unable to load binary into memory"); game::initialize(mode); module_loader::post_load(); diff --git a/src/module/security.cpp b/src/module/security.cpp new file mode 100644 index 0000000..14e35d8 --- /dev/null +++ b/src/module/security.cpp @@ -0,0 +1,13 @@ +#include +#include "loader/module_loader.hpp" + +class security final : public module +{ +public: + void post_load() override + { + // TODO: Patch open vulnerabilities + } +}; + +REGISTER_MODULE(security) diff --git a/src/utils/nt.hpp b/src/utils/nt.hpp index 9c02860..2c8f423 100644 --- a/src/utils/nt.hpp +++ b/src/utils/nt.hpp @@ -37,21 +37,21 @@ namespace utils HMODULE get_handle() const; template - T get_proc(const std::string& process) + T get_proc(const std::string& process) const { if (!this->is_valid()) T{}; return reinterpret_cast(GetProcAddress(this->module_, process.data())); } template - std::function get(const std::string& process) + std::function get(const std::string& process) const { if (!this->is_valid()) std::function(); return reinterpret_cast(this->get_proc(process)); } template - T invoke(const std::string& process, Args ... args) + T invoke(const std::string& process, Args ... args) const { auto method = this->get(process); if (method) return method(args...); @@ -59,7 +59,7 @@ namespace utils } template - T invoke_pascal(const std::string& process, Args ... args) + T invoke_pascal(const std::string& process, Args ... args) const { auto method = this->get(process); if (method) return method(args...); @@ -67,9 +67,9 @@ namespace utils } template - T invoke_this(const std::string& process, void* thisPtr, Args ... args) + T invoke_this(const std::string& process, void* this_ptr, Args ... args) const { - auto method = this->get(thisPtr, process); + auto method = this->get(this_ptr, process); if (method) return method(args...); return T(); }