From 53038760de9808b72f8259907058f923c28cf1c2 Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Fri, 7 Feb 2025 17:03:01 +0000 Subject: [PATCH] refactor: Use core mode for daemon install on Windows --- src/lib/arch/win32/ArchDaemonWindows.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/lib/arch/win32/ArchDaemonWindows.cpp b/src/lib/arch/win32/ArchDaemonWindows.cpp index 376b8fa15..e53da09bf 100644 --- a/src/lib/arch/win32/ArchDaemonWindows.cpp +++ b/src/lib/arch/win32/ArchDaemonWindows.cpp @@ -603,16 +603,13 @@ void ArchDaemonWindows::installDaemon() { // install default daemon if not already installed. if (!isDaemonInstalled(DEFAULT_DAEMON_NAME)) { - char path[MAX_PATH]; - GetModuleFileName(ArchMiscWindows::instanceWin32(), path, MAX_PATH); + char binPath[MAX_PATH]; + GetModuleFileName(ArchMiscWindows::instanceWin32(), binPath, MAX_PATH); // wrap in quotes so a malicious user can't start \Program.exe as admin. - std::stringstream ss; - ss << '"'; - ss << path; - ss << '"'; + const auto command = "\"" + std::string(binPath) + "\""; - installDaemon(DEFAULT_DAEMON_NAME, DEFAULT_DAEMON_INFO, ss.str().c_str(), "", ""); + installDaemon(DEFAULT_DAEMON_NAME, DEFAULT_DAEMON_INFO, command.c_str(), "", ""); } start(DEFAULT_DAEMON_NAME);