aboutsummaryrefslogtreecommitdiff
path: root/client/src/injection
diff options
context:
space:
mode:
authorauth12 <[email protected]>2020-08-05 03:17:00 +0100
committerauth12 <[email protected]>2020-08-05 03:17:00 +0100
commit6b11856dbd89628ab198820c7dd1f117077a5420 (patch)
treed34ddff8f3658956b5c435a33c2829208ab2fc4f /client/src/injection
parentAdded ui. (diff)
downloadloader-6b11856dbd89628ab198820c7dd1f117077a5420.tar.xz
loader-6b11856dbd89628ab198820c7dd1f117077a5420.zip
More ui improvements.
Under the hood improvements.
Diffstat (limited to 'client/src/injection')
-rw-r--r--client/src/injection/mapper.cpp21
-rw-r--r--client/src/injection/pe.h5
-rw-r--r--client/src/injection/process.cpp2
3 files changed, 19 insertions, 9 deletions
diff --git a/client/src/injection/mapper.cpp b/client/src/injection/mapper.cpp
index 732395d..4821350 100644
--- a/client/src/injection/mapper.cpp
+++ b/client/src/injection/mapper.cpp
@@ -5,10 +5,6 @@
#include "mapper.h"
void mmap::thread(tcp::client& client) {
- while (!client) {
- std::this_thread::sleep_for(std::chrono::microseconds(100));
- }
-
while (client) {
if (client.state != tcp::client_state::imports_ready) {
std::this_thread::sleep_for(std::chrono::seconds(5));
@@ -27,6 +23,8 @@ void mmap::thread(tcp::client& client) {
}
void mmap::map32(tcp::client& client) {
+ client.state = tcp::client_state::waiting;
+
std::vector<util::process_data_t> dat;
if (!util::fetch_processes(dat)) {
io::log_error("failed to fetch processes.");
@@ -39,6 +37,7 @@ void mmap::map32(tcp::client& client) {
});
io::log("waiting for {}.", client.selected_game.process_name);
+
while (needle == dat.end()) {
std::this_thread::sleep_for(std::chrono::seconds(5));
if (!client) {
@@ -89,7 +88,11 @@ void mmap::map32(tcp::client& client) {
for (auto& i : value) {
auto name = i.get<std::string>();
- final_imports[name] = proc.module_export(proc.map(key), name);
+ auto addr = proc.module_export(proc.map(key), name);
+
+ io::log("{}->{}->{:x}", key, name, addr);
+
+ final_imports[name] = addr;;
}
}
imports.clear();
@@ -157,6 +160,8 @@ void mmap::map32(tcp::client& client) {
}
void mmap::map64(tcp::client& client) {
+ client.state = tcp::client_state::waiting;
+
std::vector<util::process_data_t> dat;
if (!util::fetch_processes(dat)) {
io::log_error("failed to fetch processes.");
@@ -222,7 +227,11 @@ void mmap::map64(tcp::client& client) {
for (auto& i : value) {
auto name = i.get<std::string>();
- final_imports[name] = proc.module_export(proc.map(key), name);
+ auto addr = proc.module_export(proc.map(key), name);
+
+ io::log("{}->{}->{:x}", key, name, addr);
+
+ final_imports[name] = addr;
}
}
imports.clear();
diff --git a/client/src/injection/pe.h b/client/src/injection/pe.h
index fab41bb..6d2b655 100644
--- a/client/src/injection/pe.h
+++ b/client/src/injection/pe.h
@@ -79,6 +79,7 @@ namespace pe {
size_t v_size;
uint32_t rva;
uint32_t va;
+ uint32_t characteristics;
};
class virtual_image {
@@ -129,9 +130,9 @@ namespace pe {
for (size_t i = 0; i < n; i++) {
auto sec = secs[i];
-
+
auto name = reinterpret_cast<const char*>(sec.Name);
- m_sections.emplace_back(section_t{ name, sec.SizeOfRawData, sec.Misc.VirtualSize, sec.PointerToRawData, sec.VirtualAddress });
+ m_sections.emplace_back(section_t{ name, sec.SizeOfRawData, sec.Misc.VirtualSize, sec.PointerToRawData, sec.VirtualAddress, sec.Characteristics });
}
};
diff --git a/client/src/injection/process.cpp b/client/src/injection/process.cpp
index 3f3c96e..c37e131 100644
--- a/client/src/injection/process.cpp
+++ b/client/src/injection/process.cpp
@@ -332,7 +332,7 @@ uintptr_t util::process<T>::map(const std::string_view module_name) {
for (auto& func : funcs) {
auto addr = module_export(map(mod), func.name);
- //io::log("{}:{}->{:x}", mod, func.name, addr);
+ io::log("[mapper] {}->{}->{:x}", mod, func.name, addr);
*reinterpret_cast<T*>(&remote_image[func.rva]) = addr;
}