From 1b49fa24e58c9263acb302db5dd59940fffa21e5 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Fri, 30 Oct 2026 22:04:36 +0000 Subject: [PATCH] Decompile fn_24361 (StartClientProcess) Batch #6337 by eAthena: 0 byte-identical, 1 confirmed by peer review. - fn_24361 StartClientProcess: logic confirmed by peer review Peer-reviewed-by: alisonrag, KWDev, SapitoSucio Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Client/Application/Launcher.cpp | 45 +++++++++++++++++++++++++- Source/Client/Application/Launcher.h | 9 ++++++ 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/Source/Client/Application/Launcher.cpp b/Source/Client/Application/Launcher.cpp index 79f93182..3bfe2c6c 100644 --- a/Source/Client/Application/Launcher.cpp +++ b/Source/Client/Application/Launcher.cpp @@ -1,7 +1,7 @@ #include "Client/Application/Launcher.h" #include "Utility/Cipher/XorBytes.h" #include "Utility/Text/FormatString.h" - +#include "Contents/Configuration/ServiceConfiguration.h" #include #include #include @@ -664,3 +664,46 @@ bool AcquireInstanceMutex(HANDLE* mutex) { *mutex = CreateMutexA(nullptr, TRUE, "MutexInit"); return GetLastError() != ERROR_ALREADY_EXISTS; } + +// GLOBAL: gl_24515 +char* g_commandLine; + +// GLOBAL: gl_25074 +bool g_launchAccountEnabled; + +// GLOBAL: gl_25075 +char g_launchAccountName[0x1F4]; + +// GLOBAL: gl_25076 +char g_launchAccountPassword[24]; + +// GLOBAL: gl_25077 +char g_launchAccountSex; + +// GLOBAL: gl_25078 +bool g_launchPassCommandLine; + +// OFFSET: 0x00E57E60 +// FUNCTION: fn_24361 +HANDLE StartClientProcess(char* program) { + char commandLine[1024]; + std::memset(commandLine, 0, sizeof(commandLine)); + + if (g_launchPassCommandLine) { + StringFormat(commandLine, sizeof(commandLine), static_cast(-1), "%s %s", program, g_commandLine); + } else if (g_launchAccountEnabled) { + StringFormat(commandLine, sizeof(commandLine), static_cast(-1), "%s %s %s %c %s", program, g_launchAccountName, + g_launchAccountPassword, g_launchAccountSex, g_launchServerName); + } else { + StringFormat(commandLine, sizeof(commandLine), static_cast(-1), program); + } + + STARTUPINFOA startup = {}; + startup.cb = sizeof(startup); + startup.dwFlags = STARTF_USESHOWWINDOW; + startup.wShowWindow = SW_SHOWNORMAL; + PROCESS_INFORMATION process = {}; + + CreateProcessA(nullptr, commandLine, nullptr, nullptr, FALSE, 0, nullptr, nullptr, &startup, &process); + return process.hProcess; +} diff --git a/Source/Client/Application/Launcher.h b/Source/Client/Application/Launcher.h index 944c682c..20912c71 100644 --- a/Source/Client/Application/Launcher.h +++ b/Source/Client/Application/Launcher.h @@ -12,4 +12,13 @@ bool RestartFromCommandLine(char* commandLine); void ExitForProtectionCheck(const char* commandLine); bool AcquireInstanceMutex(HANDLE* mutex); +extern char* g_commandLine; +extern bool g_launchAccountEnabled; +extern char g_launchAccountName[0x1F4]; +extern char g_launchAccountPassword[24]; +extern char g_launchAccountSex; +extern bool g_launchPassCommandLine; + +HANDLE StartClientProcess(char* program); + #endif