Fix a few things
This commit is contained in:
parent
bd2794be9a
commit
3e34a49d04
12
src/main.cpp
12
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<FARPROC>(function);
|
||||
return self.get_proc<FARPROC>(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();
|
||||
|
13
src/module/security.cpp
Normal file
13
src/module/security.cpp
Normal file
@ -0,0 +1,13 @@
|
||||
#include <std_include.hpp>
|
||||
#include "loader/module_loader.hpp"
|
||||
|
||||
class security final : public module
|
||||
{
|
||||
public:
|
||||
void post_load() override
|
||||
{
|
||||
// TODO: Patch open vulnerabilities
|
||||
}
|
||||
};
|
||||
|
||||
REGISTER_MODULE(security)
|
@ -37,21 +37,21 @@ namespace utils
|
||||
HMODULE get_handle() const;
|
||||
|
||||
template <typename T>
|
||||
T get_proc(const std::string& process)
|
||||
T get_proc(const std::string& process) const
|
||||
{
|
||||
if (!this->is_valid()) T{};
|
||||
return reinterpret_cast<T>(GetProcAddress(this->module_, process.data()));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
std::function<T> get(const std::string& process)
|
||||
std::function<T> get(const std::string& process) const
|
||||
{
|
||||
if (!this->is_valid()) std::function<T>();
|
||||
return reinterpret_cast<T*>(this->get_proc<void*>(process));
|
||||
}
|
||||
|
||||
template <typename T, typename... Args>
|
||||
T invoke(const std::string& process, Args ... args)
|
||||
T invoke(const std::string& process, Args ... args) const
|
||||
{
|
||||
auto method = this->get<T(__cdecl)(Args ...)>(process);
|
||||
if (method) return method(args...);
|
||||
@ -59,7 +59,7 @@ namespace utils
|
||||
}
|
||||
|
||||
template <typename T, typename... Args>
|
||||
T invoke_pascal(const std::string& process, Args ... args)
|
||||
T invoke_pascal(const std::string& process, Args ... args) const
|
||||
{
|
||||
auto method = this->get<T(__stdcall)(Args ...)>(process);
|
||||
if (method) return method(args...);
|
||||
@ -67,9 +67,9 @@ namespace utils
|
||||
}
|
||||
|
||||
template <typename T, typename... Args>
|
||||
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<T(__thiscall)(void*, Args ...)>(thisPtr, process);
|
||||
auto method = this->get<T(__thiscall)(void*, Args ...)>(this_ptr, process);
|
||||
if (method) return method(args...);
|
||||
return T();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user