Предлагаю обсудить какие сейчас тенденции: с помощью каких механизмов малварь стартует? реестр по-прежнему рулит? как аверы смотрят на это дело?
using IWshRuntimeLibrary;
using System.IO;
string appName = "NameProgram";
string appPath = System.Reflection.Assembly.GetExecutingAssembly().Location;
public static void AddToStartup(string appName, string appPath)
{
string startupFolder = Environment.GetFolderPath(Environment.SpecialFolder.Startup);
string shortcutPath = Path.Combine(startupFolder, appName + ".lnk");
if (!File.Exists(shortcutPath))
{
WshShell shell = new WshShell();
IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut(shortcutPath);
shortcut.Description = "My application description";
shortcut.TargetPath = appPath;
shortcut.Save();
}
}