mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-10 01:09:50 +00:00
Changed: Detect .bat file in launchProgram and adapt syntax of CreateProcess
--HG-- branch : develop
This commit is contained in:
parent
27e7efca56
commit
923434aa72
2 changed files with 19 additions and 4 deletions
|
@ -732,7 +732,22 @@ bool launchProgram(const std::string &programName, const std::string &arguments,
|
|||
SetEnvironmentVariable( SE_TRANSLATOR_IN_MAIN_MODULE, NULL );
|
||||
}
|
||||
|
||||
BOOL res = CreateProcessA(programName.empty() ? NULL:programName.c_str(), (char*)arguments.c_str(), NULL, NULL, FALSE, CREATE_DEFAULT_ERROR_MODE | CREATE_NO_WINDOW, NULL, NULL, &si, &pi);
|
||||
const char *sProgramName = programName.c_str();
|
||||
|
||||
std::string args;
|
||||
|
||||
// a .bat file must have first parameter to NULL and use 2nd parameter to pass filename
|
||||
if (CFile::getExtension(programName) == "bat")
|
||||
{
|
||||
sProgramName = NULL;
|
||||
args = "\"" + programName + "\" " + arguments;
|
||||
}
|
||||
else
|
||||
{
|
||||
args = arguments;
|
||||
}
|
||||
|
||||
BOOL res = CreateProcessA(sProgramName, (char*)args.c_str(), NULL, NULL, FALSE, CREATE_DEFAULT_ERROR_MODE | CREATE_NO_WINDOW, NULL, NULL, &si, &pi);
|
||||
|
||||
if (res)
|
||||
{
|
||||
|
|
|
@ -938,14 +938,14 @@ void CPatchManager::executeBatchFile()
|
|||
chmod(batchFilename.c_str(), S_IRWXU);
|
||||
#endif
|
||||
|
||||
std::string cmdLine = "\"" + batchFilename + "\" " + LoginLogin + " " + LoginPassword;
|
||||
std::string arguments = LoginLogin + " " + LoginPassword;
|
||||
|
||||
if (!r2Mode)
|
||||
{
|
||||
cmdLine += " " + toString(LoginShardId);
|
||||
arguments += " " + toString(LoginShardId);
|
||||
}
|
||||
|
||||
if (launchProgram("", cmdLine, false))
|
||||
if (launchProgram(batchFilename, arguments, false))
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue