mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
[Action runner] Support running generic targets as non-elevated (#3863)
* Initial work, not tested * Forgot the most important part * Use target argument instead of hardcoded string * Removed old way of running Launcher * Completed rebase, updated some code
This commit is contained in:
@@ -145,8 +145,14 @@ public:
|
||||
else
|
||||
{
|
||||
std::wstring action_runner_path = get_module_folderpath();
|
||||
action_runner_path += L"\\action_runner.exe";
|
||||
|
||||
std::wstring params;
|
||||
params += L"-run-non-elevated ";
|
||||
params += L"-target modules\\launcher\\PowerLauncher.exe ";
|
||||
params += L"-pidFile ";
|
||||
params += POWER_LAUNCHER_PID_SHARED_FILE;
|
||||
|
||||
action_runner_path += L"\\action_runner.exe";
|
||||
// Set up the shared file from which to retrieve the PID of PowerLauncher
|
||||
HANDLE hMapFile = CreateFileMappingW(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, sizeof(DWORD), POWER_LAUNCHER_PID_SHARED_FILE);
|
||||
if (hMapFile)
|
||||
@@ -157,9 +163,9 @@ public:
|
||||
*pidBuffer = 0;
|
||||
m_hProcess = NULL;
|
||||
|
||||
if (run_non_elevated(action_runner_path, L"-start_PowerLauncher", nullptr))
|
||||
if (run_non_elevated(action_runner_path, params, pidBuffer))
|
||||
{
|
||||
const int maxRetries = 20;
|
||||
const int maxRetries = 80;
|
||||
for (int retry = 0; retry < maxRetries; ++retry)
|
||||
{
|
||||
Sleep(50);
|
||||
|
||||
Reference in New Issue
Block a user