Redirect component

This commit is contained in:
Federico Cecchetto 2022-05-28 20:36:43 +02:00
parent 3a1421acfb
commit dc852acc30
2 changed files with 9 additions and 3 deletions

View File

@ -1,8 +1,10 @@
#include <std_include.hpp>
#include "loader/component_loader.hpp"
#include "game_module.hpp"
#include <utils/nt.hpp>
#include <utils/string.hpp>
#include "game_module.hpp"
namespace redirect
{
@ -80,4 +82,4 @@ namespace redirect
};
}
//REGISTER_COMPONENT(redirect::component)
REGISTER_COMPONENT(redirect::component)

View File

@ -44,14 +44,18 @@ bool apply_aslr_patch(std::string* data)
{
// mp binary, sp binary
if (data->size() != 0x1B97788 && data->size() != 0x1346D88)
{
return false;
}
auto* dos_header = reinterpret_cast<PIMAGE_DOS_HEADER>(&data->at(0));
auto* nt_headers = reinterpret_cast<PIMAGE_NT_HEADERS>(&data->at(dos_header->e_lfanew));
auto* optional_header = &nt_headers->OptionalHeader;
if (optional_header->DllCharacteristics & IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE)
{
optional_header->DllCharacteristics &= ~(IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE);
}
return true;
}