structural changes
This commit is contained in:
parent
55553a4099
commit
e584075243
@ -1,8 +1,8 @@
|
||||
#include <std_include.hpp>
|
||||
#include "loader/component_loader.hpp"
|
||||
|
||||
#include <utils/hook.hpp>
|
||||
#include <utils/string.hpp>
|
||||
#include <utilities/hook.hpp>
|
||||
#include <utilities/string.hpp>
|
||||
|
||||
|
||||
namespace arxan
|
||||
@ -15,7 +15,7 @@ namespace arxan
|
||||
{
|
||||
std::vector<std::pair<uint8_t*, size_t>> texts{};
|
||||
|
||||
const utils::nt::library game{};
|
||||
const utilities::nt::library game{};
|
||||
for (const auto& section : game.get_section_headers())
|
||||
{
|
||||
if (section->Characteristics & IMAGE_SCN_MEM_EXECUTE)
|
||||
@ -95,7 +95,7 @@ namespace arxan
|
||||
|
||||
if (!context)
|
||||
{
|
||||
MessageBoxA(nullptr, utils::string::va("No frame offset for: %llX", handler_address), "Error",
|
||||
MessageBoxA(nullptr, utilities::string::va("No frame offset for: %llX", handler_address), "Error",
|
||||
MB_ICONERROR);
|
||||
TerminateProcess(GetCurrentProcess(), 0xBAD);
|
||||
return current_checksum;
|
||||
@ -125,11 +125,11 @@ namespace arxan
|
||||
|
||||
if ((next_inst & 0xFF00FFFF) != 0xFF004583)
|
||||
{
|
||||
throw std::runtime_error(utils::string::va("Unable to patch intact basic block: %llX", game_address));
|
||||
throw std::runtime_error(utilities::string::va("Unable to patch intact basic block: %llX", game_address));
|
||||
}
|
||||
|
||||
const auto other_frame_offset = static_cast<uint8_t>(next_inst >> 16);
|
||||
static const auto stub = utils::hook::assemble([](utils::hook::assembler& a)
|
||||
static const auto stub = utilities::hook::assemble([](utilities::hook::assembler& a)
|
||||
{
|
||||
a.push(rax);
|
||||
|
||||
@ -164,8 +164,8 @@ namespace arxan
|
||||
});
|
||||
|
||||
// push other_frame_offset
|
||||
utils::hook::set<uint16_t>(game_address, static_cast<uint16_t>(0x6A | (other_frame_offset << 8)));
|
||||
utils::hook::call(game_address + 2, stub);
|
||||
utilities::hook::set<uint16_t>(game_address, static_cast<uint16_t>(0x6A | (other_frame_offset << 8)));
|
||||
utilities::hook::call(game_address + 2, stub);
|
||||
}
|
||||
|
||||
void patch_split_basic_block_integrity_check(void* address)
|
||||
@ -177,11 +177,11 @@ namespace arxan
|
||||
|
||||
if (*reinterpret_cast<uint8_t*>(next_inst_addr) != 0xE9)
|
||||
{
|
||||
throw std::runtime_error(utils::string::va("Unable to patch split basic block: %llX", game_address));
|
||||
throw std::runtime_error(utilities::string::va("Unable to patch split basic block: %llX", game_address));
|
||||
}
|
||||
|
||||
const auto jump_target = utils::hook::extract<void*>(reinterpret_cast<void*>(next_inst_addr + 1));
|
||||
const auto stub = utils::hook::assemble([jump_target](utils::hook::assembler& a)
|
||||
const auto jump_target = utilities::hook::extract<void*>(reinterpret_cast<void*>(next_inst_addr + 1));
|
||||
const auto stub = utilities::hook::assemble([jump_target](utilities::hook::assembler& a)
|
||||
{
|
||||
a.push(rax);
|
||||
|
||||
@ -209,7 +209,7 @@ namespace arxan
|
||||
a.jmp(jump_target);
|
||||
});
|
||||
|
||||
utils::hook::call(game_address, stub);
|
||||
utilities::hook::call(game_address, stub);
|
||||
}
|
||||
|
||||
void search_and_patch_integrity_checks()
|
||||
@ -235,7 +235,7 @@ namespace arxan
|
||||
|
||||
void** get_tls_callbacks()
|
||||
{
|
||||
const utils::nt::library game{};
|
||||
const utilities::nt::library game{};
|
||||
const auto& entry = game.get_optional_header()->DataDirectory[IMAGE_DIRECTORY_ENTRY_TLS];
|
||||
if (!entry.VirtualAddress || !entry.Size)
|
||||
{
|
||||
@ -254,7 +254,7 @@ namespace arxan
|
||||
original_first_tls_callback = *tls_callbacks;
|
||||
}
|
||||
|
||||
utils::hook::set(tls_callbacks, nullptr);
|
||||
utilities::hook::set(tls_callbacks, nullptr);
|
||||
}
|
||||
|
||||
void restore_tls_callbacks()
|
||||
@ -262,17 +262,17 @@ namespace arxan
|
||||
auto* tls_callbacks = get_tls_callbacks();
|
||||
if (tls_callbacks)
|
||||
{
|
||||
utils::hook::set(tls_callbacks, original_first_tls_callback);
|
||||
utilities::hook::set(tls_callbacks, original_first_tls_callback);
|
||||
}
|
||||
}
|
||||
|
||||
utils::hook::detour create_thread_hook;
|
||||
utilities::hook::detour create_thread_hook;
|
||||
HANDLE WINAPI create_thread_stub(const LPSECURITY_ATTRIBUTES thread_attributes, const SIZE_T stack_size,
|
||||
const LPTHREAD_START_ROUTINE start_address, const LPVOID parameter,
|
||||
const DWORD creation_flags,
|
||||
const LPDWORD thread_id)
|
||||
{
|
||||
if (utils::nt::library::get_by_address(start_address) == utils::nt::library{})
|
||||
if (utilities::nt::library::get_by_address(start_address) == utilities::nt::library{})
|
||||
{
|
||||
restore_tls_callbacks();
|
||||
|
||||
@ -285,15 +285,15 @@ namespace arxan
|
||||
creation_flags, thread_id);
|
||||
}
|
||||
|
||||
utils::hook::detour get_thread_context_hook;
|
||||
utilities::hook::detour get_thread_context_hook;
|
||||
BOOL WINAPI get_thread_context_stub(const HANDLE thread_handle, const LPCONTEXT context)
|
||||
{
|
||||
constexpr auto debug_registers_flag = (CONTEXT_DEBUG_REGISTERS & ~CONTEXT_AMD64);
|
||||
if (context && (context->ContextFlags & debug_registers_flag))
|
||||
{
|
||||
auto* source = _ReturnAddress();
|
||||
const auto game = utils::nt::library{};
|
||||
const auto source_module = utils::nt::library::get_by_address(source);
|
||||
const auto game = utilities::nt::library{};
|
||||
const auto source_module = utilities::nt::library::get_by_address(source);
|
||||
|
||||
if (source_module == game)
|
||||
{
|
||||
@ -304,7 +304,7 @@ namespace arxan
|
||||
return get_thread_context_hook.invoke<BOOL>(thread_handle, context);
|
||||
}
|
||||
|
||||
utils::hook::detour create_mutex_ex_a_hook;
|
||||
utilities::hook::detour create_mutex_ex_a_hook;
|
||||
HANDLE create_mutex_ex_a_stub(const LPSECURITY_ATTRIBUTES attributes, const LPCSTR name, const DWORD flags,
|
||||
const DWORD access)
|
||||
{
|
||||
@ -405,7 +405,7 @@ namespace arxan
|
||||
return res;
|
||||
}
|
||||
|
||||
utils::hook::detour nt_query_system_information_hook;
|
||||
utilities::hook::detour nt_query_system_information_hook;
|
||||
NTSTATUS NTAPI nt_query_system_information_stub(const SYSTEM_INFORMATION_CLASS system_information_class,
|
||||
const PVOID system_information,
|
||||
const ULONG system_information_length,
|
||||
@ -416,7 +416,7 @@ namespace arxan
|
||||
|
||||
if (NT_SUCCESS(status))
|
||||
{
|
||||
if (system_information_class == SystemProcessInformation && !utils::nt::is_shutdown_in_progress())
|
||||
if (system_information_class == SystemProcessInformation && !utilities::nt::is_shutdown_in_progress())
|
||||
{
|
||||
auto addr = static_cast<uint8_t*>(system_information);
|
||||
while (true)
|
||||
@ -437,7 +437,7 @@ namespace arxan
|
||||
return status;
|
||||
}
|
||||
|
||||
utils::hook::detour nt_query_information_process_hook;
|
||||
utilities::hook::detour nt_query_information_process_hook;
|
||||
NTSTATUS WINAPI nt_query_information_process_stub(const HANDLE handle, const PROCESSINFOCLASS info_class,
|
||||
const PVOID info,
|
||||
const ULONG info_length, const PULONG ret_length)
|
||||
@ -465,16 +465,16 @@ namespace arxan
|
||||
disable_tls_callbacks();
|
||||
|
||||
create_thread_hook.create(CreateThread, create_thread_stub);
|
||||
auto* get_thread_context_func = utils::nt::library("kernelbase.dll").get_proc<void*>("GetThreadContext");
|
||||
auto* get_thread_context_func = utilities::nt::library("kernelbase.dll").get_proc<void*>("GetThreadContext");
|
||||
get_thread_context_hook.create(get_thread_context_func, get_thread_context_stub);
|
||||
|
||||
create_mutex_ex_a_hook.create(CreateMutexExA, create_mutex_ex_a_stub);
|
||||
|
||||
utils::hook::copy(this->window_text_buffer_, GetWindowTextA, sizeof(this->window_text_buffer_));
|
||||
utils::hook::jump(GetWindowTextA, get_window_text_a_stub, true, true);
|
||||
utils::hook::move_hook(GetWindowTextA);
|
||||
utilities::hook::copy(this->window_text_buffer_, GetWindowTextA, sizeof(this->window_text_buffer_));
|
||||
utilities::hook::jump(GetWindowTextA, get_window_text_a_stub, true, true);
|
||||
utilities::hook::move_hook(GetWindowTextA);
|
||||
|
||||
const utils::nt::library ntdll("ntdll.dll");
|
||||
const utilities::nt::library ntdll("ntdll.dll");
|
||||
|
||||
const auto nt_query_information_process = ntdll.get_proc<void*>("NtQueryInformationProcess");
|
||||
nt_query_information_process_hook.create(nt_query_information_process,
|
||||
|
@ -2,11 +2,11 @@
|
||||
#include "definitions/game.hpp"
|
||||
#include "loader/component_loader.hpp"
|
||||
|
||||
#include <utils/hook.hpp>
|
||||
#include <utils/io.hpp>
|
||||
#include <utils/string.hpp>
|
||||
#include <utils/thread.hpp>
|
||||
#include <utils/compression.hpp>
|
||||
#include <utilities/hook.hpp>
|
||||
#include <utilities/io.hpp>
|
||||
#include <utilities/string.hpp>
|
||||
#include <utilities/thread.hpp>
|
||||
#include <utilities/compression.hpp>
|
||||
#include <exception/minidump.hpp>
|
||||
|
||||
namespace blackbox
|
||||
@ -64,12 +64,12 @@ namespace blackbox
|
||||
|
||||
void display_error_dialog()
|
||||
{
|
||||
const std::string error_str = utils::string::va("Fatal error (0x%08X) at 0x%p (0x%p).\n"
|
||||
const std::string error_str = utilities::string::va("Fatal error (0x%08X) at 0x%p (0x%p).\n"
|
||||
"A minidump has been written.\n",
|
||||
exception_data.code, exception_data.address,
|
||||
reverse_b(reinterpret_cast<uint64_t>(exception_data.address)));
|
||||
|
||||
utils::thread::suspend_other_threads();
|
||||
utilities::thread::suspend_other_threads();
|
||||
show_mouse_cursor();
|
||||
|
||||
MessageBoxA(nullptr, error_str.data(), "Project-BO4 ERROR", MB_ICONERROR);
|
||||
@ -98,7 +98,7 @@ namespace blackbox
|
||||
|
||||
size_t get_reset_state_stub()
|
||||
{
|
||||
static auto* stub = utils::hook::assemble([](utils::hook::assembler& a)
|
||||
static auto* stub = utilities::hook::assemble([](utilities::hook::assembler& a)
|
||||
{
|
||||
a.sub(rsp, 0x10);
|
||||
a.or_(rsp, 0x8);
|
||||
@ -165,7 +165,7 @@ namespace blackbox
|
||||
|
||||
const auto x64register = [®isters_scroll](const char* key, DWORD64 value)
|
||||
{
|
||||
registers_scroll.append(utils::string::va("\t%s = 0x%llX\r\n", key, value));
|
||||
registers_scroll.append(utilities::string::va("\t%s = 0x%llX\r\n", key, value));
|
||||
};
|
||||
|
||||
x64register("rax", ctx->Rax);
|
||||
@ -205,7 +205,7 @@ namespace blackbox
|
||||
|
||||
for (size_t i = exception_start_index; i < count; i++)
|
||||
{
|
||||
const auto from = utils::nt::library::get_by_address(backtrace_stack[i]);
|
||||
const auto from = utilities::nt::library::get_by_address(backtrace_stack[i]);
|
||||
size_t rva = reinterpret_cast<uint64_t>(backtrace_stack[i]) - reinterpret_cast<uint64_t>(from.get_ptr());
|
||||
|
||||
if (from.get_name() == "BlackOps4.exe"s) rva += 0x140000000;
|
||||
@ -219,7 +219,7 @@ namespace blackbox
|
||||
std::string generate_crash_info(const LPEXCEPTION_POINTERS exceptioninfo)
|
||||
{
|
||||
const auto& build_info = game::version_string;
|
||||
const auto main_module = utils::nt::library{};
|
||||
const auto main_module = utilities::nt::library{};
|
||||
const auto rip_address = exceptioninfo->ExceptionRecord->ExceptionAddress;
|
||||
|
||||
std::string info{};
|
||||
@ -231,16 +231,16 @@ namespace blackbox
|
||||
|
||||
line(build_info + " Crash Report\r\n");
|
||||
|
||||
line(utils::string::va("Exception Code: 0x%08X(%s)", exceptioninfo->ExceptionRecord->ExceptionCode,
|
||||
line(utilities::string::va("Exception Code: 0x%08X(%s)", exceptioninfo->ExceptionRecord->ExceptionCode,
|
||||
get_exception_string(exceptioninfo->ExceptionRecord->ExceptionCode)));
|
||||
line(utils::string::va("Exception Addr: 0x%llX[%s]", exceptioninfo->ExceptionRecord->ExceptionAddress,
|
||||
utils::nt::library::get_by_address(exceptioninfo->ExceptionRecord->ExceptionAddress).get_name().c_str()));
|
||||
line(utils::string::va("Main Module: %s[0x%llX]", main_module.get_name().c_str(), main_module.get_ptr()));
|
||||
line(utils::string::va("Thread ID: %d(%s)", GetCurrentThreadId(), is_game_thread() ? "Main Thread" : "Auxiliary Threads"));
|
||||
line(utilities::string::va("Exception Addr: 0x%llX[%s]", exceptioninfo->ExceptionRecord->ExceptionAddress,
|
||||
utilities::nt::library::get_by_address(exceptioninfo->ExceptionRecord->ExceptionAddress).get_name().c_str()));
|
||||
line(utilities::string::va("Main Module: %s[0x%llX]", main_module.get_name().c_str(), main_module.get_ptr()));
|
||||
line(utilities::string::va("Thread ID: %d(%s)", GetCurrentThreadId(), is_game_thread() ? "Main Thread" : "Auxiliary Threads"));
|
||||
|
||||
if (exceptioninfo->ExceptionRecord->ExceptionCode == EXCEPTION_ACCESS_VIOLATION)
|
||||
{
|
||||
line(utils::string::va("\r\nExtended Info: Attempted to %s 0x%012X",
|
||||
line(utilities::string::va("\r\nExtended Info: Attempted to %s 0x%012X",
|
||||
exceptioninfo->ExceptionRecord->ExceptionInformation[0] == 1 ? "write to" : "read from",
|
||||
exceptioninfo->ExceptionRecord->ExceptionInformation[1]));
|
||||
}
|
||||
@ -256,10 +256,10 @@ namespace blackbox
|
||||
|
||||
void write_minidump(const LPEXCEPTION_POINTERS exceptioninfo)
|
||||
{
|
||||
const std::string crash_name = utils::string::va("minidumps/shield-crash-%s.zip",
|
||||
const std::string crash_name = utilities::string::va("minidumps/shield-crash-%s.zip",
|
||||
get_timestamp().data());
|
||||
|
||||
utils::compression::zip::archive zip_file{};
|
||||
utilities::compression::zip::archive zip_file{};
|
||||
zip_file.add("crash.dmp", exception::create_minidump(exceptioninfo));
|
||||
zip_file.add("info.txt", generate_crash_info(exceptioninfo));
|
||||
zip_file.write(crash_name, "Project-bo4 Crash Dump");
|
||||
@ -304,11 +304,11 @@ namespace blackbox
|
||||
|
||||
void pre_start() override
|
||||
{
|
||||
const utils::nt::library ntdll("ntdll.dll");
|
||||
const utilities::nt::library ntdll("ntdll.dll");
|
||||
auto* set_filter = ntdll.get_proc<void(*)(LPTOP_LEVEL_EXCEPTION_FILTER)>("RtlSetUnhandledExceptionFilter");
|
||||
|
||||
set_filter(exception_filter);
|
||||
utils::hook::jump(set_filter, set_unhandled_exception_filter_stub);
|
||||
utilities::hook::jump(set_filter, set_unhandled_exception_filter_stub);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include "component/scheduler.hpp"
|
||||
#include "loader/component_loader.hpp"
|
||||
|
||||
#include <utils/string.hpp>
|
||||
#include <utilities/string.hpp>
|
||||
|
||||
namespace debugging
|
||||
{
|
||||
@ -29,7 +29,7 @@ namespace debugging
|
||||
|
||||
connectionInfoString[42] = NULL;
|
||||
|
||||
return utils::string::va("%s", connectionInfoString);
|
||||
return utilities::string::va("%s", connectionInfoString);
|
||||
}
|
||||
|
||||
void draw_debug_info()
|
||||
|
@ -1,9 +1,9 @@
|
||||
#include <std_include.hpp>
|
||||
#include "loader/component_loader.hpp"
|
||||
|
||||
#include <utils/io.hpp>
|
||||
#include <utils/hook.hpp>
|
||||
#include <utils/thread.hpp>
|
||||
#include <utilities/io.hpp>
|
||||
#include <utilities/hook.hpp>
|
||||
#include <utilities/thread.hpp>
|
||||
|
||||
#include "demonware/servers/lobby_server.hpp"
|
||||
#include "demonware/servers/auth3_server.hpp"
|
||||
@ -31,8 +31,8 @@ namespace demonware
|
||||
{
|
||||
std::atomic_bool exit_server{ false };
|
||||
std::thread server_thread{};
|
||||
utils::concurrency::container<std::unordered_map<SOCKET, bool>> blocking_sockets{};
|
||||
utils::concurrency::container<std::unordered_map<SOCKET, tcp_server*>> socket_map{};
|
||||
utilities::concurrency::container<std::unordered_map<SOCKET, bool>> blocking_sockets{};
|
||||
utilities::concurrency::container<std::unordered_map<SOCKET, tcp_server*>> socket_map{};
|
||||
server_registry<tcp_server> tcp_servers{};
|
||||
server_registry<udp_server> udp_servers{};
|
||||
std::unordered_map<void*, void*> original_imports{};
|
||||
@ -153,8 +153,8 @@ namespace demonware
|
||||
return getaddrinfo(name, service, hints, res);
|
||||
}
|
||||
|
||||
const auto address = utils::memory::get_allocator()->allocate<sockaddr>();
|
||||
const auto ai = utils::memory::get_allocator()->allocate<addrinfo>();
|
||||
const auto address = utilities::memory::get_allocator()->allocate<sockaddr>();
|
||||
const auto ai = utilities::memory::get_allocator()->allocate<addrinfo>();
|
||||
|
||||
auto in_addr = reinterpret_cast<sockaddr_in*>(address);
|
||||
in_addr->sin_addr.s_addr = server->get_address();
|
||||
@ -176,13 +176,13 @@ namespace demonware
|
||||
|
||||
void freeaddrinfo_stub(addrinfo* ai)
|
||||
{
|
||||
if (!utils::memory::get_allocator()->find(ai))
|
||||
if (!utilities::memory::get_allocator()->find(ai))
|
||||
{
|
||||
return freeaddrinfo(ai);
|
||||
}
|
||||
|
||||
utils::memory::get_allocator()->free(ai->ai_addr);
|
||||
utils::memory::get_allocator()->free(ai);
|
||||
utilities::memory::get_allocator()->free(ai->ai_addr);
|
||||
utilities::memory::get_allocator()->free(ai);
|
||||
}
|
||||
|
||||
int getpeername_stub(const SOCKET s, sockaddr* addr, socklen_t* addrlen)
|
||||
@ -440,11 +440,11 @@ namespace demonware
|
||||
|
||||
void register_hook(const std::string& process, void* stub)
|
||||
{
|
||||
const utils::nt::library game_module{};
|
||||
const utilities::nt::library game_module{};
|
||||
|
||||
std::optional<std::pair<void*, void*>> result{};
|
||||
if (!result) result = utils::hook::iat(game_module, "wsock32.dll", process, stub);
|
||||
if (!result) result = utils::hook::iat(game_module, "WS2_32.dll", process, stub);
|
||||
if (!result) result = utilities::hook::iat(game_module, "wsock32.dll", process, stub);
|
||||
if (!result) result = utilities::hook::iat(game_module, "WS2_32.dll", process, stub);
|
||||
|
||||
if (!result)
|
||||
{
|
||||
@ -456,7 +456,7 @@ namespace demonware
|
||||
|
||||
void check_lpc_files()
|
||||
{
|
||||
if (!utils::io::file_exists("LPC/.manifest") || !utils::io::file_exists("LPC/core_ffotd_tu23_639_cf92ecf4a75d3f79.ff") || !utils::io::file_exists("LPC/core_playlists_tu23_639_cf92ecf4a75d3f79.ff"))
|
||||
if (!utilities::io::file_exists("LPC/.manifest") || !utilities::io::file_exists("LPC/core_ffotd_tu23_639_cf92ecf4a75d3f79.ff") || !utilities::io::file_exists("LPC/core_playlists_tu23_639_cf92ecf4a75d3f79.ff"))
|
||||
{
|
||||
MessageBoxA(nullptr, "some required LPC files seems to be missing. You need to get and place them manually since this emulator doesnt host and provide those files; read instructions in github documentation for more info.",
|
||||
"LPC Files Missing", MB_ICONERROR);
|
||||
@ -500,18 +500,18 @@ namespace demonware
|
||||
|
||||
void post_unpack() override
|
||||
{
|
||||
server_thread = utils::thread::create_named_thread("Demonware", server_main);
|
||||
server_thread = utilities::thread::create_named_thread("Demonware", server_main);
|
||||
|
||||
utils::hook::set<uint8_t>(0x144508469_g, 0x0); // CURLOPT_SSL_VERIFYPEER
|
||||
utils::hook::set<uint8_t>(0x144508455_g, 0xAF); // CURLOPT_SSL_VERIFYHOST
|
||||
utils::hook::set<uint8_t>(0x144B28D98_g, 0x0); // HTTPS -> HTTP
|
||||
utilities::hook::set<uint8_t>(0x144508469_g, 0x0); // CURLOPT_SSL_VERIFYPEER
|
||||
utilities::hook::set<uint8_t>(0x144508455_g, 0xAF); // CURLOPT_SSL_VERIFYHOST
|
||||
utilities::hook::set<uint8_t>(0x144B28D98_g, 0x0); // HTTPS -> HTTP
|
||||
|
||||
utils::hook::copy_string(0x144A27C70_g, "http://prod.umbrella.demonware.net");
|
||||
utils::hook::copy_string(0x144A2BAA0_g, "http://prod.uno.demonware.net/v1.0");
|
||||
utils::hook::copy_string(0x144A29CB0_g, "http://%s:%d/auth/");
|
||||
utilities::hook::copy_string(0x144A27C70_g, "http://prod.umbrella.demonware.net");
|
||||
utilities::hook::copy_string(0x144A2BAA0_g, "http://prod.uno.demonware.net/v1.0");
|
||||
utilities::hook::copy_string(0x144A29CB0_g, "http://%s:%d/auth/");
|
||||
|
||||
utils::hook::set(0x142DD0E10_g, 0xC301B0); // Live_Qos_Finished
|
||||
utils::hook::set(0x1438C2C70_g, 0xC301B0); // Live_Contracts? related to bdUNK125
|
||||
utilities::hook::set(0x142DD0E10_g, 0xC301B0); // Live_Qos_Finished
|
||||
utilities::hook::set(0x1438C2C70_g, 0xC301B0); // Live_Contracts? related to bdUNK125
|
||||
}
|
||||
|
||||
void pre_destroy() override
|
||||
@ -524,7 +524,7 @@ namespace demonware
|
||||
|
||||
for (const auto& import : original_imports)
|
||||
{
|
||||
utils::hook::set(import.first, import.second);
|
||||
utilities::hook::set(import.first, import.second);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "definitions/variables.hpp"
|
||||
#include "loader/component_loader.hpp"
|
||||
|
||||
#include <utils/string.hpp>
|
||||
#include <utilities/string.hpp>
|
||||
|
||||
namespace dvars
|
||||
{
|
||||
@ -25,22 +25,22 @@ namespace dvars
|
||||
{
|
||||
if (domain.vector.max == FLT_MAX)
|
||||
{
|
||||
return utils::string::va("Domain is any %iD vector", components);
|
||||
return utilities::string::va("Domain is any %iD vector", components);
|
||||
}
|
||||
else
|
||||
{
|
||||
return utils::string::va("Domain is any %iD vector with components %g or smaller", components,
|
||||
return utilities::string::va("Domain is any %iD vector with components %g or smaller", components,
|
||||
domain.vector.max);
|
||||
}
|
||||
}
|
||||
else if (domain.vector.max == FLT_MAX)
|
||||
{
|
||||
return utils::string::va("Domain is any %iD vector with components %g or bigger", components,
|
||||
return utilities::string::va("Domain is any %iD vector with components %g or bigger", components,
|
||||
domain.vector.min);
|
||||
}
|
||||
else
|
||||
{
|
||||
return utils::string::va("Domain is any %iD vector with components from %g to %g", components,
|
||||
return utilities::string::va("Domain is any %iD vector with components from %g to %g", components,
|
||||
domain.vector.min, domain.vector.max);
|
||||
}
|
||||
}
|
||||
@ -64,16 +64,16 @@ namespace dvars
|
||||
}
|
||||
else
|
||||
{
|
||||
return utils::string::va("Domain is any number %g or smaller", domain.value.max);
|
||||
return utilities::string::va("Domain is any number %g or smaller", domain.value.max);
|
||||
}
|
||||
}
|
||||
else if (domain.value.max == FLT_MAX)
|
||||
{
|
||||
return utils::string::va("Domain is any number %g or bigger", domain.value.min);
|
||||
return utilities::string::va("Domain is any number %g or bigger", domain.value.min);
|
||||
}
|
||||
else
|
||||
{
|
||||
return utils::string::va("Domain is any number from %g to %g", domain.value.min, domain.value.max);
|
||||
return utilities::string::va("Domain is any number from %g to %g", domain.value.min, domain.value.max);
|
||||
}
|
||||
|
||||
case game::DVAR_TYPE_FLOAT_2:
|
||||
@ -97,16 +97,16 @@ namespace dvars
|
||||
}
|
||||
else
|
||||
{
|
||||
return utils::string::va("Domain is any integer %i or smaller", domain.integer.max);
|
||||
return utilities::string::va("Domain is any integer %i or smaller", domain.integer.max);
|
||||
}
|
||||
}
|
||||
else if (domain.integer.max == INT_MAX)
|
||||
{
|
||||
return utils::string::va("Domain is any integer %i or bigger", domain.integer.min);
|
||||
return utilities::string::va("Domain is any integer %i or bigger", domain.integer.min);
|
||||
}
|
||||
else
|
||||
{
|
||||
return utils::string::va("Domain is any integer from %i to %i", domain.integer.min, domain.integer.max);
|
||||
return utilities::string::va("Domain is any integer from %i to %i", domain.integer.min, domain.integer.max);
|
||||
}
|
||||
|
||||
case game::DVAR_TYPE_ENUM:
|
||||
@ -114,7 +114,7 @@ namespace dvars
|
||||
|
||||
for (auto string_index = 0; string_index < domain.enumeration.stringCount; ++string_index)
|
||||
{
|
||||
str += utils::string::va("\n %2i: %s", string_index, domain.enumeration.strings[string_index]);
|
||||
str += utilities::string::va("\n %2i: %s", string_index, domain.enumeration.strings[string_index]);
|
||||
}
|
||||
|
||||
return str;
|
||||
@ -134,16 +134,16 @@ namespace dvars
|
||||
}
|
||||
else
|
||||
{
|
||||
return utils::string::va("Domain is any integer %lli or smaller", domain.integer64.max);
|
||||
return utilities::string::va("Domain is any integer %lli or smaller", domain.integer64.max);
|
||||
}
|
||||
}
|
||||
else if (domain.integer64.max == _I64_MAX)
|
||||
{
|
||||
return utils::string::va("Domain is any integer %lli or bigger", domain.integer64.min);
|
||||
return utilities::string::va("Domain is any integer %lli or bigger", domain.integer64.min);
|
||||
}
|
||||
else
|
||||
{
|
||||
return utils::string::va("Domain is any integer from %lli to %lli", domain.integer64.min, domain.integer64.max);
|
||||
return utilities::string::va("Domain is any integer from %lli to %lli", domain.integer64.min, domain.integer64.max);
|
||||
}
|
||||
|
||||
case game::DVAR_TYPE_UINT64:
|
||||
@ -151,12 +151,12 @@ namespace dvars
|
||||
{
|
||||
if (domain.unsignedInt64.max == _UI64_MAX)
|
||||
{
|
||||
return utils::string::va("Domain is any unsigned integer %zu or bigger", domain.unsignedInt64.min);
|
||||
return utilities::string::va("Domain is any unsigned integer %zu or bigger", domain.unsignedInt64.min);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return utils::string::va("Domain is any unsigned integer from %zu to %zu", domain.unsignedInt64.min, domain.unsignedInt64.max);
|
||||
return utilities::string::va("Domain is any unsigned integer from %zu to %zu", domain.unsignedInt64.min, domain.unsignedInt64.max);
|
||||
}
|
||||
}
|
||||
else if (domain.unsignedInt64.max == _UI64_MAX)
|
||||
@ -165,11 +165,11 @@ namespace dvars
|
||||
}
|
||||
else
|
||||
{
|
||||
return utils::string::va("Domain is any integer %zu or smaller", domain.unsignedInt64.max);
|
||||
return utilities::string::va("Domain is any integer %zu or smaller", domain.unsignedInt64.max);
|
||||
}
|
||||
|
||||
default:
|
||||
return utils::string::va("unhandled dvar type '%i'", type);
|
||||
return utilities::string::va("unhandled dvar type '%i'", type);
|
||||
}
|
||||
}
|
||||
|
||||
@ -265,7 +265,7 @@ namespace dvars
|
||||
|
||||
game::dvar_t* find_dvar(const std::string& nameRef)
|
||||
{
|
||||
auto it = std::find_if(variables::dvars_record.begin(), variables::dvars_record.end(), [&nameRef](variables::varEntry& i) { return utils::string::compare(i.name, nameRef); });
|
||||
auto it = std::find_if(variables::dvars_record.begin(), variables::dvars_record.end(), [&nameRef](variables::varEntry& i) { return utilities::string::compare(i.name, nameRef); });
|
||||
|
||||
if (it != variables::dvars_record.end() && it->pointer)
|
||||
{
|
||||
|
@ -7,9 +7,9 @@
|
||||
#include "component/dvars.hpp"
|
||||
#include "component/scheduler.hpp"
|
||||
|
||||
#include <utils/hook.hpp>
|
||||
#include <utils/string.hpp>
|
||||
#include <utils/concurrency.hpp>
|
||||
#include <utilities/hook.hpp>
|
||||
#include <utilities/string.hpp>
|
||||
#include <utilities/concurrency.hpp>
|
||||
|
||||
#define R_DrawTextFont reinterpret_cast<void*>(game::sharedUiInfo->assets.bigFont)
|
||||
#define R_WhiteMaterial reinterpret_cast<void*>(game::sharedUiInfo->assets.whiteMaterial)
|
||||
@ -53,7 +53,7 @@ namespace game_console
|
||||
bool output_visible{};
|
||||
int display_line_offset{};
|
||||
int total_line_count{};
|
||||
utils::concurrency::container<output_queue, std::recursive_mutex> output{};
|
||||
utilities::concurrency::container<output_queue, std::recursive_mutex> output{};
|
||||
};
|
||||
|
||||
ingame_console con{};
|
||||
@ -186,7 +186,7 @@ namespace game_console
|
||||
|
||||
for (const auto& dvar : variables::dvars_record)
|
||||
{
|
||||
if (dvars::find_dvar(dvar.fnv1a) && utils::string::match(input, dvar.name) >= required_ratio)
|
||||
if (dvars::find_dvar(dvar.fnv1a) && utilities::string::match(input, dvar.name) >= required_ratio)
|
||||
{
|
||||
suggestions.push_back(dvar);
|
||||
}
|
||||
@ -204,7 +204,7 @@ namespace game_console
|
||||
|
||||
for (const auto& cmd : variables::commands_record)
|
||||
{
|
||||
if (utils::string::match(input, cmd.name) >= required_ratio)
|
||||
if (utilities::string::match(input, cmd.name) >= required_ratio)
|
||||
{
|
||||
suggestions.push_back(cmd);
|
||||
}
|
||||
@ -252,7 +252,7 @@ namespace game_console
|
||||
if (matches.size() <= con.max_suggestions)
|
||||
{
|
||||
std::sort(matches.begin(), matches.end(), [&input](suggestion_t& lhs, suggestion_t& rhs) {
|
||||
return utils::string::match(input, lhs.name) > utils::string::match(input, rhs.name);
|
||||
return utilities::string::match(input, lhs.name) > utilities::string::match(input, rhs.name);
|
||||
});
|
||||
}
|
||||
|
||||
@ -266,7 +266,7 @@ namespace game_console
|
||||
if (matches.size() > con.max_suggestions)
|
||||
{
|
||||
draw_hint_box(1, con_inputHintBoxColor);
|
||||
draw_hint_text(0, utils::string::va("%i matches (too many to show here)", matches.size()), con_inputDvarMatchColor);
|
||||
draw_hint_text(0, utilities::string::va("%i matches (too many to show here)", matches.size()), con_inputDvarMatchColor);
|
||||
}
|
||||
else if (matches.size() == 1)
|
||||
{
|
||||
@ -414,7 +414,7 @@ namespace game_console
|
||||
va_end(ap);
|
||||
|
||||
const auto formatted = std::string(va_buffer);
|
||||
const auto lines = utils::string::split(formatted, '\n');
|
||||
const auto lines = utilities::string::split(formatted, '\n');
|
||||
|
||||
for (const auto& line : lines)
|
||||
{
|
||||
@ -424,7 +424,7 @@ namespace game_console
|
||||
|
||||
void print(const std::string& data)
|
||||
{
|
||||
const auto lines = utils::string::split(data, '\n');
|
||||
const auto lines = utilities::string::split(data, '\n');
|
||||
for (const auto& line : lines)
|
||||
{
|
||||
print_internal(line);
|
||||
@ -476,7 +476,7 @@ namespace game_console
|
||||
|
||||
if (key == 'v' - 'a' + 1) // paste
|
||||
{
|
||||
const auto clipboard = utils::string::get_clipboard_data();
|
||||
const auto clipboard = utilities::string::get_clipboard_data();
|
||||
if (clipboard.empty())
|
||||
{
|
||||
return false;
|
||||
@ -646,7 +646,7 @@ namespace game_console
|
||||
|
||||
if (key == game::keyNum_t::K_ENTER)
|
||||
{
|
||||
//game::Cbuf_AddText(0, utils::string::va("%s \n", fixed_input.data()));
|
||||
//game::Cbuf_AddText(0, utilities::string::va("%s \n", fixed_input.data()));
|
||||
|
||||
if (history_index != -1)
|
||||
{
|
||||
@ -661,7 +661,7 @@ namespace game_console
|
||||
history.push_front(con.buffer);
|
||||
|
||||
print("]%s\n", con.buffer);
|
||||
game::Cbuf_AddText(0, utils::string::va("%s \n", fixed_input.data()));
|
||||
game::Cbuf_AddText(0, utilities::string::va("%s \n", fixed_input.data()));
|
||||
|
||||
if (history.size() > 10)
|
||||
{
|
||||
@ -678,7 +678,7 @@ namespace game_console
|
||||
return true;
|
||||
}
|
||||
|
||||
utils::hook::detour cl_key_event_hook;
|
||||
utilities::hook::detour cl_key_event_hook;
|
||||
void cl_key_event_stub(int localClientNum, int key, bool down, unsigned int time)
|
||||
{
|
||||
if (!game_console::console_key_event(localClientNum, key, down))
|
||||
@ -689,7 +689,7 @@ namespace game_console
|
||||
cl_key_event_hook.invoke<void>(localClientNum, key, down, time);
|
||||
}
|
||||
|
||||
utils::hook::detour cl_char_event_hook;
|
||||
utilities::hook::detour cl_char_event_hook;
|
||||
void cl_char_event_stub(const int localClientNum, const int key, bool isRepeated)
|
||||
{
|
||||
if (!game_console::console_char_event(localClientNum, key))
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include "game_console.hpp"
|
||||
#include "loader/component_loader.hpp"
|
||||
|
||||
#include <utils/nt.hpp>
|
||||
#include <utilities/nt.hpp>
|
||||
|
||||
#define OUTPUT_DEBUG_API
|
||||
#define OUTPUT_GAME_CONSOLE
|
||||
@ -64,11 +64,11 @@ namespace logger
|
||||
void pre_start() override
|
||||
{
|
||||
#ifdef REMOVE_PREVIOUS_LOG
|
||||
utils::io::remove_file("project-bo4.log");
|
||||
utilities::io::remove_file("project-bo4.log");
|
||||
#endif // REMOVE_PREVIOUS_LOG
|
||||
|
||||
write(LOG_TYPE_INFO, "=======================================================================================================");
|
||||
write(LOG_TYPE_INFO, " Project-BO4 Initializing ... %s[0x%llX]", utils::nt::library{}.get_name().c_str(), utils::nt::library{}.get_ptr());
|
||||
write(LOG_TYPE_INFO, " Project-BO4 Initializing ... %s[0x%llX]", utilities::nt::library{}.get_name().c_str(), utilities::nt::library{}.get_ptr());
|
||||
write(LOG_TYPE_INFO, "=======================================================================================================");
|
||||
}
|
||||
|
||||
|
@ -3,11 +3,11 @@
|
||||
#include "definitions/game.hpp"
|
||||
#include "loader/component_loader.hpp"
|
||||
|
||||
#include <utils/hook.hpp>
|
||||
#include <utils/string.hpp>
|
||||
#include <utils/identity.hpp>
|
||||
#include <utils/json_config.hpp>
|
||||
#include <utils/cryptography.hpp>
|
||||
#include <utilities/hook.hpp>
|
||||
#include <utilities/string.hpp>
|
||||
#include <utilities/identity.hpp>
|
||||
#include <utilities/json_config.hpp>
|
||||
#include <utilities/cryptography.hpp>
|
||||
#include <WinReg.hpp>
|
||||
|
||||
namespace platform
|
||||
@ -17,8 +17,8 @@ namespace platform
|
||||
static uint64_t userid = 0;
|
||||
if (!userid)
|
||||
{
|
||||
uint32_t default_xuid = utils::cryptography::xxh32::compute(utils::identity::get_sys_username());
|
||||
userid = utils::json_config::ReadUnsignedInteger64("identity", "xuid", default_xuid);
|
||||
uint32_t default_xuid = utilities::cryptography::xxh32::compute(utilities::identity::get_sys_username());
|
||||
userid = utilities::json_config::ReadUnsignedInteger64("identity", "xuid", default_xuid);
|
||||
}
|
||||
|
||||
return userid;
|
||||
@ -29,8 +29,8 @@ namespace platform
|
||||
static std::string username{};
|
||||
if (username.empty())
|
||||
{
|
||||
std::string default_name = utils::identity::get_sys_username();
|
||||
username = utils::json_config::ReadString("identity", "name", default_name);
|
||||
std::string default_name = utilities::identity::get_sys_username();
|
||||
username = utilities::json_config::ReadString("identity", "name", default_name);
|
||||
}
|
||||
|
||||
return username.data();
|
||||
@ -43,7 +43,7 @@ namespace platform
|
||||
|
||||
namespace
|
||||
{
|
||||
utils::hook::detour PC_TextChat_Print_Hook;
|
||||
utilities::hook::detour PC_TextChat_Print_Hook;
|
||||
void PC_TextChat_Print_Stub(const char* text)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
@ -76,22 +76,22 @@ namespace platform
|
||||
|
||||
void post_unpack() override
|
||||
{
|
||||
utils::hook::set<uint16_t>(0x1423271D0_g, 0x01B0); // BattleNet_IsDisabled (patch to mov al,1)
|
||||
utils::hook::set<uint32_t>(0x1423271E0_g, 0x90C301B0); // BattleNet_IsConnected (patch to mov al,1 retn)
|
||||
utilities::hook::set<uint16_t>(0x1423271D0_g, 0x01B0); // BattleNet_IsDisabled (patch to mov al,1)
|
||||
utilities::hook::set<uint32_t>(0x1423271E0_g, 0x90C301B0); // BattleNet_IsConnected (patch to mov al,1 retn)
|
||||
|
||||
utils::hook::set<uint8_t>(0x142325210_g, 0xC3); // patch#1 Annoying function crashing game; related to BattleNet (TODO : Needs Further Investigation)
|
||||
utils::hook::set<uint8_t>(0x142307B40_g, 0xC3); // patch#2 Annoying function crashing game; related to BattleNet (TODO : Needs Further Investigation)
|
||||
utils::hook::set<uint32_t>(0x143D08290_g, 0x90C301B0); // patch#3 BattleNet_IsModeAvailable? (patch to mov al,1 retn)
|
||||
utilities::hook::set<uint8_t>(0x142325210_g, 0xC3); // patch#1 Annoying function crashing game; related to BattleNet (TODO : Needs Further Investigation)
|
||||
utilities::hook::set<uint8_t>(0x142307B40_g, 0xC3); // patch#2 Annoying function crashing game; related to BattleNet (TODO : Needs Further Investigation)
|
||||
utilities::hook::set<uint32_t>(0x143D08290_g, 0x90C301B0); // patch#3 BattleNet_IsModeAvailable? (patch to mov al,1 retn)
|
||||
|
||||
utils::hook::nop(0x1437DA454_g, 13); // begin cross-auth even without platform being initialized [LiveConnect_BeginCrossAuthPlatform]
|
||||
utils::hook::set(0x1444D2D60_g, 0xC301B0); // Auth3 Response RSA signature check [bdAuth::validateResponseSignature]
|
||||
utils::hook::set(0x1444E34C0_g, 0xC301B0); // Auth3 Response platform extended data check [bdAuthPC::processPlatformData]
|
||||
utilities::hook::nop(0x1437DA454_g, 13); // begin cross-auth even without platform being initialized [LiveConnect_BeginCrossAuthPlatform]
|
||||
utilities::hook::set(0x1444D2D60_g, 0xC301B0); // Auth3 Response RSA signature check [bdAuth::validateResponseSignature]
|
||||
utilities::hook::set(0x1444E34C0_g, 0xC301B0); // Auth3 Response platform extended data check [bdAuthPC::processPlatformData]
|
||||
|
||||
utils::hook::nop(0x1438994E9_g, 22); // get live name even without platform being initialized [Live_UserSignedIn]
|
||||
utils::hook::nop(0x1438C3476_g, 22); // get live xuid even without platform being initialized [LiveUser_UserGetXuid]
|
||||
utilities::hook::nop(0x1438994E9_g, 22); // get live name even without platform being initialized [Live_UserSignedIn]
|
||||
utilities::hook::nop(0x1438C3476_g, 22); // get live xuid even without platform being initialized [LiveUser_UserGetXuid]
|
||||
|
||||
utils::hook::jump(0x142325C70_g, bnet_get_username); // detour battlenet username
|
||||
utils::hook::jump(0x142325CA0_g, bnet_get_userid); // detour battlenet userid
|
||||
utilities::hook::jump(0x142325C70_g, bnet_get_username); // detour battlenet username
|
||||
utilities::hook::jump(0x142325CA0_g, bnet_get_userid); // detour battlenet userid
|
||||
|
||||
//PC_TextChat_Print_Hook.create(0x1422D4A20_g, PC_TextChat_Print_Stub); // Disable useless system messages passed into chat box
|
||||
|
||||
|
@ -3,9 +3,9 @@
|
||||
#include "loader/component_loader.hpp"
|
||||
|
||||
#include <cassert>
|
||||
#include <utils/hook.hpp>
|
||||
#include <utils/concurrency.hpp>
|
||||
#include <utils/thread.hpp>
|
||||
#include <utilities/hook.hpp>
|
||||
#include <utilities/concurrency.hpp>
|
||||
#include <utilities/thread.hpp>
|
||||
|
||||
namespace scheduler
|
||||
{
|
||||
@ -64,8 +64,8 @@ namespace scheduler
|
||||
}
|
||||
|
||||
private:
|
||||
utils::concurrency::container<task_list> new_callbacks_;
|
||||
utils::concurrency::container<task_list, std::recursive_mutex> callbacks_;
|
||||
utilities::concurrency::container<task_list> new_callbacks_;
|
||||
utilities::concurrency::container<task_list, std::recursive_mutex> callbacks_;
|
||||
|
||||
void merge_callbacks()
|
||||
{
|
||||
@ -85,9 +85,9 @@ namespace scheduler
|
||||
std::thread thread;
|
||||
task_pipeline pipelines[pipeline::count];
|
||||
|
||||
utils::hook::detour r_end_frame_hook;
|
||||
utils::hook::detour g_run_frame_hook;
|
||||
utils::hook::detour main_frame_hook;
|
||||
utilities::hook::detour r_end_frame_hook;
|
||||
utilities::hook::detour g_run_frame_hook;
|
||||
utilities::hook::detour main_frame_hook;
|
||||
|
||||
void execute(const pipeline type)
|
||||
{
|
||||
@ -152,7 +152,7 @@ namespace scheduler
|
||||
public:
|
||||
void pre_start() override
|
||||
{
|
||||
thread = utils::thread::create_named_thread("Async Scheduler", []()
|
||||
thread = utilities::thread::create_named_thread("Async Scheduler", []()
|
||||
{
|
||||
while (!kill)
|
||||
{
|
||||
|
@ -4,30 +4,30 @@
|
||||
|
||||
#include "resource.hpp"
|
||||
|
||||
#include <utils/nt.hpp>
|
||||
#include <utils/image.hpp>
|
||||
#include <utilities/nt.hpp>
|
||||
#include <utilities/image.hpp>
|
||||
|
||||
namespace splash
|
||||
{
|
||||
namespace
|
||||
{
|
||||
HWND window{};
|
||||
utils::image::object image{};
|
||||
utilities::image::object image{};
|
||||
std::thread window_thread{};
|
||||
|
||||
utils::image::object load_splash_image()
|
||||
utilities::image::object load_splash_image()
|
||||
{
|
||||
//const auto self = utils::nt::library::get_by_address(load_splash_image);
|
||||
//const auto self = utilities::nt::library::get_by_address(load_splash_image);
|
||||
//return LoadImageA(self, MAKEINTRESOURCE(IMAGE_SPLASH), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR);
|
||||
|
||||
const auto res = utils::nt::load_resource(IMAGE_SPLASH);
|
||||
const auto img = utils::image::load_image(res);
|
||||
return utils::image::create_bitmap(img);
|
||||
const auto res = utilities::nt::load_resource(IMAGE_SPLASH);
|
||||
const auto img = utilities::image::load_image(res);
|
||||
return utilities::image::create_bitmap(img);
|
||||
}
|
||||
|
||||
void enable_dpi_awareness()
|
||||
{
|
||||
const utils::nt::library user32{ "user32.dll" };
|
||||
const utilities::nt::library user32{ "user32.dll" };
|
||||
const auto set_dpi = user32
|
||||
? user32.get_proc<BOOL(WINAPI*)(DPI_AWARENESS_CONTEXT)>(
|
||||
"SetProcessDpiAwarenessContext")
|
||||
@ -63,7 +63,7 @@ namespace splash
|
||||
{
|
||||
WNDCLASSA wnd_class;
|
||||
|
||||
const auto self = utils::nt::library::get_by_address(load_splash_image);
|
||||
const auto self = utilities::nt::library::get_by_address(load_splash_image);
|
||||
|
||||
wnd_class.style = CS_DROPSHADOW;
|
||||
wnd_class.cbClsExtra = 0;
|
||||
@ -161,7 +161,7 @@ namespace splash
|
||||
}
|
||||
|
||||
window = nullptr;
|
||||
UnregisterClassA("Black Ops 4 Splash Screen", utils::nt::library{});
|
||||
UnregisterClassA("Black Ops 4 Splash Screen", utilities::nt::library{});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include <std_include.hpp>
|
||||
#include "loader/component_loader.hpp"
|
||||
|
||||
#include <utils/hook.hpp>
|
||||
#include <utilities/hook.hpp>
|
||||
|
||||
namespace unlockall
|
||||
{
|
||||
@ -103,7 +103,7 @@ namespace unlockall
|
||||
public:
|
||||
void post_unpack() override
|
||||
{
|
||||
utils::hook::jump(0x1437F6ED0_g, liveinventory_getitemquantity);
|
||||
utilities::hook::jump(0x1437F6ED0_g, liveinventory_getitemquantity);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -2,8 +2,8 @@
|
||||
#include "discovery.hpp"
|
||||
#include "loader/component_loader.hpp"
|
||||
|
||||
#include <utils/hook.hpp>
|
||||
#include <utils/signature.hpp>
|
||||
#include <utilities/hook.hpp>
|
||||
#include <utilities/signature.hpp>
|
||||
|
||||
std::unordered_map<std::string, size_t> symbols_list;
|
||||
|
||||
@ -98,7 +98,7 @@ namespace discovery
|
||||
continue;
|
||||
}
|
||||
|
||||
utils::hook::signature::signature_result scan = utils::hook::signature(std::string(i.sig, strlen(i.sig))).process();
|
||||
utilities::hook::signature::signature_result scan = utilities::hook::signature(std::string(i.sig, strlen(i.sig))).process();
|
||||
|
||||
if (scan.size() == 0 || scan.size() > 1)
|
||||
{
|
||||
@ -126,7 +126,7 @@ namespace discovery
|
||||
|
||||
if (symbols_list.find("com_get_build_version") != symbols_list.end())
|
||||
{
|
||||
const char* build_version = utils::hook::invoke<const char*>(symbols_list["com_get_build_version"]);
|
||||
const char* build_version = utilities::hook::invoke<const char*>(symbols_list["com_get_build_version"]);
|
||||
logger::write(logger::LOG_TYPE_DEBUG, "Address-List Discovery Results for BlackOps4 %s", build_version);
|
||||
}
|
||||
|
||||
|
@ -169,24 +169,28 @@ namespace demonware
|
||||
return type == expected;
|
||||
}
|
||||
|
||||
bool byte_buffer::read_array_header(const unsigned char expected, unsigned int* element_count,
|
||||
unsigned int* element_size)
|
||||
bool byte_buffer::read_array_header(const unsigned char expected
|
||||
, unsigned int* element_count, unsigned int* element_size)
|
||||
{
|
||||
if (element_count) *element_count = 0;
|
||||
if (element_size) *element_size = 0;
|
||||
|
||||
const auto using_types = this->is_using_data_types();
|
||||
this->set_use_data_types(true);
|
||||
|
||||
if (!this->read_data_type(expected + 100)) return false;
|
||||
|
||||
uint32_t array_size, el_count;
|
||||
uint32_t array_size, num_elements;
|
||||
if (!this->read_uint32(&array_size)) return false;
|
||||
|
||||
this->set_use_data_types(false);
|
||||
this->read_uint32(&el_count);
|
||||
if (!this->read_uint32(&num_elements)) return false;
|
||||
this->set_use_data_types(true);
|
||||
|
||||
if (element_count) *element_count = el_count;
|
||||
if (element_size) *element_size = array_size / el_count;
|
||||
if (element_count) *element_count = num_elements;
|
||||
if (element_size) *element_size = array_size / num_elements;
|
||||
|
||||
this->set_use_data_types(using_types);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -293,8 +297,8 @@ namespace demonware
|
||||
return this->write(length, data);
|
||||
}
|
||||
|
||||
bool byte_buffer::write_array_header(const unsigned char type, const unsigned int element_count,
|
||||
const unsigned int element_size)
|
||||
bool byte_buffer::write_array_header(const unsigned char type,
|
||||
const unsigned int element_count, const unsigned int element_size)
|
||||
{
|
||||
const auto using_types = this->is_using_data_types();
|
||||
this->set_use_data_types(false);
|
||||
|
@ -30,8 +30,59 @@ namespace demonware
|
||||
bool read_struct(std::string* output);
|
||||
bool read_data_type(char expected);
|
||||
|
||||
bool read_array_header(unsigned char expected, unsigned int* element_count,
|
||||
unsigned int* element_size = nullptr);
|
||||
bool read_array_header(const unsigned char expected
|
||||
, unsigned int* element_count, unsigned int* element_size);
|
||||
|
||||
template <typename T>
|
||||
bool read_array(const unsigned char expected, std::vector<T>* vec)
|
||||
{
|
||||
const auto using_types = this->is_using_data_types();
|
||||
this->set_use_data_types(false);
|
||||
|
||||
uint32_t ItemCount, itemSize;
|
||||
|
||||
if (!this->read_array_header(expected, &ItemCount, &itemSize)) return false;
|
||||
if (itemSize != sizeof(T)) return false;
|
||||
|
||||
for (size_t i = 0; i < ItemCount; i++)
|
||||
{
|
||||
T item{};
|
||||
|
||||
if (!this->read(sizeof(T), &item)) return false;
|
||||
|
||||
vec->push_back(item);
|
||||
}
|
||||
|
||||
this->set_use_data_types(using_types);
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool read_array(const unsigned char expected, std::map<T, T>* map)
|
||||
{
|
||||
const auto using_types = this->is_using_data_types();
|
||||
this->set_use_data_types(false);
|
||||
|
||||
uint32_t ItemCount, itemSize;
|
||||
|
||||
if (!this->read_array_header(expected, &ItemCount, &itemSize)) return false;
|
||||
if (itemSize != sizeof(T)) return false;
|
||||
|
||||
for (size_t i = 0; i < ItemCount / 2; i++)
|
||||
{
|
||||
T key{}, value{};
|
||||
|
||||
if (!this->read(sizeof(T), &key)
|
||||
|| !this->read(sizeof(T), &value)
|
||||
) return false;
|
||||
|
||||
map->insert({ key, value });
|
||||
}
|
||||
|
||||
this->set_use_data_types(using_types);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool write_bool(bool data);
|
||||
bool write_byte(char data);
|
||||
@ -51,7 +102,44 @@ namespace demonware
|
||||
bool write_struct(const char* data, int length);
|
||||
bool write_struct(const std::string& data);
|
||||
|
||||
bool write_array_header(unsigned char type, unsigned int element_count, unsigned int element_size);
|
||||
bool write_array_header(const unsigned char type,
|
||||
const unsigned int element_count, const unsigned int element_size);
|
||||
|
||||
template <typename T>
|
||||
bool write_array(const unsigned char type, const std::vector<T>& vec)
|
||||
{
|
||||
const auto using_types = this->is_using_data_types();
|
||||
this->set_use_data_types(false);
|
||||
|
||||
auto result = write_array_header(type, vec.size(), sizeof(T));
|
||||
|
||||
for (size_t i = 0; i < vec.size(); i++)
|
||||
{
|
||||
result &= this->write(sizeof(T), &vec[i]);
|
||||
}
|
||||
|
||||
this->set_use_data_types(using_types);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool write_array(const unsigned char type, const std::map<T, T>& map)
|
||||
{
|
||||
const auto using_types = this->is_using_data_types();
|
||||
this->set_use_data_types(false);
|
||||
|
||||
auto result = write_array_header(type, map.size() * 2, sizeof(T));
|
||||
|
||||
for (const auto& item : map)
|
||||
{
|
||||
result &= this->write(sizeof(T), &item.first);
|
||||
result &= this->write(sizeof(T), &item.second);
|
||||
}
|
||||
|
||||
this->set_use_data_types(using_types);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
bool read(int bytes, void* output);
|
||||
bool write(int bytes, const void* data);
|
||||
|
@ -18,10 +18,58 @@ namespace demonware
|
||||
}
|
||||
};
|
||||
|
||||
class bdStringResult final : public bdTaskResult
|
||||
{
|
||||
public:
|
||||
std::string content = "";
|
||||
|
||||
void serialize(byte_buffer* buffer) override
|
||||
{
|
||||
buffer->write_string(this->content);
|
||||
}
|
||||
|
||||
void deserialize(byte_buffer* buffer) override
|
||||
{
|
||||
buffer->read_string(&this->content);
|
||||
}
|
||||
};
|
||||
|
||||
class bdUInt64Result final : public bdTaskResult
|
||||
{
|
||||
public:
|
||||
uint64_t value = 0;
|
||||
|
||||
void serialize(byte_buffer* buffer) override
|
||||
{
|
||||
buffer->write_uint64(this->value);
|
||||
}
|
||||
|
||||
void deserialize(byte_buffer* buffer) override
|
||||
{
|
||||
buffer->read_uint64(&this->value);
|
||||
}
|
||||
};
|
||||
|
||||
class bdBoolResult final : public bdTaskResult
|
||||
{
|
||||
public:
|
||||
bool value = false;
|
||||
|
||||
void serialize(byte_buffer* buffer) override
|
||||
{
|
||||
buffer->write_bool(this->value);
|
||||
}
|
||||
|
||||
void deserialize(byte_buffer* buffer) override
|
||||
{
|
||||
buffer->read_bool(&this->value);
|
||||
}
|
||||
};
|
||||
|
||||
class bdTimeStamp final : public bdTaskResult
|
||||
{
|
||||
public:
|
||||
uint32_t unix_time;
|
||||
uint32_t unix_time = 0;
|
||||
|
||||
void serialize(byte_buffer* buffer) override
|
||||
{
|
||||
@ -37,14 +85,14 @@ namespace demonware
|
||||
class bdDMLInfo : public bdTaskResult
|
||||
{
|
||||
public:
|
||||
std::string country_code; // Char [3]
|
||||
std::string country; // Char [65]
|
||||
std::string region; // Char [65]
|
||||
std::string city; // Char [129]
|
||||
float latitude;
|
||||
float longitude;
|
||||
uint32_t asn; // Autonomous System Number.
|
||||
std::string timezone;
|
||||
std::string country_code = ""; // Char [3]
|
||||
std::string country = ""; // Char [65]
|
||||
std::string region = ""; // Char [65]
|
||||
std::string city = ""; // Char [129]
|
||||
float latitude = 0.0f;
|
||||
float longitude = 0;
|
||||
uint32_t asn = 0; // Autonomous System Number.
|
||||
std::string timezone = "";
|
||||
|
||||
void serialize(byte_buffer* buffer) override
|
||||
{
|
||||
@ -74,11 +122,11 @@ namespace demonware
|
||||
class bdDMLHierarchicalInfo final : public bdDMLInfo
|
||||
{
|
||||
public:
|
||||
uint32_t m_tier0;
|
||||
uint32_t m_tier1;
|
||||
uint32_t m_tier2;
|
||||
uint32_t m_tier3;
|
||||
uint32_t m_confidence;
|
||||
uint32_t m_tier0 = 0;
|
||||
uint32_t m_tier1 = 0;
|
||||
uint32_t m_tier2 = 0;
|
||||
uint32_t m_tier3 = 0;
|
||||
uint32_t m_confidence = 0;
|
||||
|
||||
void serialize(byte_buffer* buffer) override
|
||||
{
|
||||
@ -103,74 +151,12 @@ namespace demonware
|
||||
}
|
||||
};
|
||||
|
||||
class bdStructedDataBuffer final : public bdTaskResult
|
||||
{
|
||||
public:
|
||||
std::string structed_data_protobuffer;
|
||||
|
||||
void serialize(byte_buffer* buffer) override
|
||||
{
|
||||
buffer->write_struct(this->structed_data_protobuffer);
|
||||
}
|
||||
|
||||
void deserialize(byte_buffer* buffer) override
|
||||
{
|
||||
buffer->read_struct(&this->structed_data_protobuffer);
|
||||
}
|
||||
};
|
||||
|
||||
class bdMarketplaceInventory final : public bdTaskResult
|
||||
{
|
||||
public:
|
||||
uint64_t m_userID;
|
||||
std::string m_accountType;
|
||||
uint32_t m_itemId;
|
||||
uint32_t m_itemQuantity;
|
||||
uint32_t m_itemXp;
|
||||
std::string m_itemData;
|
||||
uint32_t m_expireDateTime;
|
||||
int64_t m_expiryDuration;
|
||||
uint16_t m_collisionField;
|
||||
uint32_t m_modDateTime;
|
||||
uint32_t m_customSourceType;
|
||||
|
||||
void serialize(byte_buffer* buffer) override
|
||||
{
|
||||
buffer->write_uint64(this->m_userID);
|
||||
buffer->write_string(this->m_accountType);
|
||||
buffer->write_uint32(this->m_itemId);
|
||||
buffer->write_uint32(this->m_itemQuantity);
|
||||
buffer->write_uint32(this->m_itemXp);
|
||||
buffer->write_blob(this->m_itemData);
|
||||
buffer->write_uint32(this->m_expireDateTime);
|
||||
buffer->write_int64(this->m_expiryDuration);
|
||||
buffer->write_uint16(this->m_collisionField);
|
||||
buffer->write_uint32(this->m_modDateTime);
|
||||
buffer->write_uint32(this->m_customSourceType);
|
||||
}
|
||||
|
||||
void deserialize(byte_buffer* buffer) override
|
||||
{
|
||||
buffer->read_uint64(&this->m_userID);
|
||||
buffer->read_string(&this->m_accountType);
|
||||
buffer->read_uint32(&this->m_itemId);
|
||||
buffer->read_uint32(&this->m_itemQuantity);
|
||||
buffer->read_uint32(&this->m_itemXp);
|
||||
buffer->read_blob(&this->m_itemData);
|
||||
buffer->read_uint32(&this->m_expireDateTime);
|
||||
buffer->read_int64(&this->m_expiryDuration);
|
||||
buffer->read_uint16(&this->m_collisionField);
|
||||
buffer->read_uint32(&this->m_modDateTime);
|
||||
buffer->read_uint32(&this->m_customSourceType);
|
||||
}
|
||||
};
|
||||
|
||||
class bdPublicProfileInfo final : public bdTaskResult
|
||||
{
|
||||
public:
|
||||
uint64_t m_entityID;
|
||||
int32_t m_VERSION;
|
||||
std::string m_ddl;
|
||||
uint64_t m_entityID = 0;
|
||||
int32_t m_VERSION = 0;
|
||||
std::string m_ddl = "";
|
||||
|
||||
void serialize(byte_buffer* buffer) override
|
||||
{
|
||||
@ -186,4 +172,84 @@ namespace demonware
|
||||
buffer->read_blob(&this->m_ddl);
|
||||
}
|
||||
};
|
||||
|
||||
class bdFileMetaData final : public bdTaskResult
|
||||
{
|
||||
public:
|
||||
uint64_t m_fileID = 0;
|
||||
uint32_t m_createTime = 0;
|
||||
uint32_t m_modifedTime = 0;
|
||||
uint32_t m_fileSize = 0;
|
||||
uint64_t m_ownerID = 0;
|
||||
std::string m_ownerName = "";
|
||||
uint16_t m_fileSlot = 0;
|
||||
std::string m_fileName = "";
|
||||
std::string m_url = "";
|
||||
uint16_t m_category = 0;
|
||||
std::string m_metaData = "";
|
||||
uint32_t m_summaryFileSize = 0;
|
||||
std::map<uint64_t, uint64_t> m_tags;
|
||||
uint32_t m_numCopiesMade = 0;
|
||||
uint64_t m_originID = 0;
|
||||
|
||||
void serialize(byte_buffer* buffer) override
|
||||
{
|
||||
buffer->write_uint64(this->m_fileID);
|
||||
buffer->write_uint32(this->m_createTime);
|
||||
buffer->write_uint32(this->m_modifedTime);
|
||||
buffer->write_uint32(this->m_fileSize);
|
||||
buffer->write_uint64(this->m_ownerID);
|
||||
buffer->write_string(this->m_ownerName);
|
||||
buffer->write_uint16(this->m_fileSlot);
|
||||
buffer->write_string(this->m_fileName);
|
||||
buffer->write_string(this->m_url);
|
||||
buffer->write_uint16(this->m_category);
|
||||
buffer->write_blob(this->m_metaData);
|
||||
buffer->write_uint32(this->m_summaryFileSize);
|
||||
buffer->write_array(10, m_tags);
|
||||
buffer->write_uint32(this->m_numCopiesMade);
|
||||
buffer->write_uint64(this->m_originID);
|
||||
}
|
||||
};
|
||||
|
||||
class bdURL final : public bdTaskResult
|
||||
{
|
||||
public:
|
||||
std::string m_url = "";
|
||||
uint16_t m_serverType = 0;
|
||||
std::string m_serverIndex = "";
|
||||
uint64_t m_fileID = 0;
|
||||
|
||||
void serialize(byte_buffer* buffer) override
|
||||
{
|
||||
buffer->write_string(this->m_url);
|
||||
buffer->write_uint16(this->m_serverType);
|
||||
buffer->write_string(this->m_serverIndex);
|
||||
buffer->write_uint64(this->m_fileID);
|
||||
}
|
||||
|
||||
void deserialize(byte_buffer* buffer) override
|
||||
{
|
||||
buffer->read_string(&this->m_url);
|
||||
buffer->read_uint16(&this->m_serverType);
|
||||
buffer->read_string(&this->m_serverIndex);
|
||||
buffer->read_uint64(&this->m_fileID);
|
||||
}
|
||||
};
|
||||
|
||||
class bdStructedDataBuffer final : public bdTaskResult
|
||||
{
|
||||
public:
|
||||
std::string structed_data_protobuffer = "";
|
||||
|
||||
void serialize(byte_buffer* buffer) override
|
||||
{
|
||||
buffer->write_struct(this->structed_data_protobuffer);
|
||||
}
|
||||
|
||||
void deserialize(byte_buffer* buffer) override
|
||||
{
|
||||
buffer->read_struct(&this->structed_data_protobuffer);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
#include <std_include.hpp>
|
||||
#include "keys.hpp"
|
||||
|
||||
#include <utils/cryptography.hpp>
|
||||
#include <utils/string.hpp>
|
||||
#include <utils/io.hpp>
|
||||
#include <utilities/cryptography.hpp>
|
||||
#include <utilities/string.hpp>
|
||||
#include <utilities/io.hpp>
|
||||
|
||||
#include "resource.hpp"
|
||||
#include <utils/nt.hpp>
|
||||
#include <utilities/nt.hpp>
|
||||
|
||||
|
||||
namespace demonware
|
||||
@ -41,7 +41,7 @@ namespace demonware
|
||||
pos++;
|
||||
|
||||
// calculate hmac
|
||||
result = utils::cryptography::hmac_sha1::compute(std::string(buffer, pos), std::string(dataxx, data_size));
|
||||
result = utilities::cryptography::hmac_sha1::compute(std::string(buffer, pos), std::string(dataxx, data_size));
|
||||
|
||||
// save output
|
||||
std::memcpy(dest, result.data(), std::min(20u, (dest_size - out_offset)));
|
||||
@ -69,7 +69,7 @@ namespace demonware
|
||||
pos++;
|
||||
|
||||
// calculate hmac
|
||||
result = utils::cryptography::hmac_sha1::compute(std::string(buffer, pos), std::string(dataxx, data_size));
|
||||
result = utilities::cryptography::hmac_sha1::compute(std::string(buffer, pos), std::string(dataxx, data_size));
|
||||
|
||||
// save output
|
||||
std::memcpy(dest + out_offset, result.data(), std::min(20u, (dest_size - out_offset)));
|
||||
@ -79,14 +79,14 @@ namespace demonware
|
||||
|
||||
void derive_keys_iw8()
|
||||
{
|
||||
std::string BD_AUTH_TRAFFIC_SIGNING_KEY = utils::nt::load_resource(DW_AUTH_TRAFFIC_SIGNING_KEY);
|
||||
std::string BD_AUTH_TRAFFIC_SIGNING_KEY = utilities::nt::load_resource(DW_AUTH_TRAFFIC_SIGNING_KEY);
|
||||
|
||||
const auto packet_hash = utils::cryptography::sha1::compute(packet_buffer);
|
||||
const auto packet_hash = utilities::cryptography::sha1::compute(packet_buffer);
|
||||
|
||||
char out_1[24];
|
||||
calculate_hmacs(data.m_session_key, 24, BD_AUTH_TRAFFIC_SIGNING_KEY.data(), 294, out_1, 24);
|
||||
|
||||
auto data_3 = utils::cryptography::hmac_sha1::compute(std::string(out_1, 24), packet_hash);
|
||||
auto data_3 = utilities::cryptography::hmac_sha1::compute(std::string(out_1, 24), packet_hash);
|
||||
|
||||
char out_2[16];
|
||||
calculate_hmacs(data_3.data(), 20, "CLIENTCHAL", 10, out_2, 16);
|
||||
@ -101,10 +101,10 @@ namespace demonware
|
||||
std::memcpy(data.m_enc_key, &out_3[56], 16);
|
||||
|
||||
#ifndef NDEBUG
|
||||
logger::write(logger::LOG_TYPE_DEBUG, "[DW] Response id: %s", utils::string::dump_hex(std::string(&out_2[8], 8)).data());
|
||||
logger::write(logger::LOG_TYPE_DEBUG, "[DW] Hash verify: %s", utils::string::dump_hex(std::string(&out_3[20], 20)).data());
|
||||
logger::write(logger::LOG_TYPE_DEBUG, "[DW] AES dec key: %s", utils::string::dump_hex(std::string(&out_3[40], 16)).data());
|
||||
logger::write(logger::LOG_TYPE_DEBUG, "[DW] AES enc key: %s", utils::string::dump_hex(std::string(&out_3[56], 16)).data());
|
||||
logger::write(logger::LOG_TYPE_DEBUG, "[DW] Response id: %s", utilities::string::dump_hex(std::string(&out_2[8], 8)).data());
|
||||
logger::write(logger::LOG_TYPE_DEBUG, "[DW] Hash verify: %s", utilities::string::dump_hex(std::string(&out_3[20], 20)).data());
|
||||
logger::write(logger::LOG_TYPE_DEBUG, "[DW] AES dec key: %s", utilities::string::dump_hex(std::string(&out_3[40], 16)).data());
|
||||
logger::write(logger::LOG_TYPE_DEBUG, "[DW] AES enc key: %s", utilities::string::dump_hex(std::string(&out_3[56], 16)).data());
|
||||
logger::write(logger::LOG_TYPE_DEBUG, "[DW] Bravo 6, going dark.");
|
||||
#endif
|
||||
}
|
||||
|
@ -4,10 +4,10 @@
|
||||
#include "protobuf_helper.hpp"
|
||||
|
||||
#include "resource.hpp"
|
||||
#include <utils/nt.hpp>
|
||||
#include <utils/io.hpp>
|
||||
#include <utils/string.hpp>
|
||||
#include <utils/cryptography.hpp>
|
||||
#include <utilities/nt.hpp>
|
||||
#include <utilities/io.hpp>
|
||||
#include <utilities/string.hpp>
|
||||
#include <utilities/cryptography.hpp>
|
||||
#include <component/platform.hpp>
|
||||
|
||||
#define PUBLISHER_OBJECTS_ENUMERATE_LPC_DIR
|
||||
@ -30,11 +30,11 @@ namespace demonware
|
||||
std::string get_publisher_file_checksum(std::string file)
|
||||
{
|
||||
std::string file_data;
|
||||
if (!utils::io::read_file(file, &file_data)) return "";
|
||||
if (!utilities::io::read_file(file, &file_data)) return "";
|
||||
|
||||
std::string checksum_md5 = utils::cryptography::md5::compute(file_data);
|
||||
std::string checksum_md5 = utilities::cryptography::md5::compute(file_data);
|
||||
|
||||
return utils::cryptography::base64::encode(checksum_md5);
|
||||
return utilities::cryptography::base64::encode(checksum_md5);
|
||||
}
|
||||
|
||||
std::vector<objectMetadata> get_publisher_objects_list(const std::string& category)
|
||||
@ -42,24 +42,24 @@ namespace demonware
|
||||
std::vector<objectMetadata> result;
|
||||
|
||||
#ifdef PUBLISHER_OBJECTS_ENUMERATE_LPC_DIR
|
||||
std::vector<std::string> files = utils::io::list_files("LPC");
|
||||
std::vector<std::string> files = utilities::io::list_files("LPC");
|
||||
|
||||
for (std::string file : files)
|
||||
{
|
||||
if (!utils::string::ends_with(file, ".ff")) continue;
|
||||
if (!utilities::string::ends_with(file, ".ff")) continue;
|
||||
|
||||
int64_t timestamp = static_cast<int64_t>(time(nullptr));
|
||||
result.push_back({ "treyarch", utils::io::file_name(file), get_publisher_file_checksum(file), utils::io::file_size(file), timestamp, timestamp, "" });
|
||||
result.push_back({ "treyarch", utilities::io::file_name(file), get_publisher_file_checksum(file), utilities::io::file_size(file), timestamp, timestamp, "" });
|
||||
}
|
||||
#else // PUBLISHER_OBJECTS_ENUMERATE_CSV_LIST
|
||||
const auto objects_list_csv = utils::nt::load_resource(DW_PUBLISHER_OBJECTS_LIST);
|
||||
std::vector<std::string> items = utils::string::split(objects_list_csv, "\r\n"); // WTF!?
|
||||
const auto objects_list_csv = utilities::nt::load_resource(DW_PUBLISHER_OBJECTS_LIST);
|
||||
std::vector<std::string> items = utilities::string::split(objects_list_csv, "\r\n"); // WTF!?
|
||||
|
||||
for (std::string item : items)
|
||||
{
|
||||
std::string checksum = utils::cryptography::base64::encode(HexStringToBinaryString(utils::string::split(item, ',')[2]));
|
||||
std::string name = utils::string::split(item, ',')[0];
|
||||
uint64_t length = std::stoull(utils::string::split(item, ',')[1]);
|
||||
std::string checksum = utilities::cryptography::base64::encode(HexStringToBinaryString(utilities::string::split(item, ',')[2]));
|
||||
std::string name = utilities::string::split(item, ',')[0];
|
||||
uint64_t length = std::stoull(utilities::string::split(item, ',')[1]);
|
||||
|
||||
int64_t timestamp = static_cast<int64_t>(time(nullptr));
|
||||
result.push_back({ "treyarch", name, checksum, length, timestamp, timestamp, "" });
|
||||
@ -159,17 +159,17 @@ namespace demonware
|
||||
std::string get_user_file_checksum(std::string file_path)
|
||||
{
|
||||
std::string file_data;
|
||||
if (!utils::io::read_file(file_path, &file_data)) return "";
|
||||
if (!utilities::io::read_file(file_path, &file_data)) return "";
|
||||
|
||||
return std::to_string(utils::cryptography::xxh32::compute(file_data));
|
||||
return std::to_string(utilities::cryptography::xxh32::compute(file_data));
|
||||
}
|
||||
|
||||
std::string get_user_file_content(std::string file_path)
|
||||
{
|
||||
std::string file_data;
|
||||
if (!utils::io::read_file(file_path, &file_data)) return "";
|
||||
if (!utilities::io::read_file(file_path, &file_data)) return "";
|
||||
|
||||
return utils::cryptography::base64::encode(file_data);
|
||||
return utilities::cryptography::base64::encode(file_data);
|
||||
}
|
||||
|
||||
std::string deliver_user_objects_vectorized_json(std::vector<objectMetadata> requested_items)
|
||||
@ -294,7 +294,7 @@ namespace demonware
|
||||
{
|
||||
std::string file_path = get_user_file_path(file.name);
|
||||
int64_t timestamp = static_cast<int64_t>(time(nullptr));
|
||||
files_metadata_list.push_back({ file.owner, file.name, get_user_file_checksum(file_path), utils::io::file_size(file_path), timestamp, timestamp, get_user_file_content(file_path) });
|
||||
files_metadata_list.push_back({ file.owner, file.name, get_user_file_checksum(file_path), utilities::io::file_size(file_path), timestamp, timestamp, get_user_file_content(file_path) });
|
||||
}
|
||||
|
||||
return deliver_user_objects_vectorized_json(files_metadata_list);
|
||||
@ -318,9 +318,9 @@ namespace demonware
|
||||
|
||||
std::string userdata_directory = platform::get_userdata_directory();
|
||||
|
||||
if (utils::io::directory_exists(userdata_directory))
|
||||
if (utilities::io::directory_exists(userdata_directory))
|
||||
{
|
||||
std::vector<std::string> user_objects = utils::io::list_files(userdata_directory);
|
||||
std::vector<std::string> user_objects = utilities::io::list_files(userdata_directory);
|
||||
|
||||
for (std::string object : user_objects)
|
||||
{
|
||||
@ -336,7 +336,7 @@ namespace demonware
|
||||
json_writer.Uint(0);
|
||||
|
||||
json_writer.Key("name");
|
||||
json_writer.String(utils::io::file_name(object));
|
||||
json_writer.String(utilities::io::file_name(object));
|
||||
|
||||
json_writer.Key("checksum");
|
||||
json_writer.String(get_user_file_checksum(object));
|
||||
@ -354,7 +354,7 @@ namespace demonware
|
||||
json_writer.Null();
|
||||
|
||||
json_writer.Key("contentLength");
|
||||
json_writer.Uint64(utils::io::file_size(object));
|
||||
json_writer.Uint64(utilities::io::file_size(object));
|
||||
|
||||
json_writer.Key("context");
|
||||
json_writer.String("t8-bnet");
|
||||
@ -404,9 +404,9 @@ namespace demonware
|
||||
std::string userdata_directory = platform::get_userdata_directory();
|
||||
|
||||
int files_count = 0;
|
||||
if (utils::io::directory_exists(userdata_directory))
|
||||
if (utilities::io::directory_exists(userdata_directory))
|
||||
{
|
||||
files_count = static_cast<int32_t>(utils::io::list_files(userdata_directory).size());
|
||||
files_count = static_cast<int32_t>(utilities::io::list_files(userdata_directory).size());
|
||||
}
|
||||
|
||||
|
||||
@ -467,7 +467,7 @@ namespace demonware
|
||||
json_writer.Null();
|
||||
|
||||
json_writer.Key("contentLength");
|
||||
json_writer.Uint64(utils::io::file_size(file_path));
|
||||
json_writer.Uint64(utilities::io::file_size(file_path));
|
||||
|
||||
json_writer.Key("context");
|
||||
json_writer.String("t8-bnet");
|
||||
@ -599,7 +599,7 @@ namespace demonware
|
||||
{
|
||||
std::string file_path = get_user_file_path(file);
|
||||
int64_t timestamp = static_cast<int64_t>(time(nullptr));
|
||||
files_metadata_list.push_back({ std::format("bnet-{}", platform::bnet_get_userid()), file, get_user_file_checksum(file_path), utils::io::file_size(file_path), timestamp, timestamp, get_user_file_content(file_path) });
|
||||
files_metadata_list.push_back({ std::format("bnet-{}", platform::bnet_get_userid()), file, get_user_file_checksum(file_path), utilities::io::file_size(file_path), timestamp, timestamp, get_user_file_content(file_path) });
|
||||
}
|
||||
|
||||
return construct_vectorized_upload_list_json(files_metadata_list);
|
||||
@ -609,7 +609,7 @@ namespace demonware
|
||||
{
|
||||
bdProtobufHelper header_1st;
|
||||
header_1st.writeString(1, "Content-Length", 16);
|
||||
header_1st.writeString(2, utils::string::va("%u", payload.length()), 8);
|
||||
header_1st.writeString(2, utilities::string::va("%u", payload.length()), 8);
|
||||
|
||||
bdProtobufHelper header_2nd;
|
||||
header_2nd.writeString(1, "Authorization", 16);
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include "reply.hpp"
|
||||
#include "servers/service_server.hpp"
|
||||
|
||||
#include <utils/cryptography.hpp>
|
||||
#include <utilities/cryptography.hpp>
|
||||
|
||||
namespace demonware
|
||||
{
|
||||
@ -41,7 +41,7 @@ namespace demonware
|
||||
std::string seed("\x5E\xED\x5E\xED\x5E\xED\x5E\xED\x5E\xED\x5E\xED\x5E\xED\x5E\xED", 16);
|
||||
|
||||
// encrypt
|
||||
const auto enc_data = utils::cryptography::aes::encrypt(aligned_data, seed, demonware::get_encrypt_key());
|
||||
const auto enc_data = utilities::cryptography::aes::encrypt(aligned_data, seed, demonware::get_encrypt_key());
|
||||
|
||||
// header : encrypted service data : hash
|
||||
static auto msg_count = 0;
|
||||
@ -58,7 +58,7 @@ namespace demonware
|
||||
response.write(enc_data);
|
||||
|
||||
// hash entire packet and append end
|
||||
auto hash_data = utils::cryptography::hmac_sha1::compute(response.get_buffer(), demonware::get_hmac_key());
|
||||
auto hash_data = utilities::cryptography::hmac_sha1::compute(response.get_buffer(), demonware::get_hmac_key());
|
||||
hash_data.resize(8);
|
||||
response.write(8, hash_data.data());
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "servers/base_server.hpp"
|
||||
#include <utils/cryptography.hpp>
|
||||
#include <utilities/cryptography.hpp>
|
||||
|
||||
namespace demonware
|
||||
{
|
||||
@ -31,7 +31,7 @@ namespace demonware
|
||||
|
||||
T* find(const std::string& name)
|
||||
{
|
||||
const auto address = utils::cryptography::jenkins_one_at_a_time::compute(name);
|
||||
const auto address = utilities::cryptography::jenkins_one_at_a_time::compute(name);
|
||||
return find(address);
|
||||
}
|
||||
|
||||
|
@ -3,8 +3,8 @@
|
||||
#include "auth3_server.hpp"
|
||||
#include "../keys.hpp"
|
||||
|
||||
#include <utils/cryptography.hpp>
|
||||
#include <utils/string.hpp>
|
||||
#include <utilities/cryptography.hpp>
|
||||
#include <utilities/string.hpp>
|
||||
|
||||
namespace demonware
|
||||
{
|
||||
@ -84,7 +84,7 @@ namespace demonware
|
||||
{
|
||||
auto& token_field = extra_data["account_token"];
|
||||
std::string token_b64(token_field.GetString(), token_field.GetStringLength());
|
||||
account_token = utils::cryptography::base64::decode(token_b64);
|
||||
account_token = utilities::cryptography::base64::decode(token_b64);
|
||||
}
|
||||
}
|
||||
|
||||
@ -104,13 +104,13 @@ namespace demonware
|
||||
strncpy_s(ticket.m_username, sizeof(ticket.m_username), session_token.data(), session_token.length());
|
||||
std::memcpy(ticket.m_sessionKey, session_key.data(), 24);
|
||||
|
||||
const auto client_ticket_b64 = utils::cryptography::base64::encode(reinterpret_cast<const unsigned char*>(&ticket), sizeof(ticket));
|
||||
const auto client_ticket_b64 = utilities::cryptography::base64::encode(reinterpret_cast<const unsigned char*>(&ticket), sizeof(ticket));
|
||||
|
||||
// server_ticket
|
||||
uint8_t server_ticket[128];
|
||||
std::memset(&server_ticket, 0, sizeof server_ticket);
|
||||
std::memcpy(server_ticket, session_key.data(), 24);
|
||||
const auto server_ticket_b64 = utils::cryptography::base64::encode(server_ticket, 128);
|
||||
const auto server_ticket_b64 = utilities::cryptography::base64::encode(server_ticket, 128);
|
||||
|
||||
demonware::set_session_key(session_key);
|
||||
|
||||
@ -128,7 +128,7 @@ namespace demonware
|
||||
extra.AddMember("username", username, extra.GetAllocator());
|
||||
extra.AddMember("time_to_live", 9999, extra.GetAllocator());
|
||||
|
||||
const auto lul = utils::cryptography::base64::encode("lul");
|
||||
const auto lul = utilities::cryptography::base64::encode("lul");
|
||||
extra.AddMember("extended_data", lul, extra.GetAllocator());
|
||||
|
||||
rapidjson::StringBuffer extra_buffer{};
|
||||
@ -170,8 +170,8 @@ namespace demonware
|
||||
result.append("HTTP/1.1 200 OK\r\n");
|
||||
result.append("Server: TornadoServer/4.5.3\r\n");
|
||||
result.append("Content-Type: application/json\r\n");
|
||||
result.append(utils::string::va("Date: %s GMT\r\n", date));
|
||||
result.append(utils::string::va("Content-Length: %d\r\n\r\n", buffer.GetLength()));
|
||||
result.append(utilities::string::va("Date: %s GMT\r\n", date));
|
||||
result.append(utilities::string::va("Content-Length: %d\r\n\r\n", buffer.GetLength()));
|
||||
result.append(buffer.GetString(), buffer.GetLength());
|
||||
|
||||
raw_reply reply(result);
|
||||
|
@ -1,13 +1,13 @@
|
||||
#include <std_include.hpp>
|
||||
#include "base_server.hpp"
|
||||
|
||||
#include <utils/cryptography.hpp>
|
||||
#include <utilities/cryptography.hpp>
|
||||
|
||||
namespace demonware
|
||||
{
|
||||
base_server::base_server(std::string name): name_(std::move(name))
|
||||
{
|
||||
this->address_ = utils::cryptography::jenkins_one_at_a_time::compute(this->name_);
|
||||
this->address_ = utilities::cryptography::jenkins_one_at_a_time::compute(this->name_);
|
||||
}
|
||||
|
||||
const std::string& base_server::get_name() const
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include "../services.hpp"
|
||||
#include "../keys.hpp"
|
||||
|
||||
#include <utils/cryptography.hpp>
|
||||
#include <utilities/cryptography.hpp>
|
||||
|
||||
namespace demonware
|
||||
{
|
||||
@ -127,7 +127,7 @@ namespace demonware
|
||||
char hash[8];
|
||||
std::memcpy(hash, &(enc.data()[enc.size() - 8]), 8);
|
||||
|
||||
std::string dec = utils::cryptography::aes::decrypt(
|
||||
std::string dec = utilities::cryptography::aes::decrypt(
|
||||
std::string(enc.data(), enc.size() - 8), std::string(seed, 16),
|
||||
demonware::get_decrypt_key());
|
||||
|
||||
@ -168,7 +168,7 @@ namespace demonware
|
||||
}
|
||||
else
|
||||
{
|
||||
logger::write(logger::LOG_TYPE_DEBUG, "[DW]: [lobby]: missing service '%s'", utils::string::va("%d", id));
|
||||
logger::write(logger::LOG_TYPE_DEBUG, "[DW]: [lobby]: missing service '%s'", utilities::string::va("%d", id));
|
||||
|
||||
// return no error
|
||||
byte_buffer buffer(data);
|
||||
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "base_server.hpp"
|
||||
#include <utils/concurrency.hpp>
|
||||
#include <utilities/concurrency.hpp>
|
||||
|
||||
namespace demonware
|
||||
{
|
||||
@ -21,7 +21,7 @@ namespace demonware
|
||||
void send(const std::string& data);
|
||||
|
||||
private:
|
||||
utils::concurrency::container<data_queue> in_queue_;
|
||||
utils::concurrency::container<stream_queue> out_queue_;
|
||||
utilities::concurrency::container<data_queue> in_queue_;
|
||||
utilities::concurrency::container<stream_queue> out_queue_;
|
||||
};
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "base_server.hpp"
|
||||
#include <utils/concurrency.hpp>
|
||||
#include <utilities/concurrency.hpp>
|
||||
|
||||
namespace demonware
|
||||
{
|
||||
@ -56,7 +56,7 @@ namespace demonware
|
||||
using out_queue = std::queue<out_packet>;
|
||||
using socket_queue_map = std::unordered_map<SOCKET, out_queue>;
|
||||
|
||||
utils::concurrency::container<in_queue> in_queue_;
|
||||
utils::concurrency::container<socket_queue_map> out_queue_;
|
||||
utilities::concurrency::container<in_queue> in_queue_;
|
||||
utilities::concurrency::container<socket_queue_map> out_queue_;
|
||||
};
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
#pragma once
|
||||
#include <utils/string.hpp>
|
||||
#include <utilities/string.hpp>
|
||||
#include "servers/service_server.hpp"
|
||||
|
||||
namespace demonware
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include <std_include.hpp>
|
||||
#include "../services.hpp"
|
||||
|
||||
#include <utils/io.hpp>
|
||||
#include <utilities/io.hpp>
|
||||
|
||||
namespace demonware
|
||||
{
|
||||
|
@ -3,8 +3,8 @@
|
||||
#include "../objects.hpp"
|
||||
|
||||
#include <picoproto.h>
|
||||
#include <utils/io.hpp>
|
||||
#include <utils/cryptography.hpp>
|
||||
#include <utilities/io.hpp>
|
||||
#include <utilities/cryptography.hpp>
|
||||
#include <component/platform.hpp>
|
||||
|
||||
namespace demonware
|
||||
@ -109,10 +109,10 @@ namespace demonware
|
||||
std::string url = request_buffer.GetString(2);
|
||||
std::string data = request_buffer.GetString(3);
|
||||
|
||||
std::string file = utils::string::split(url, '/')[8];
|
||||
std::string file = utilities::string::split(url, '/')[8];
|
||||
std::string path = get_user_file_path(file);
|
||||
|
||||
if (!utils::io::write_file(path, data))
|
||||
if (!utilities::io::write_file(path, data))
|
||||
logger::write(logger::LOG_TYPE_DEBUG, "[bdObjectStore::uploadUserObject] error on writing '%s'", file.data());
|
||||
else
|
||||
logger::write(logger::LOG_TYPE_DEBUG, "[bdObjectStore::uploadUserObject] saved user file '%s'", file.data());
|
||||
@ -147,12 +147,12 @@ namespace demonware
|
||||
const rapidjson::Value& name = objects[i]["metadata"]["name"];
|
||||
const rapidjson::Value& checksum = objects[i]["metadata"]["checksum"];
|
||||
|
||||
std::string data = utils::cryptography::base64::decode(content.GetString());
|
||||
std::string data = utilities::cryptography::base64::decode(content.GetString());
|
||||
const auto path = std::format("{}/{}", platform::get_userdata_directory(), name.GetString());
|
||||
|
||||
uploaded_objects_list.push_back(name.GetString());
|
||||
|
||||
if (!utils::io::write_file(path, data))
|
||||
if (!utilities::io::write_file(path, data))
|
||||
logger::write(logger::LOG_TYPE_DEBUG, "[bdObjectStore::uploadUserObjectsVectorized] error on writing '%s'", name.GetString());
|
||||
else
|
||||
logger::write(logger::LOG_TYPE_DEBUG, "[bdObjectStore::uploadUserObjectsVectorized] saved user file '%s'", name.GetString());
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include <std_include.hpp>
|
||||
#include "../services.hpp"
|
||||
|
||||
#include <utils/io.hpp>
|
||||
#include <utilities/io.hpp>
|
||||
#include <component/platform.hpp>
|
||||
|
||||
namespace demonware
|
||||
@ -27,7 +27,7 @@ namespace demonware
|
||||
result->m_entityID = entity_id;
|
||||
result->m_VERSION = 4;
|
||||
|
||||
if (utils::io::read_file(std::format("{}/profileInfo_{}", platform::get_userdata_directory(), entity_id), &result->m_ddl))
|
||||
if (utilities::io::read_file(std::format("{}/profileInfo_{}", platform::get_userdata_directory(), entity_id), &result->m_ddl))
|
||||
{
|
||||
auto reply = server->create_reply(this->task_id());
|
||||
reply->add(result);
|
||||
@ -46,7 +46,7 @@ namespace demonware
|
||||
buffer->read_int32(&version);
|
||||
buffer->read_blob(&ddl);
|
||||
|
||||
utils::io::write_file(std::format("{}/profileInfo_{}", platform::get_userdata_directory(), platform::bnet_get_userid()), ddl);
|
||||
utilities::io::write_file(std::format("{}/profileInfo_{}", platform::get_userdata_directory(), platform::bnet_get_userid()), ddl);
|
||||
|
||||
auto reply = server->create_reply(this->task_id());
|
||||
reply->send();
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include <std_include.hpp>
|
||||
#include "component_loader.hpp"
|
||||
|
||||
#include <utils/nt.hpp>
|
||||
#include <utilities/nt.hpp>
|
||||
|
||||
void component_loader::register_component(std::unique_ptr<component_interface>&& component_)
|
||||
{
|
||||
|
@ -1,11 +1,11 @@
|
||||
#include <std_include.hpp>
|
||||
|
||||
#include "loader/component_loader.hpp"
|
||||
#include <utils/io.hpp>
|
||||
#include <utils/nt.hpp>
|
||||
#include <utils/hook.hpp>
|
||||
#include <utils/string.hpp>
|
||||
#include <utils/finally.hpp>
|
||||
#include <utilities/io.hpp>
|
||||
#include <utilities/nt.hpp>
|
||||
#include <utilities/hook.hpp>
|
||||
#include <utilities/string.hpp>
|
||||
#include <utilities/finally.hpp>
|
||||
|
||||
namespace
|
||||
{
|
||||
@ -17,7 +17,7 @@ namespace
|
||||
|
||||
std::pair<void**, void*> patch_import(const std::string& lib, const std::string& func, void* function)
|
||||
{
|
||||
static const utils::nt::library game{};
|
||||
static const utilities::nt::library game{};
|
||||
|
||||
const auto game_entry = game.get_iat_entry(lib, func);
|
||||
if (!game_entry)
|
||||
@ -26,11 +26,11 @@ namespace
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
logger::write(logger::LOG_TYPE_DEBUG, "[ IAT-HOOKS ]: Diverted %s::%s from %p to %p", utils::string::to_upper(lib).c_str(), func.c_str(), game_entry, function);
|
||||
logger::write(logger::LOG_TYPE_DEBUG, "[ IAT-HOOKS ]: Diverted %s::%s from %p to %p", utilities::string::to_upper(lib).c_str(), func.c_str(), game_entry, function);
|
||||
#endif // DEBUG
|
||||
|
||||
const auto original_import = game_entry;
|
||||
utils::hook::set(game_entry, function);
|
||||
utilities::hook::set(game_entry, function);
|
||||
return { game_entry, original_import };
|
||||
}
|
||||
|
||||
@ -49,17 +49,17 @@ namespace
|
||||
{
|
||||
patch_import("user32.dll", "GetSystemMetrics", get_system_metrics);
|
||||
|
||||
//utils::hook::set(utils::nt::library{}.get_iat_entry("kernel32.dll", "ExitProcess"), exit_hook);
|
||||
//utilities::hook::set(utilities::nt::library{}.get_iat_entry("kernel32.dll", "ExitProcess"), exit_hook);
|
||||
}
|
||||
|
||||
void remove_crash_file()
|
||||
{
|
||||
const utils::nt::library game{};
|
||||
const utilities::nt::library game{};
|
||||
const auto game_file = game.get_path();
|
||||
auto game_path = std::filesystem::path(game_file);
|
||||
game_path.replace_extension(".start");
|
||||
|
||||
utils::io::remove_file(game_path.generic_string());
|
||||
utilities::io::remove_file(game_path.generic_string());
|
||||
}
|
||||
|
||||
bool run()
|
||||
@ -68,7 +68,7 @@ namespace
|
||||
|
||||
{
|
||||
auto premature_shutdown = true;
|
||||
const auto _ = utils::finally([&premature_shutdown]()
|
||||
const auto _ = utilities::finally([&premature_shutdown]()
|
||||
{
|
||||
if (premature_shutdown)
|
||||
{
|
||||
@ -107,14 +107,14 @@ namespace
|
||||
: source_(source)
|
||||
{
|
||||
memcpy(this->data_, source, sizeof(this->data_));
|
||||
utils::hook::jump(this->source_, target, true, true);
|
||||
utilities::hook::jump(this->source_, target, true, true);
|
||||
}
|
||||
|
||||
~patch()
|
||||
{
|
||||
if (source_)
|
||||
{
|
||||
utils::hook::copy(this->source_, this->data_, sizeof(this->data_));
|
||||
utilities::hook::copy(this->source_, this->data_, sizeof(this->data_));
|
||||
}
|
||||
}
|
||||
|
||||
@ -148,13 +148,13 @@ namespace
|
||||
|
||||
uint8_t* get_entry_point()
|
||||
{
|
||||
const utils::nt::library game{};
|
||||
const utilities::nt::library game{};
|
||||
return game.get_ptr() + game.get_optional_header()->AddressOfEntryPoint;
|
||||
}
|
||||
|
||||
std::vector<uint8_t*> get_tls_callbacks()
|
||||
{
|
||||
const utils::nt::library game{};
|
||||
const utilities::nt::library game{};
|
||||
const auto& entry = game.get_optional_header()->DataDirectory[IMAGE_DIRECTORY_ENTRY_TLS];
|
||||
if (!entry.VirtualAddress || !entry.Size)
|
||||
{
|
||||
@ -222,7 +222,7 @@ HRESULT D3D11CreateDevice(void* adapter, const uint64_t driver_type,
|
||||
char dir[MAX_PATH]{ 0 };
|
||||
GetSystemDirectoryA(dir, sizeof(dir));
|
||||
|
||||
const auto d3d11 = utils::nt::library::load(dir + "/d3d11.dll"s);
|
||||
const auto d3d11 = utilities::nt::library::load(dir + "/d3d11.dll"s);
|
||||
return d3d11.get_proc<decltype(&D3D11CreateDevice)>("D3D11CreateDevice");
|
||||
}();
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include <std_include.hpp>
|
||||
|
||||
#include <utils/hook.hpp>
|
||||
#include <utilities/hook.hpp>
|
||||
#include <stack>
|
||||
|
||||
namespace spoofcall
|
||||
@ -30,7 +30,7 @@ namespace spoofcall
|
||||
return res;
|
||||
}
|
||||
|
||||
void callstack_return_stub(utils::hook::assembler& a)
|
||||
void callstack_return_stub(utilities::hook::assembler& a)
|
||||
{
|
||||
a.push(rax);
|
||||
a.pushad64();
|
||||
@ -49,14 +49,14 @@ namespace spoofcall
|
||||
{
|
||||
const auto placeholder = 0x1403CF1C6_g;
|
||||
|
||||
utils::hook::set<uint8_t>(placeholder - 2, 0xFF); // fakes a call
|
||||
utils::hook::nop(placeholder, 1);
|
||||
utils::hook::jump(placeholder + 1, utils::hook::assemble(callstack_return_stub));
|
||||
utilities::hook::set<uint8_t>(placeholder - 2, 0xFF); // fakes a call
|
||||
utilities::hook::nop(placeholder, 1);
|
||||
utilities::hook::jump(placeholder + 1, utilities::hook::assemble(callstack_return_stub));
|
||||
|
||||
return placeholder;
|
||||
}
|
||||
|
||||
void callstack_stub(utils::hook::assembler& a)
|
||||
void callstack_stub(utilities::hook::assembler& a)
|
||||
{
|
||||
a.push(rax);
|
||||
|
||||
@ -83,7 +83,7 @@ namespace spoofcall
|
||||
static bool spoofer_initialized = false;
|
||||
if (!spoofer_initialized)
|
||||
{
|
||||
callstack_proxy_addr = utils::hook::assemble(callstack_stub);
|
||||
callstack_proxy_addr = utilities::hook::assemble(callstack_stub);
|
||||
}
|
||||
|
||||
address_to_call = funcAddr;
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include <std_include.hpp>
|
||||
#include <utils/nt.hpp>
|
||||
#include <utilities/nt.hpp>
|
||||
|
||||
extern "C"
|
||||
{
|
||||
@ -27,7 +27,7 @@ extern "C"
|
||||
|
||||
size_t get_base()
|
||||
{
|
||||
static auto base = size_t(utils::nt::library{}.get_ptr());
|
||||
static auto base = size_t(utilities::nt::library{}.get_ptr());
|
||||
assert(base && "Failed to resolve base");
|
||||
return base;
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ namespace exception
|
||||
|
||||
std::string create_minidump(const LPEXCEPTION_POINTERS exceptioninfo)
|
||||
{
|
||||
const utils::nt::handle file_handle = write_dump_to_temp_file(exceptioninfo);
|
||||
const utilities::nt::handle file_handle = write_dump_to_temp_file(exceptioninfo);
|
||||
return read_file(file_handle);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "../utils/nt.hpp"
|
||||
#include "../utilities/nt.hpp"
|
||||
|
||||
namespace exception
|
||||
{
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include "nt.hpp"
|
||||
#include "io.hpp"
|
||||
|
||||
namespace utils
|
||||
namespace utilities
|
||||
{
|
||||
namespace
|
||||
{
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace utils
|
||||
namespace utilities
|
||||
{
|
||||
class binary_resource
|
||||
{
|
@ -8,7 +8,7 @@
|
||||
#include <ShlObj.h>
|
||||
|
||||
|
||||
namespace utils::com
|
||||
namespace utilities::com
|
||||
{
|
||||
namespace
|
||||
{
|
@ -4,7 +4,7 @@
|
||||
#include <ShlObj.h>
|
||||
#include <atlbase.h>
|
||||
|
||||
namespace utils::com
|
||||
namespace utilities::com
|
||||
{
|
||||
bool select_folder(std::string& out_folder, const std::string& title = "Select a Folder", const std::string& selected_folder = {});
|
||||
CComPtr<IProgressDialog> create_progress_dialog();
|
@ -8,7 +8,7 @@
|
||||
#include "io.hpp"
|
||||
#include "finally.hpp"
|
||||
|
||||
namespace utils::compression
|
||||
namespace utilities::compression
|
||||
{
|
||||
namespace zlib
|
||||
{
|
@ -5,7 +5,7 @@
|
||||
|
||||
#define CHUNK 16384u
|
||||
|
||||
namespace utils::compression
|
||||
namespace utilities::compression
|
||||
{
|
||||
namespace zlib
|
||||
{
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include <mutex>
|
||||
|
||||
namespace utils::concurrency
|
||||
namespace utilities::concurrency
|
||||
{
|
||||
template <typename T, typename MutexType = std::mutex>
|
||||
class container
|
@ -8,7 +8,7 @@ using namespace std::string_literals;
|
||||
|
||||
/// http://www.opensource.apple.com/source/CommonCrypto/CommonCrypto-55010/Source/libtomcrypt/doc/libTomCryptDoc.pdf
|
||||
|
||||
namespace utils::cryptography
|
||||
namespace utilities::cryptography
|
||||
{
|
||||
namespace
|
||||
{
|
@ -5,7 +5,7 @@
|
||||
#include <xxhash32.h>
|
||||
#include <xxhash64.h>
|
||||
|
||||
namespace utils::cryptography
|
||||
namespace utilities::cryptography
|
||||
{
|
||||
namespace ecc
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
#include <type_traits>
|
||||
|
||||
namespace utils
|
||||
namespace utilities
|
||||
{
|
||||
/*
|
||||
* Copied from here: https://github.com/microsoft/GSL/blob/e0880931ae5885eb988d1a8a57acf8bc2b8dacda/include/gsl/util#L57
|
@ -4,7 +4,7 @@
|
||||
|
||||
#include <shellapi.h>
|
||||
|
||||
namespace utils::flags
|
||||
namespace utilities::flags
|
||||
{
|
||||
void parse_flags(std::vector<std::string>& flags)
|
||||
{
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace utils::flags
|
||||
namespace utilities::flags
|
||||
{
|
||||
bool has_flag(const std::string& flag);
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
#include "hardware_breakpoint.hpp"
|
||||
#include "thread.hpp"
|
||||
|
||||
namespace utils::hardware_breakpoint
|
||||
namespace utilities::hardware_breakpoint
|
||||
{
|
||||
namespace
|
||||
{
|
@ -2,7 +2,7 @@
|
||||
#include <thread>
|
||||
#include "nt.hpp"
|
||||
|
||||
namespace utils::hardware_breakpoint
|
||||
namespace utilities::hardware_breakpoint
|
||||
{
|
||||
enum condition
|
||||
{
|
@ -15,7 +15,7 @@
|
||||
#undef min
|
||||
#endif
|
||||
|
||||
namespace utils::hook
|
||||
namespace utilities::hook
|
||||
{
|
||||
namespace
|
||||
{
|
@ -6,7 +6,7 @@
|
||||
|
||||
using namespace asmjit::x86;
|
||||
|
||||
namespace utils::hook
|
||||
namespace utilities::hook
|
||||
{
|
||||
namespace detail
|
||||
{
|
@ -2,7 +2,7 @@
|
||||
#include "nt.hpp"
|
||||
#include <atlcomcli.h>
|
||||
|
||||
namespace utils::http
|
||||
namespace utilities::http
|
||||
{
|
||||
std::optional<std::string> get_data(const std::string& url)
|
||||
{
|
@ -4,7 +4,7 @@
|
||||
#include <optional>
|
||||
#include <future>
|
||||
|
||||
namespace utils::http
|
||||
namespace utilities::http
|
||||
{
|
||||
std::optional<std::string> get_data(const std::string& url);
|
||||
std::future<std::optional<std::string>> get_data_async(const std::string& url);
|
@ -6,7 +6,7 @@
|
||||
#include <intrin.h>
|
||||
#include <lmcons.h>
|
||||
|
||||
namespace utils::identity
|
||||
namespace utilities::identity
|
||||
{
|
||||
namespace
|
||||
{
|
||||
@ -44,7 +44,7 @@ namespace utils::identity
|
||||
|
||||
std::string parse_uuid(const uint8_t* data)
|
||||
{
|
||||
if (utils::memory::is_set(data, 0, 16) || utils::memory::is_set(data, -1, 16))
|
||||
if (utilities::memory::is_set(data, 0, 16) || utilities::memory::is_set(data, -1, 16))
|
||||
{
|
||||
return {};
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace utils::identity
|
||||
namespace utilities::identity
|
||||
{
|
||||
std::string get_sys_username();
|
||||
std::string get_sys_uuid();
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include "finally.hpp"
|
||||
|
||||
namespace utils::image
|
||||
namespace utilities::image
|
||||
{
|
||||
image load_image(const std::string& data)
|
||||
{
|
@ -3,7 +3,7 @@
|
||||
#include <string>
|
||||
#include "nt.hpp"
|
||||
|
||||
namespace utils::image
|
||||
namespace utilities::image
|
||||
{
|
||||
struct image
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
#include "info_string.hpp"
|
||||
#include "string.hpp"
|
||||
|
||||
namespace utils
|
||||
namespace utilities
|
||||
{
|
||||
info_string::info_string(const std::string& buffer)
|
||||
{
|
@ -3,7 +3,7 @@
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace utils
|
||||
namespace utilities
|
||||
{
|
||||
class info_string
|
||||
{
|
@ -2,7 +2,7 @@
|
||||
#include "nt.hpp"
|
||||
#include <fstream>
|
||||
|
||||
namespace utils::io
|
||||
namespace utilities::io
|
||||
{
|
||||
bool remove_file(const std::string& file)
|
||||
{
|
||||
@ -86,6 +86,20 @@ namespace utils::io
|
||||
return path.substr(pos + 1);
|
||||
}
|
||||
|
||||
std::string file_stem(const std::string& path)
|
||||
{
|
||||
std::filesystem::path fsp(path);
|
||||
return fsp.stem().generic_string();
|
||||
}
|
||||
|
||||
std::string file_extension(const std::string& path)
|
||||
{
|
||||
const auto pos = path.find_last_of('.');
|
||||
if (pos == std::string::npos) return "";
|
||||
|
||||
return path.substr(pos + 1);
|
||||
}
|
||||
|
||||
size_t file_size(const std::string& file)
|
||||
{
|
||||
if (file_exists(file))
|
@ -4,7 +4,7 @@
|
||||
#include <vector>
|
||||
#include <filesystem>
|
||||
|
||||
namespace utils::io
|
||||
namespace utilities::io
|
||||
{
|
||||
bool remove_file(const std::string& file);
|
||||
bool move_file(const std::string& src, const std::string& target);
|
||||
@ -13,6 +13,8 @@ namespace utils::io
|
||||
bool read_file(const std::string& file, std::string* data);
|
||||
std::string read_file(const std::string& file);
|
||||
std::string file_name(const std::string& path);
|
||||
std::string file_stem(const std::string& path);
|
||||
std::string file_extension(const std::string& path);
|
||||
size_t file_size(const std::string& file);
|
||||
time_t file_timestamp(const std::string& file);
|
||||
bool create_directory(const std::string& directory);
|
@ -5,7 +5,7 @@
|
||||
#include <rapidjson/stringbuffer.h>
|
||||
#include <rapidjson/prettywriter.h>
|
||||
|
||||
namespace utils::json_config
|
||||
namespace utilities::json_config
|
||||
{
|
||||
rapidjson::Document json_doc{};
|
||||
std::string file_name = "project-bo4.json";
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
|
||||
namespace utils::json_config
|
||||
namespace utilities::json_config
|
||||
{
|
||||
bool ReadBoolean(const char* szSection, const char* szKey, bool bolDefaultValue);
|
||||
void WriteBoolean(const char* szSection, const char* szKey, bool bolValue);
|
@ -1,7 +1,7 @@
|
||||
#include "memory.hpp"
|
||||
#include "nt.hpp"
|
||||
|
||||
namespace utils
|
||||
namespace utilities
|
||||
{
|
||||
memory::allocator memory::mem_allocator_;
|
||||
|
||||
@ -144,7 +144,7 @@ namespace utils
|
||||
bool memory::is_rdata_ptr(void* pointer)
|
||||
{
|
||||
const std::string rdata = ".rdata";
|
||||
const auto pointer_lib = utils::nt::library::get_by_address(pointer);
|
||||
const auto pointer_lib = utilities::nt::library::get_by_address(pointer);
|
||||
|
||||
for (const auto& section : pointer_lib.get_section_headers())
|
||||
{
|
@ -3,7 +3,7 @@
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
|
||||
namespace utils
|
||||
namespace utilities
|
||||
{
|
||||
class memory final
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
#include "nt.hpp"
|
||||
|
||||
namespace utils::nt
|
||||
namespace utilities::nt
|
||||
{
|
||||
library library::load(const char* name)
|
||||
{
|
||||
@ -251,7 +251,7 @@ namespace utils::nt
|
||||
|
||||
void relaunch_self()
|
||||
{
|
||||
const utils::nt::library self;
|
||||
const utilities::nt::library self;
|
||||
|
||||
STARTUPINFOA startup_info;
|
||||
PROCESS_INFORMATION process_info;
|
@ -16,7 +16,7 @@
|
||||
#include <functional>
|
||||
#include <filesystem>
|
||||
|
||||
namespace utils::nt
|
||||
namespace utilities::nt
|
||||
{
|
||||
class library final
|
||||
{
|
@ -1,12 +1,12 @@
|
||||
#include "progress_ui.hpp"
|
||||
|
||||
#include <utils/string.hpp>
|
||||
#include "string.hpp"
|
||||
|
||||
namespace utils
|
||||
namespace utilities
|
||||
{
|
||||
progress_ui::progress_ui()
|
||||
{
|
||||
this->dialog_ = utils::com::create_progress_dialog();
|
||||
this->dialog_ = utilities::com::create_progress_dialog();
|
||||
if (!this->dialog_)
|
||||
{
|
||||
throw std::runtime_error{"Failed to create dialog"};
|
||||
@ -30,12 +30,12 @@ namespace utils
|
||||
|
||||
void progress_ui::set_line(const int line, const std::string& text) const
|
||||
{
|
||||
this->dialog_->SetLine(line, utils::string::convert(text).data(), false, nullptr);
|
||||
this->dialog_->SetLine(line, utilities::string::convert(text).data(), false, nullptr);
|
||||
}
|
||||
|
||||
void progress_ui::set_title(const std::string& title) const
|
||||
{
|
||||
this->dialog_->SetTitle(utils::string::convert(title).data());
|
||||
this->dialog_->SetTitle(utilities::string::convert(title).data());
|
||||
}
|
||||
|
||||
bool progress_ui::is_cancelled() const
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include "com.hpp"
|
||||
|
||||
namespace utils
|
||||
namespace utilities
|
||||
{
|
||||
class progress_ui
|
||||
{
|
@ -13,7 +13,7 @@
|
||||
#undef min
|
||||
#endif
|
||||
|
||||
namespace utils::hook
|
||||
namespace utilities::hook
|
||||
{
|
||||
void signature::load_pattern(const std::string& pattern)
|
||||
{
|
||||
@ -143,7 +143,7 @@ namespace utils::hook
|
||||
|
||||
signature::signature_result signature::process() const
|
||||
{
|
||||
//MessageBoxA(nullptr, utils::string::va("%llX(%llX)%llX", *this->start_ , this->start_, this->length_), "signature::process", MB_OK | MB_ICONINFORMATION);
|
||||
//MessageBoxA(nullptr, utilities::string::va("%llX(%llX)%llX", *this->start_ , this->start_, this->length_), "signature::process", MB_OK | MB_ICONINFORMATION);
|
||||
|
||||
const auto range = this->length_ - this->mask_.size();
|
||||
const auto cores = std::max(1u, std::thread::hardware_concurrency());
|
||||
@ -217,7 +217,7 @@ namespace utils::hook
|
||||
}
|
||||
}
|
||||
|
||||
utils::hook::signature::signature_result operator"" _sig(const char* str, const size_t len)
|
||||
utilities::hook::signature::signature_result operator"" _sig(const char* str, const size_t len)
|
||||
{
|
||||
return utils::hook::signature(std::string(str, len)).process();
|
||||
return utilities::hook::signature(std::string(str, len)).process();
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
#include "nt.hpp"
|
||||
#include <cstdint>
|
||||
|
||||
namespace utils::hook
|
||||
namespace utilities::hook
|
||||
{
|
||||
class signature final
|
||||
{
|
||||
@ -46,4 +46,4 @@ namespace utils::hook
|
||||
};
|
||||
}
|
||||
|
||||
utils::hook::signature::signature_result operator"" _sig(const char* str, size_t len);
|
||||
utilities::hook::signature::signature_result operator"" _sig(const char* str, size_t len);
|
@ -1,11 +1,11 @@
|
||||
#include "string.hpp"
|
||||
#include <sstream>
|
||||
#include <regex>
|
||||
#include <cstdarg>
|
||||
#include <algorithm>
|
||||
|
||||
#include "nt.hpp"
|
||||
|
||||
namespace utils::string
|
||||
namespace utilities::string
|
||||
{
|
||||
const char* va(const char* fmt, ...)
|
||||
{
|
||||
@ -71,6 +71,10 @@ namespace utils::string
|
||||
return text;
|
||||
}
|
||||
|
||||
bool is_integer(const std::string& str) {
|
||||
return std::regex_match(str, std::regex("[(-|+)|][0-9]+"));
|
||||
}
|
||||
|
||||
bool starts_with(const std::string& text, const std::string& substring)
|
||||
{
|
||||
return text.find(substring) == 0;
|
||||
@ -213,4 +217,15 @@ namespace utils::string
|
||||
if (!sensetive && (to_lower(s1) == to_lower(s2))) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool contains(std::string text, std::string substr, bool sensetive)
|
||||
{
|
||||
if (!sensetive) {
|
||||
text = to_lower(text);
|
||||
substr = to_lower(substr);
|
||||
}
|
||||
|
||||
if (text.find(substr) != std::string::npos) return true;
|
||||
return false;
|
||||
}
|
||||
}
|
@ -7,7 +7,7 @@ template <class Type, size_t n>
|
||||
size_t ARRAYSIZE(Type (&)[n]) { return n; }
|
||||
#endif
|
||||
|
||||
namespace utils::string
|
||||
namespace utilities::string
|
||||
{
|
||||
template <size_t Buffers, size_t MinBufferSize>
|
||||
class va_provider final
|
||||
@ -85,6 +85,9 @@ namespace utils::string
|
||||
|
||||
std::string to_lower(std::string text);
|
||||
std::string to_upper(std::string text);
|
||||
|
||||
bool is_integer(const std::string& str);
|
||||
|
||||
bool starts_with(const std::string& text, const std::string& substring);
|
||||
bool ends_with(const std::string& text, const std::string& substring);
|
||||
|
||||
@ -101,4 +104,5 @@ namespace utils::string
|
||||
|
||||
double match(const std::string& input, const std::string& text);
|
||||
bool compare(const std::string& s1, const std::string& s2, bool sensetive = false);
|
||||
bool contains(std::string text, std::string substr, bool sensetive = false);
|
||||
}
|
@ -4,7 +4,7 @@
|
||||
|
||||
#include <TlHelp32.h>
|
||||
|
||||
namespace utils::thread
|
||||
namespace utilities::thread
|
||||
{
|
||||
bool set_name(const HANDLE t, const std::string& name)
|
||||
{
|
||||
@ -28,7 +28,7 @@ namespace utils::thread
|
||||
auto* const t = OpenThread(THREAD_SET_LIMITED_INFORMATION, FALSE, id);
|
||||
if (!t) return false;
|
||||
|
||||
const auto _ = utils::finally([t]()
|
||||
const auto _ = utilities::finally([t]()
|
||||
{
|
||||
CloseHandle(t);
|
||||
});
|
@ -2,7 +2,7 @@
|
||||
#include <thread>
|
||||
#include "nt.hpp"
|
||||
|
||||
namespace utils::thread
|
||||
namespace utilities::thread
|
||||
{
|
||||
bool set_name(HANDLE t, const std::string& name);
|
||||
bool set_name(DWORD id, const std::string& name);
|
Loading…
Reference in New Issue
Block a user