Quote the path to sunshinesvc.exe when launching the termination helper (#2379)

This commit is contained in:
Cameron Gutman 2024-04-06 18:21:03 -05:00 committed by GitHub
parent 7f795f0e19
commit 93e622342c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -145,8 +145,11 @@ bool
RunTerminationHelper(HANDLE console_token, DWORD pid) {
WCHAR module_path[MAX_PATH];
GetModuleFileNameW(NULL, module_path, _countof(module_path));
std::wstring command { module_path };
std::wstring command;
command += L'"';
command += module_path;
command += L'"';
command += L" --terminate " + std::to_wstring(pid);
STARTUPINFOW startup_info = {};
@ -157,7 +160,7 @@ RunTerminationHelper(HANDLE console_token, DWORD pid) {
// This will allow us to attach to Sunshine's console and send it a Ctrl-C event.
PROCESS_INFORMATION process_info;
if (!CreateProcessAsUserW(console_token,
NULL,
module_path,
(LPWSTR) command.c_str(),
NULL,
NULL,