diff --git a/src/client/component/arxan.cpp b/src/client/component/arxan.cpp index c59ae317..528de35e 100644 --- a/src/client/component/arxan.cpp +++ b/src/client/component/arxan.cpp @@ -147,12 +147,12 @@ namespace arxan if (game::environment::is_sp()) return; // some of arxan crashes - utils::hook::nop(0xCDEFCAA_b, 6); - utils::hook::nop(0x930FCAA_b, 6); - utils::hook::nop(0x867B66_b, 4); - utils::hook::nop(0x81F0C0_b, 6); - utils::hook::nop(0x5813609_b, 6); - utils::hook::nop(0x8DD678_b, 0xEB); + // utils::hook::nop(0xCDEFCAA_b, 6); + // utils::hook::nop(0x930FCAA_b, 6); + // utils::hook::nop(0x867B66_b, 4); + // utils::hook::nop(0x81F0C0_b, 6); + // utils::hook::nop(0x5813609_b, 6); + // utils::hook::nop(0x8DD678_b, 0xEB); //utils::hook::nop(0xB3D96_b, 4); } }; diff --git a/src/client/component/game_module.cpp b/src/client/component/game_module.cpp index 8774634d..0ec79d45 100644 --- a/src/client/component/game_module.cpp +++ b/src/client/component/game_module.cpp @@ -111,7 +111,11 @@ namespace game_module void post_load() override { +#ifdef INJECT_HOST_AS_LIB hook_module_resolving(); +#else + assert(get_host_module() == get_game_module()); +#endif } }; } diff --git a/src/client/main.cpp b/src/client/main.cpp index 247d18a0..c6f7ad62 100644 --- a/src/client/main.cpp +++ b/src/client/main.cpp @@ -22,7 +22,7 @@ BOOL WINAPI system_parameters_info_a(const UINT uiAction, const UINT uiParam, co FARPROC WINAPI get_proc_address(const HMODULE hModule, const LPCSTR lpProcName) { - if (lpProcName == "GlobalMemoryStatusEx"s) + if (lpProcName == "InitializeCriticalSectionEx"s) { component_loader::post_unpack(); } @@ -50,11 +50,6 @@ launcher::mode detect_mode_from_arguments() return launcher::mode::none; } -int returning() -{ - return 1; -} - FARPROC load_binary(const launcher::mode mode, uint64_t* base_address) { loader loader; @@ -79,11 +74,6 @@ FARPROC load_binary(const launcher::mode mode, uint64_t* base_address) return get_proc_address; } - if (function == "LoadStringA" || function == "LoadStringW") - { - return returning; - } - return component_loader::load_import(library, function); }); @@ -110,7 +100,12 @@ FARPROC load_binary(const launcher::mode mode, uint64_t* base_address) binary.data())); } +#ifdef INJECT_HOST_AS_LIB return loader.load_library(binary, base_address); +#else + *base_address = 0x140000000; + return loader.load(self, data); +#endif } void remove_crash_file() diff --git a/src/client/std_include.cpp b/src/client/std_include.cpp index efe6cd64..75331ed0 100644 --- a/src/client/std_include.cpp +++ b/src/client/std_include.cpp @@ -1,6 +1,23 @@ #include +#pragma comment(linker, "/merge:.data=.cld") +#pragma comment(linker, "/merge:.rdata=.clr") +#pragma comment(linker, "/merge:.cl=.main") +#pragma comment(linker, "/merge:.text=.main") +#pragma comment(linker, "/stack:0x1000000") + +#ifdef INJECT_HOST_AS_LIB #pragma comment(linker, "/base:0x160000000") +#else +#pragma comment(linker, "/base:0x140000000") +#endif + +#pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language=''\"") + +#ifndef INJECT_HOST_AS_LIB +#pragma bss_seg(".payload") +char payload_data[BINARY_PAYLOAD_SIZE]; +#endif extern "C" { diff --git a/src/client/std_include.hpp b/src/client/std_include.hpp index 98a00a2d..0fd21793 100644 --- a/src/client/std_include.hpp +++ b/src/client/std_include.hpp @@ -1,6 +1,9 @@ #pragma once -#define BINARY_PAYLOAD_SIZE 0x12000000 +#define BINARY_PAYLOAD_SIZE 0x14000000 + +// Decide whether to load the game as lib or to inject it +//#define INJECT_HOST_AS_LIB #pragma warning(push) #pragma warning(disable: 4100)