mirror of
https://github.com/aria2/aria2.git
synced 2025-01-04 00:53:19 +00:00
Use CreateProcessW instead of CreateProcessA
This commit is contained in:
parent
3f7561b80c
commit
ef86d760cc
28
src/util.cc
28
src/util.cc
@ -1515,7 +1515,7 @@ void executeHook
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
PROCESS_INFORMATION pi;
|
PROCESS_INFORMATION pi;
|
||||||
STARTUPINFO si;
|
STARTUPINFOW si;
|
||||||
|
|
||||||
memset(&si, 0, sizeof (si));
|
memset(&si, 0, sizeof (si));
|
||||||
si.cb = sizeof(STARTUPINFO);
|
si.cb = sizeof(STARTUPINFO);
|
||||||
@ -1549,18 +1549,22 @@ void executeHook
|
|||||||
if(batch) {
|
if(batch) {
|
||||||
cmdline += "\"";
|
cmdline += "\"";
|
||||||
}
|
}
|
||||||
|
int cmdlineLen = utf8ToWChar(0, 0, cmdline.c_str());
|
||||||
|
assert(cmdlineLen > 0);
|
||||||
|
array_ptr<wchar_t> wcharCmdline(new wchar_t[cmdlineLen]);
|
||||||
|
cmdlineLen = utf8ToWChar(wcharCmdline, cmdlineLen, cmdline.c_str());
|
||||||
|
assert(cmdlineLen > 0);
|
||||||
A2_LOG_INFO(fmt("Executing user command: %s", cmdline.c_str()));
|
A2_LOG_INFO(fmt("Executing user command: %s", cmdline.c_str()));
|
||||||
DWORD rc = CreateProcess(
|
DWORD rc = CreateProcessW(batch ? utf8ToWChar(cmdexe).c_str() : NULL,
|
||||||
batch ? cmdexe.c_str() : NULL,
|
wcharCmdline,
|
||||||
(LPSTR)cmdline.c_str(),
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
true,
|
||||||
true,
|
0,
|
||||||
0,
|
NULL,
|
||||||
NULL,
|
0,
|
||||||
0,
|
&si,
|
||||||
&si,
|
&pi);
|
||||||
&pi);
|
|
||||||
|
|
||||||
if(!rc) {
|
if(!rc) {
|
||||||
A2_LOG_ERROR("CreateProcess() failed. Cannot execute user command.");
|
A2_LOG_ERROR("CreateProcess() failed. Cannot execute user command.");
|
||||||
|
Loading…
Reference in New Issue
Block a user