Exemplo n.º 1
0
 public void SetAutoRun(string path, bool value)
 {
     try
     {
         RegistryKey reg = Registry.LocalMachine.OpenSubKey
                               ("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", value);
         if (value)
         {
             if (reg.GetValue(new FileInfo(path).Name).ToString() != path)
             {
                 reg.SetValue(new FileInfo(path).Name, path);
             }
         }
         else
         {
             reg.DeleteValue(new FileInfo(path).Name);
         }
     }
     catch (Exception err)
     {
         LogList.Add(err.Message);
     }
 }