Skip to content

Commit

Permalink
Quote the path to sunshinesvc.exe when launching the termination help…
Browse files Browse the repository at this point in the history
  • Loading branch information
cgutman authored and KuleRucket committed Jun 6, 2024
1 parent 0f38818 commit 85d33e4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tools/sunshinesvc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {};
Expand All @@ -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,
Expand Down

0 comments on commit 85d33e4

Please sign in to comment.