Basic 1.15 support

This commit is contained in:
momo5502 2022-05-17 10:38:54 +02:00
parent 5de685e1e0
commit a5a3fdd672
6 changed files with 39 additions and 10 deletions

View File

@ -302,7 +302,7 @@ targetname "h1-mod"
pchheader "std_include.hpp"
pchsource "src/client/std_include.cpp"
linkoptions {"/IGNORE:4254", "/DYNAMICBASE:NO", "/SAFESEH:NO", "/LARGEADDRESSAWARE", "/LAST:.main", "/PDBCompress"}
linkoptions {"/IGNORE:4254", "/SAFESEH:NO", "/LARGEADDRESSAWARE", "/PDBCompress"}
files {"./src/client/**.rc", "./src/client/**.hpp", "./src/client/**.cpp", "./src/client/resources/**.*"}

View File

@ -9,6 +9,24 @@ namespace arxan
{
namespace
{
DWORD get_steam_pid()
{
static DWORD pid = 0; //234567;//GetCurrentProcessId();
if (pid) return pid;
HKEY hRegKey;
if (RegOpenKeyExA(HKEY_CURRENT_USER, "Software\\Valve\\Steam\\ActiveProcess", 0, KEY_QUERY_VALUE,
&hRegKey) != ERROR_SUCCESS)
return pid;
DWORD dwLength = sizeof(pid);
RegQueryValueExA(hRegKey, "pid", nullptr, nullptr, reinterpret_cast<BYTE*>(&pid), &dwLength);
RegCloseKey(hRegKey);
return pid;
}
utils::hook::detour nt_close_hook;
utils::hook::detour nt_query_information_process_hook;
@ -31,7 +49,7 @@ namespace arxan
GetWindowThreadProcessId(shell_window, &explorer_pid);
}
static_cast<PPROCESS_BASIC_INFORMATION>(info)->Reserved3 = PVOID(DWORD64(explorer_pid));
static_cast<PPROCESS_BASIC_INFORMATION>(info)->Reserved3 = PVOID(DWORD64(get_steam_pid()));
}
else if (info_class == 30) // ProcessDebugObjectHandle
{

View File

@ -57,7 +57,8 @@ FARPROC load_binary(const launcher::mode mode, uint64_t* base_address)
loader.set_import_resolver([self](const std::string& library, const std::string& function) -> void*
{
if (library == "steam_api64.dll")
if (library == "steam_api64.dll"
&& function != "SteamAPI_GetSteamInstallPath") // Arxan requires one valid steam api import - maybe SteamAPI_Shutdown is better?
{
return self.get_proc<FARPROC>(function);
}

View File

@ -1,15 +1,15 @@
#include <std_include.hpp>
#pragma comment(linker, "/stack:0x1000000")
#ifdef INJECT_HOST_AS_LIB
//#pragma comment(linker, "/base:0x160000000")
#else
#pragma comment(linker, "/base:0x140000000")
#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=''\"")
@ -47,3 +47,4 @@ extern "C"
return -1;
}
}

View File

@ -3,7 +3,7 @@
#define BINARY_PAYLOAD_SIZE 0x14000000
// Decide whether to load the game as lib or to inject it
//#define INJECT_HOST_AS_LIB
#define INJECT_HOST_AS_LIB
#pragma warning(push)
#pragma warning(disable: 4100)

View File

@ -1,6 +1,8 @@
#include <std_include.hpp>
#include "steam.hpp"
#include <utils/nt.hpp>
namespace steam
{
uint64_t callbacks::call_id_ = 0;
@ -108,6 +110,13 @@ namespace steam
bool SteamAPI_Init()
{
const std::filesystem::path steam_path = steam::SteamAPI_GetSteamInstallPath();
if (steam_path.empty()) return true;
::utils::nt::library::load(steam_path / "tier0_s64.dll");
::utils::nt::library::load(steam_path / "vstdlib_s64.dll");
::utils::nt::library::load(steam_path / "gameoverlayrenderer64.dll");
::utils::nt::library::load(steam_path / "steamclient64.dll");
return true;
}