Core: Fixup AutoUpdateChecker::TriggerUpdate on Windows:

- Properly close handles if Updater.exe process spawns successfully
- Fix STARTUPINFO sizeof typo
This commit is contained in:
Silent 2019-06-24 21:02:30 +02:00
parent a00dfeecf0
commit 4b03790eda
No known key found for this signature in database
GPG Key ID: AE53149BB0C45AF1

View File

@ -234,12 +234,16 @@ void AutoUpdateChecker::TriggerUpdate(const AutoUpdateChecker::NewVersionInforma
INFO_LOG(COMMON, "Updater command line: %s", command_line.c_str());
#ifdef _WIN32
STARTUPINFO sinfo = {sizeof(info)};
STARTUPINFO sinfo = {sizeof(sinfo)};
sinfo.dwFlags = STARTF_FORCEOFFFEEDBACK; // No hourglass cursor after starting the process.
PROCESS_INFORMATION pinfo;
if (!CreateProcessW(UTF8ToUTF16(reloc_updater_path).c_str(),
const_cast<wchar_t*>(UTF8ToUTF16(command_line).c_str()), nullptr, nullptr,
FALSE, 0, nullptr, nullptr, &sinfo, &pinfo))
if (CreateProcessW(UTF8ToUTF16(reloc_updater_path).c_str(), UTF8ToUTF16(command_line).data(),
nullptr, nullptr, FALSE, 0, nullptr, nullptr, &sinfo, &pinfo))
{
CloseHandle(pinfo.hThread);
CloseHandle(pinfo.hProcess);
}
else
{
ERROR_LOG(COMMON, "Could not start updater process: error=%d", GetLastError());
}