You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
2.4 KiB

using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TJprojMain_remover
{
class Program
{
private const string AUTOSTART_REGKEY = @"HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Run";
static void Main(string[] args)
{
Log.Info("TJprojMain-remover by VollRagm", ConsoleColor.Blue);
CheckSafeBoot();
DisableAutostart();
RemoveFiles();
Log.Info("Done.");
}
static void CheckSafeBoot()
{
var safeBoot = Utils.IsSafeMode();
if (!safeBoot)
{
var proceed = Log.QueryYesNo("You did not boot into safe mode, which means that the process is running and cannot be deleted. Do you wish to try anyways? (y/n): ");
if (!proceed)
{
Log.Info("Here is how to boot into safe mode: https://www.digitalcitizen.life/4-ways-boot-safe-mode-windows-10/");
Console.ReadLine();
Environment.Exit(0);
}
}
}
static void DisableAutostart()
{
Log.Info("Disabling Autostart...");
try
{
Utils.RegRemoveIfExists(AUTOSTART_REGKEY, "svchost");
Utils.RegRemoveIfExists(AUTOSTART_REGKEY, "Explorer");
Console.WriteLine();
}
catch (Exception ex)
{
Log.Error("Failed to remove autostart keys: " + ex.Message);
}
}
static void RemoveFiles()
{
try
{
Utils.FRemoveIfExists(@"C:\Windows\Resources\svchost.exe", true);
Utils.FRemoveIfExists(@"C:\Windows\Resources\spoolsv.exe", true);
Utils.FRemoveIfExists(@"C:\Windows\Resources\explorer.exe", true);
Utils.FRemoveIfExists(@"C:\Windows\Resources\Themes\icsys.icn.exe", true);
Utils.FRemoveIfExists(@"C:\Windows\Resources\Themes\icsys.icn", false);
Utils.FRemoveIfExists(@"C:\Windows\Resources\Themes\tjcm.cmn", true);
Console.WriteLine();
}catch(Exception ex)
{
Log.Error("Could not remove files: " + ex.Message);
}
}
}
}