Small fixes

This commit is contained in:
momo5502 2022-05-30 19:06:59 +02:00
parent 95df5bc91e
commit 4097ed37d5
3 changed files with 10 additions and 7 deletions

View File

@ -60,6 +60,9 @@ namespace arxan
L"HxD", L"HxD",
L"cheatengine", L"cheatengine",
L"Cheat Engine", L"Cheat Engine",
L"x96dbg",
L"x32dbg",
L"x64dbg",
}; };
if (!string.Buffer || !string.Length) if (!string.Buffer || !string.Length)

View File

@ -20,7 +20,6 @@ namespace console
public: public:
void post_unpack() override void post_unpack() override
{ {
this->terminate_runner_ = false; this->terminate_runner_ = false;
this->console_runner_ = utils::thread::create_named_thread("Console IO", [this] this->console_runner_ = utils::thread::create_named_thread("Console IO", [this]

View File

@ -101,6 +101,7 @@ namespace
{ {
public: public:
patch() = default; patch() = default;
patch(void* source, void* target) patch(void* source, void* target)
: source_(source) : source_(source)
{ {
@ -138,7 +139,7 @@ namespace
} }
private: private:
void* source_{ nullptr }; void* source_{nullptr};
uint8_t data_[15]{}; uint8_t data_[15]{};
}; };
@ -154,7 +155,7 @@ namespace
{ {
const utils::nt::library game{}; const utils::nt::library game{};
const auto& entry = game.get_optional_header()->DataDirectory[IMAGE_DIRECTORY_ENTRY_TLS]; const auto& entry = game.get_optional_header()->DataDirectory[IMAGE_DIRECTORY_ENTRY_TLS];
if(!entry.VirtualAddress || !entry.Size) if (!entry.VirtualAddress || !entry.Size)
{ {
return {}; return {};
} }
@ -163,7 +164,7 @@ namespace
auto* callback = reinterpret_cast<uint8_t**>(tls_dir->AddressOfCallBacks); auto* callback = reinterpret_cast<uint8_t**>(tls_dir->AddressOfCallBacks);
std::vector<uint8_t*> addresses{}; std::vector<uint8_t*> addresses{};
while(callback && *callback) while (callback && *callback)
{ {
addresses.emplace_back(*callback); addresses.emplace_back(*callback);
++callback; ++callback;
@ -174,7 +175,7 @@ namespace
int patch_main() int patch_main()
{ {
if(!run()) if (!run())
{ {
return 1; return 1;
} }
@ -185,14 +186,14 @@ namespace
void nullsub() void nullsub()
{ {
} }
void patch_entry_point() void patch_entry_point()
{ {
initialization_hooks.emplace_back(get_entry_point(), patch_main); initialization_hooks.emplace_back(get_entry_point(), patch_main);
for(auto* tls_callback : get_tls_callbacks()) { for (auto* tls_callback : get_tls_callbacks())
{
initialization_hooks.emplace_back(tls_callback, nullsub); initialization_hooks.emplace_back(tls_callback, nullsub);
} }
} }