Check Process.Start usage

This commit is contained in:
Jack251970 2025-06-15 01:16:46 +08:00
parent e1242eefda
commit e5316a0ac4
6 changed files with 14 additions and 11 deletions

View file

@ -367,7 +367,8 @@ namespace Flow.Launcher
UseShellExecute = true,
Verb = Win32Helper.IsAdministrator() || forceAdmin ? "runas" : ""
};
Process.Start(startInfo); // No need to de-elevate since we are restarting
// No need to de-elevate since we are restarting Flow Launcher which cannot bring security risks
Process.Start(startInfo);
Thread.Sleep(500);
Environment.Exit(0);

View file

@ -360,11 +360,7 @@ namespace Flow.Launcher.Plugin.Explorer
{
try
{
Process.Start(new ProcessStartInfo()
{
FileName = editorPath,
ArgumentList = { record.FullPath }
});
Main.Context.API.StartProcess(editorPath, arguments: record.FullPath);
return true;
}
catch (Exception e)
@ -394,10 +390,7 @@ namespace Flow.Launcher.Plugin.Explorer
{
try
{
Process.Start(new ProcessStartInfo()
{
FileName = shellPath, WorkingDirectory = record.FullPath
});
Main.Context.API.StartProcess(shellPath, workingDirectory: record.FullPath);
return true;
}
catch (Exception e)
@ -462,6 +455,7 @@ namespace Flow.Launcher.Plugin.Explorer
Arguments = "srchadmin.dll"
};
// No need to de-elevate since we are opening windows settings which cannot bring security risks
Process.Start(psi);
return true;
}
@ -486,6 +480,7 @@ namespace Flow.Launcher.Plugin.Explorer
SubTitle = Context.API.GetTranslation("plugin_explorer_openwith_subtitle"),
Action = _ =>
{
// No need to de-elevate since we are opening windows settings which cannot bring security risks
Process.Start("rundll32.exe", $"{Path.Combine(Environment.SystemDirectory, "shell32.dll")},OpenAs_RunDLL {record.FullPath}");
return true;
},

View file

@ -57,7 +57,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search.Everything
}
Settings.EverythingInstalledPath = installedPath;
Process.Start(installedPath, "-startup");
Main.Context.API.StartProcess(installedPath, arguments: "-startup");
return true;
}

View file

@ -488,6 +488,7 @@ namespace Flow.Launcher.Plugin.Explorer.ViewModels
Arguments = Constants.WindowsIndexingOptions
};
// No need to de-elevate since we are opening windows settings which cannot bring security risks
Process.Start(psi);
}

View file

@ -210,6 +210,7 @@ namespace Flow.Launcher.Plugin.Sys
if (EnableShutdownPrivilege())
PInvoke.ExitWindowsEx(EXIT_WINDOWS_FLAGS.EWX_SHUTDOWN | EXIT_WINDOWS_FLAGS.EWX_POWEROFF, REASON);
else
// No need to de-elevate since we already have message box asking for confirmation
Process.Start("shutdown", "/s /t 0");
return true;
@ -231,6 +232,7 @@ namespace Flow.Launcher.Plugin.Sys
if (EnableShutdownPrivilege())
PInvoke.ExitWindowsEx(EXIT_WINDOWS_FLAGS.EWX_REBOOT, REASON);
else
// No need to de-elevate since we already have message box asking for confirmation
Process.Start("shutdown", "/r /t 0");
return true;
@ -252,6 +254,7 @@ namespace Flow.Launcher.Plugin.Sys
if (EnableShutdownPrivilege())
PInvoke.ExitWindowsEx(EXIT_WINDOWS_FLAGS.EWX_REBOOT | EXIT_WINDOWS_FLAGS.EWX_BOOTOPTIONS, REASON);
else
// No need to de-elevate since we already have message box asking for confirmation
Process.Start("shutdown", "/r /o /t 0");
return true;
@ -315,6 +318,7 @@ namespace Flow.Launcher.Plugin.Sys
Glyph = new GlyphInfo (FontFamily:"/Resources/#Segoe Fluent Icons", Glyph:"\xe773"),
Action = c =>
{
// No need to de-elevate since we are opening windows settings which cannot bring security risks
Process.Start("control.exe", "srchadmin.dll");
return true;
}
@ -351,6 +355,7 @@ namespace Flow.Launcher.Plugin.Sys
CopyText = recycleBinFolder,
Action = c =>
{
// No need to de-elevate since we are opening windows settings which cannot bring security risks
Process.Start("explorer", recycleBinFolder);
return true;
}

View file

@ -208,6 +208,7 @@ namespace Flow.Launcher.Plugin.WindowsSettings.Helper
{
processStartInfo.UseShellExecute = true;
processStartInfo.Verb = "runas";
// No need to de-elevate since we are opening windows settings which cannot bring security risks
Process.Start(processStartInfo);
return true;
}