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).
This commit is contained in:
ragnarok-clanker 2026-10-30 22:04:36 +00:00
commit 1b49fa24e5
2 changed files with 53 additions and 1 deletions

View file

@ -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 <cstddef>
#include <cstdint>
#include <cstring>
@ -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<std::size_t>(-1), "%s %s", program, g_commandLine);
} else if (g_launchAccountEnabled) {
StringFormat(commandLine, sizeof(commandLine), static_cast<std::size_t>(-1), "%s %s %s %c %s", program, g_launchAccountName,
g_launchAccountPassword, g_launchAccountSex, g_launchServerName);
} else {
StringFormat(commandLine, sizeof(commandLine), static_cast<std::size_t>(-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;
}

View file

@ -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