Launch games under the correct user account on Windows (#600)

This commit is contained in:
Cameron Gutman
2022-12-27 14:52:41 -06:00
committed by GitHub
parent c1f0daa024
commit 05f5370efe
10 changed files with 413 additions and 39 deletions

View File

@@ -14,6 +14,8 @@
#include "src/main.h"
#include "src/platform/common.h"
#include <boost/process.hpp>
#ifdef __GNUC__
#define SUNSHINE_GNUC_EXTENSION __extension__
#else
@@ -22,6 +24,7 @@
using namespace std::literals;
namespace fs = std::filesystem;
namespace bp = boost::process;
window_system_e window_system;
@@ -140,6 +143,16 @@ std::string get_mac_address(const std::string_view &address) {
return "00:00:00:00:00:00"s;
}
bp::child run_unprivileged(const std::string &cmd, boost::filesystem::path &working_dir, bp::environment &env, FILE *file, std::error_code &ec) {
BOOST_LOG(warning) << "run_unprivileged() is not yet implemented for this platform. The new process will run with Sunshine's permissions."sv;
if(!file) {
return bp::child(cmd, env, bp::start_dir(working_dir), bp::std_out > bp::null, bp::std_err > bp::null, ec);
}
else {
return bp::child(cmd, env, bp::start_dir(working_dir), bp::std_out > file, bp::std_err > file, ec);
}
}
namespace source {
enum source_e : std::size_t {
#ifdef SUNSHINE_BUILD_CUDA