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
|
#endif
|
||||||
|
|
||||||
verify_tls();
|
verify_tls();
|
||||||
|
|
||||||
module_loader::post_start();
|
module_loader::post_start();
|
||||||
|
|
||||||
launcher launcher;
|
launcher launcher;
|
||||||
const auto mode = launcher.run();
|
utils::nt::module self;
|
||||||
|
|
||||||
|
const auto mode = launcher.run();
|
||||||
if (mode == launcher::mode::none) return 0;
|
if (mode == launcher::mode::none) return 0;
|
||||||
|
|
||||||
loader loader(mode);
|
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")
|
if (module == "steam_api.dll")
|
||||||
{
|
{
|
||||||
return utils::nt::module().get_proc<FARPROC>(function);
|
return self.get_proc<FARPROC>(function);
|
||||||
}
|
}
|
||||||
else if (function == "ExitProcess")
|
else if (function == "ExitProcess")
|
||||||
{
|
{
|
||||||
@ -72,8 +72,8 @@ int main()
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
});
|
});
|
||||||
|
|
||||||
entry_point = loader.load({});
|
entry_point = loader.load(self);
|
||||||
if (!entry_point) throw std::runtime_error("Unable to load inject binary into memory");
|
if (!entry_point) throw std::runtime_error("Unable to load binary into memory");
|
||||||
|
|
||||||
game::initialize(mode);
|
game::initialize(mode);
|
||||||
module_loader::post_load();
|
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;
|
HMODULE get_handle() const;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T get_proc(const std::string& process)
|
T get_proc(const std::string& process) const
|
||||||
{
|
{
|
||||||
if (!this->is_valid()) T{};
|
if (!this->is_valid()) T{};
|
||||||
return reinterpret_cast<T>(GetProcAddress(this->module_, process.data()));
|
return reinterpret_cast<T>(GetProcAddress(this->module_, process.data()));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
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>();
|
if (!this->is_valid()) std::function<T>();
|
||||||
return reinterpret_cast<T*>(this->get_proc<void*>(process));
|
return reinterpret_cast<T*>(this->get_proc<void*>(process));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, typename... Args>
|
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);
|
auto method = this->get<T(__cdecl)(Args ...)>(process);
|
||||||
if (method) return method(args...);
|
if (method) return method(args...);
|
||||||
@ -59,7 +59,7 @@ namespace utils
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, typename... Args>
|
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);
|
auto method = this->get<T(__stdcall)(Args ...)>(process);
|
||||||
if (method) return method(args...);
|
if (method) return method(args...);
|
||||||
@ -67,9 +67,9 @@ namespace utils
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, typename... Args>
|
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...);
|
if (method) return method(args...);
|
||||||
return T();
|
return T();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user