From a2e89fde1acc5b189c55e0b8b38146194e455cd0 Mon Sep 17 00:00:00 2001 From: auth12 <67507608+auth12@users.noreply.github.com> Date: Mon, 27 Jul 2020 09:46:17 -0700 Subject: Removed spdlog, using fmt wrapper instead. More process class changes, support for 32/64bit processes. Injection process improvements. Other small changes. --- client/src/util/util.cpp | 33 ++------------------------------- 1 file changed, 2 insertions(+), 31 deletions(-) (limited to 'client/src/util/util.cpp') diff --git a/client/src/util/util.cpp b/client/src/util/util.cpp index b79f6cd..1847780 100644 --- a/client/src/util/util.cpp +++ b/client/src/util/util.cpp @@ -3,8 +3,6 @@ #include "io.h" #include "syscalls.h" -std::unordered_map util::loaded_modules; - std::string util::wide_to_multibyte(const std::wstring& str) { std::string ret; size_t str_len; @@ -40,36 +38,9 @@ std::wstring util::multibyte_to_wide(const std::string& str) { return out; } - -native::_PEB* util::cur_peb() { - return reinterpret_cast(__readgsqword(0x60)); -} - -bool util::init() { - auto peb = cur_peb(); - if (!peb) return false; - - if (!peb->Ldr->InMemoryOrderModuleList.Flink) return false; - - auto* list = &peb->Ldr->InMemoryOrderModuleList; - - for (auto i = list->Flink; i != list; i = i->Flink) { - auto entry = CONTAINING_RECORD(i, native::LDR_DATA_TABLE_ENTRY, InMemoryOrderLinks); - if (!entry) - continue; - - auto name = wide_to_multibyte(entry->BaseDllName.Buffer); - std::transform(name.begin(), name.end(), name.begin(), ::tolower); - - loaded_modules[name] = pe::virtual_image(entry->DllBase); - } - - return true; -} - bool util::close_handle(HANDLE handle) { if (!handle) { - io::logger->error("invalid handle specified to close."); + io::log_error("invalid handle specified to close."); return false; } @@ -77,7 +48,7 @@ bool util::close_handle(HANDLE handle) { auto status = nt_close(handle); if (!NT_SUCCESS(status)) { - io::logger->error("failed to close {}, status {:#X}.", handle, (status & 0xFFFFFFFF)); + io::log_error("failed to close {}, status {:#X}.", handle, (status & 0xFFFFFFFF)); return false; } -- cgit v1.2.3