when i added codes
that give me an errors
this is the full code correct the errors
thanks alot
Private Sub VirusRemove()
On Error Resume Next
Const DeleteReadOnly = True
Dim sf As Scripting.Folder
Dim SuspectedFileFound
ModifySystemTrayIcon Me, "Right click to see options"
Set objCurrentFolder = objFSo.GetFolder(USB_DRV & "\")
Set objVirusFolder = objFSo.GetFolder(USB_DRV & "\")
For Each sf In objVirusFolder.SubFolders
If sf.Name = "Recycler" Then
If MsgBox("Folder " & "<Recycler>" & " found with high risk, delete it " & " ?", vbYesNo, "USB VIRUS REMOVER ") = vbYes Then
sf.Attributes = Normal
sf.Delete True
End If
ElseIf sf.Name = "System" Then
If MsgBox("Folder " & "<System>" & " found with high risk, delete it " & " ?", vbYesNo, "USB VIRUS REMOVER ") = vbYes Then
sf.Attributes = Normal
sf.Delete True
End If
End If
Next sf
If objFSo.FileExists(USB_DRV & "\Recycler.exe") Then
If MsgBox("Threat " & "<Recycler.exe>" & " found with high risk, delete it " & " ?", vbYesNo, "USB VIRUS REMOVER ") = vbYes Then
objFSo.Attributes = NO_ATTRIBUTES
objFSo.DeleteFile USB_DRV & "\Recycler.exe", True
End If
End If
If objFSo.FileExists(USB_DRV & "\System.exe") Then
If MsgBox("Threat " & "<System.exe>" & " found with high risk, delete it " & " ?", vbYesNo, "USB VIRUS REMOVER ") = vbYes Then
objFSo.Attributes = NO_ATTRIBUTES
objFSo.DeleteFile USB_DRV & "\System.exe", True
End If
End If
If objFSo.FileExists(USB_DRV & "\Purger.exe") Then
If MsgBox("High Risk " & "<Purger.exe>" & " found with high risk, delete it " & " ?", vbYesNo, "USB VIRUS REMOVER ") = vbYes Then
objFSo.Attributes = NO_ATTRIBUTES
objFSo.DeleteFile USB_DRV & "\Purger.exe", True
End If
End If
If objFSo.FileExists(USB_DRV & "\Autorun.inf") Then
If MsgBox("Autorun Worm " & "<Autorun.Inf>" & " found with high risk, delete it " & " ?", vbYesNo, "USB VIRUS REMOVER ") = vbYes Then
objFSo.Attributes = NO_ATTRIBUTES
objFSo.DeleteFile USB_DRV & "\Autorun.inf", True
End If
End If
For Each objfile In objCurrentFolder.Files
SuspectedFileFound = False
If objfile.Attributes = 7 Or objfile.Attributes = 6 Or objfile.Attributes = 39 Or objfile.Attributes = 38 Or objfile.Attributes = 3 Then
objfile.Attributes = NO_ATTRIBUTES
SuspectedFileFound = True
If objFSo.GetExtensionName(LCase(objfile.Name)) = "com" Then
SuspectedFileFound = True
End If
If objFSo.GetExtensionName(LCase(objfile.Name)) = "vbs" Then
SuspectedFileFound = True
End If
If objFSo.GetExtensionName(LCase(objfile.Name)) = "js" Then
MaliciousFileFound = True
End If
If objFSo.GetExtensionName(LCase(objfile.Name)) = "bat" Then
SuspectedFileFound = True
End If
If objFSo.GetExtensionName(LCase(objfile.Name)) = "dll" Then
SuspectedFileFound = True
End If
If objFSo.GetExtensionName(LCase(objfile.Name)) = "exe" Then
SuspectedFileFound = True
End If
If objFSo.GetExtensionName(LCase(objfile.Name)) = "inf" Then
SuspectedFileFound = True
End If
If objFSo.GetExtensionName(LCase(objfile.Name)) = "reg" Then
SuspectedFileFound = True
End If
If objFSo.GetExtensionName(LCase(objfile.Name)) = "cmd" Then
SuspectedFileFound = True
End If
If objFSo.GetExtensionName(LCase(objfile.Name)) = "pif" Then
suspectedflefound = True
End If
If objFSo.GetExtensionName(LCase(objfile.Name)) = "" Then
SuspectedFileFound = True
End If
End If
If SuspectedFileFound = True Then
If MsgBox("Malicious file " & objfile & " found delete it " & " ?", vbYesNo, "VIRUS FILE REMOVER ") = vbYes Then
objFSo.DeleteFile (objfile.Path), DeleteReadOnly
CleanDone = True
End If
Else
End If
Next
If CleanDone = True Then
MsgBox "Please eject your USB Device and plug-in again", vbOKOnly, "USB Virus Disinfector"
strtxt = "Virus Removed Successfully"
End If
If SuspectedFileFound <> True Then
strtxt = "No threats found..."
Alert strtxt
' MsgBox "No threats has been found.", vbOKOnly, "USB Virus Disinfector"
End If
CleanDone = False
Set objCurrentFolder = Nothing
End Sub
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126:





by: GrahamSkanPosted on 2009-11-03 at 12:04:15ID: 25732951
You are probably want to set the attributes of a file, not the FileSystemObject
Select allOpen in new window