From 85d33e4aa410cdd9e5086bba9f8b759db73cc445 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sat, 6 Apr 2024 18:21:03 -0500 Subject: [PATCH] Quote the path to sunshinesvc.exe when launching the termination helper (#2379) --- tools/sunshinesvc.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/sunshinesvc.cpp b/tools/sunshinesvc.cpp index fee3a693e1d..da0849e26bb 100644 --- a/tools/sunshinesvc.cpp +++ b/tools/sunshinesvc.cpp @@ -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,