Get rid of the runner
This commit is contained in:
parent
89898c974e
commit
13be8f3894
17
premake5.lua
17
premake5.lua
@ -299,7 +299,7 @@ project "client"
|
||||
|
||||
resincludedirs {"$(ProjectDir)src"}
|
||||
|
||||
dependson {"tlsdll", "runner"}
|
||||
dependson {"tlsdll"}
|
||||
|
||||
links {"common"}
|
||||
|
||||
@ -324,20 +324,5 @@ project "tlsdll"
|
||||
resincludedirs {"$(ProjectDir)src"}
|
||||
|
||||
|
||||
project "runner"
|
||||
kind "WindowedApp"
|
||||
language "C++"
|
||||
|
||||
files {"./src/runner/**.rc", "./src/runner/**.hpp", "./src/runner/**.cpp", "./src/runner/resources/**.*"}
|
||||
|
||||
includedirs {"./src/runner", "./src/common", "%{prj.location}/src"}
|
||||
|
||||
links {"common"}
|
||||
|
||||
resincludedirs {"$(ProjectDir)src"}
|
||||
|
||||
dependencies.imports()
|
||||
|
||||
|
||||
group "Dependencies"
|
||||
dependencies.projects()
|
||||
|
@ -444,7 +444,7 @@ namespace demonware
|
||||
class component final : public component_interface
|
||||
{
|
||||
public:
|
||||
component()
|
||||
void pre_load() override
|
||||
{
|
||||
udp_servers.create<stun_server>("stun.us.demonware.net");
|
||||
udp_servers.create<stun_server>("stun.eu.demonware.net");
|
||||
|
@ -196,7 +196,7 @@ namespace exception
|
||||
class component final : public component_interface
|
||||
{
|
||||
public:
|
||||
component()
|
||||
void pre_load() override
|
||||
{
|
||||
main_thread_id = GetCurrentThreadId();
|
||||
SetUnhandledExceptionFilter(exception_filter);
|
||||
|
@ -56,9 +56,10 @@ namespace splash
|
||||
class component final : public component_interface
|
||||
{
|
||||
public:
|
||||
component()
|
||||
: image_(load_splash_image())
|
||||
void pre_load() override
|
||||
{
|
||||
this->image_ = load_splash_image();
|
||||
|
||||
enable_dpi_awareness();
|
||||
window_thread = std::thread([this]
|
||||
{
|
||||
@ -66,19 +67,15 @@ namespace splash
|
||||
});
|
||||
}
|
||||
|
||||
~component()
|
||||
void pre_destroy() override
|
||||
{
|
||||
destroy_window();
|
||||
if (window_thread.joinable())
|
||||
{
|
||||
window_thread.detach();
|
||||
}
|
||||
}
|
||||
|
||||
void pre_destroy() override
|
||||
{
|
||||
destroy_window();
|
||||
}
|
||||
|
||||
void post_unpack() override
|
||||
{
|
||||
destroy_window();
|
||||
|
@ -19,8 +19,6 @@ namespace steam_proxy
|
||||
{
|
||||
namespace
|
||||
{
|
||||
utils::binary_resource runner_file(RUNNER, "boiii-runner.exe");
|
||||
|
||||
utils::nt::library steam_client_module{};
|
||||
utils::nt::library steam_overlay_module{};
|
||||
|
||||
@ -155,7 +153,8 @@ namespace steam_proxy
|
||||
char our_directory[MAX_PATH] = {0};
|
||||
GetCurrentDirectoryA(sizeof(our_directory), our_directory);
|
||||
|
||||
const auto path = runner_file.get_extracted_file();
|
||||
const auto self = utils::nt::library::get_by_address(start_mod_unsafe);
|
||||
const auto path = self.get_path();
|
||||
const std::string cmdline = utils::string::va("\"%s\" -proc %d", path.data(), GetCurrentProcessId());
|
||||
|
||||
steam::game_id game_id;
|
||||
|
@ -130,7 +130,7 @@ namespace updater
|
||||
class component final : public component_interface
|
||||
{
|
||||
public:
|
||||
component()
|
||||
void pre_load() override
|
||||
{
|
||||
cleanup_update();
|
||||
|
||||
@ -140,14 +140,6 @@ namespace updater
|
||||
});
|
||||
}
|
||||
|
||||
~component() override
|
||||
{
|
||||
if (this->update_thread_.joinable())
|
||||
{
|
||||
this->update_thread_.detach();
|
||||
}
|
||||
}
|
||||
|
||||
void pre_destroy() override
|
||||
{
|
||||
join();
|
||||
|
@ -138,14 +138,40 @@ namespace
|
||||
return FARPROC(proc.get_ptr() + proc.get_relative_entry_point());
|
||||
}
|
||||
|
||||
bool handle_process_runner()
|
||||
{
|
||||
const auto* const command = "-proc ";
|
||||
const char* parent_proc = strstr(GetCommandLineA(), command);
|
||||
|
||||
if (!parent_proc)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const auto pid = DWORD(atoi(parent_proc + strlen(command)));
|
||||
const utils::nt::handle<> process_handle = OpenProcess(SYNCHRONIZE, FALSE, pid);
|
||||
if (process_handle)
|
||||
{
|
||||
WaitForSingleObject(process_handle, INFINITE);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
if (handle_process_runner())
|
||||
{
|
||||
TerminateProcess(GetCurrentProcess(), 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
FARPROC entry_point{};
|
||||
srand(uint32_t(time(nullptr)) ^ ~(GetTickCount() * GetCurrentProcessId()));
|
||||
|
||||
{
|
||||
auto premature_shutdown = true;
|
||||
const auto _ = utils::finally([&premature_shutdown]()
|
||||
const auto _ = utils::finally([&premature_shutdown]
|
||||
{
|
||||
if (premature_shutdown)
|
||||
{
|
||||
|
@ -12,5 +12,4 @@
|
||||
#define DW_KEYS 306
|
||||
#define DW_QOSCONFIG 307
|
||||
|
||||
#define RUNNER 308
|
||||
#define TLS_DLL 309
|
||||
#define TLS_DLL 308
|
||||
|
@ -102,12 +102,6 @@ DW_FASTFILE RCDATA "resources/dw/core_ffotd_tu32_593.ff"
|
||||
DW_KEYS RCDATA "resources/dw/keys.txt"
|
||||
DW_QOSCONFIG RCDATA "resources/dw/qosconfig4.csv"
|
||||
|
||||
#ifdef _DEBUG
|
||||
RUNNER RCDATA "../../build/bin/x64/Debug/runner.exe"
|
||||
#else
|
||||
RUNNER RCDATA "../../build/bin/x64/Release/runner.exe"
|
||||
#endif
|
||||
|
||||
#ifdef _DEBUG
|
||||
TLS_DLL RCDATA "../../build/bin/x64/Debug/tlsdll.dll"
|
||||
#else
|
||||
|
@ -1,100 +0,0 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
#pragma code_page(65001)
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "windows.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (United States) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#include ""windows.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,0,0,0
|
||||
PRODUCTVERSION 1,0,0,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x40004L
|
||||
FILETYPE VFT_DLL
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "X Labs"
|
||||
VALUE "FileDescription", "Steam mod runner"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
VALUE "InternalName", "Runner"
|
||||
VALUE "LegalCopyright", "All rights reserved."
|
||||
VALUE "OriginalFilename", "runner.exe"
|
||||
VALUE "ProductName", "runner"
|
||||
VALUE "ProductVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Binary Data
|
||||
//
|
||||
|
||||
102 ICON "../client/resources/icon.ico"
|
||||
|
||||
#endif // English (United States) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
@ -1,21 +0,0 @@
|
||||
#include <utils/nt.hpp>
|
||||
#include <cstdlib>
|
||||
|
||||
int __stdcall WinMain(HINSTANCE, HINSTANCE, PSTR, int)
|
||||
{
|
||||
const auto* const command = "-proc ";
|
||||
const char* parent_proc = strstr(GetCommandLineA(), command);
|
||||
|
||||
if (parent_proc)
|
||||
{
|
||||
const auto pid = DWORD(atoi(parent_proc + strlen(command)));
|
||||
const utils::nt::handle<> process_handle = OpenProcess(SYNCHRONIZE, FALSE, pid);
|
||||
if (process_handle)
|
||||
{
|
||||
WaitForSingleObject(process_handle, INFINITE);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
Loading…
Reference in New Issue
Block a user