*Functions4U: Fix bug detected by biobytes

git-svn-id: svn://ultimatepp.org/upp/trunk@9695 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
koldo 2016-04-14 06:31:28 +00:00
parent ef8bd1fc02
commit 387e9bea8b

View file

@ -132,13 +132,10 @@ bool LocalProcess2::DoStart(const char *_command, const Vector<String> *arg, boo
if(*s == '\0') {
command.Cat('\\', 2 * num_backslashes);
break;
}
else
if(*s == '\"') {
} else if(*s == '\"') {
command.Cat('\\', 2 * num_backslashes + 1);
command << '\"';
}
else {
} else {
command.Cat('\\', num_backslashes);
command.Cat(*s);
}
@ -148,14 +145,14 @@ bool LocalProcess2::DoStart(const char *_command, const Vector<String> *arg, boo
}
}
}
WStringBuffer wscmd(ToSystemCharsetW(command));
WString wscmd(ToSystemCharsetW(command));
WString wsdir(ToSystemCharsetW(dir));
const wchar *wdir;
if (dir == 0)
wdir = 0;
else
wdir = wsdir;
bool h = CreateProcessW(NULL, wscmd, &sa, &sa, TRUE, NORMAL_PRIORITY_CLASS, (void *)envptr, wdir, &si, &pi);
bool h = CreateProcessW(NULL, WStringBuffer(wscmd), &sa, &sa, TRUE, NORMAL_PRIORITY_CLASS, (void *)envptr, wdir, &si, &pi);
LLOG("CreateProcess " << (h ? "succeeded" : "failed"));
CloseHandle(hErrorWrite);
CloseHandle(hInputRead);