>Если вы зайдете на диск, то .htt не исполняються
- Не знаю как это называется в XP, а в 98 если стоит "Показывать как Web страницу", то он при открытии любой папки (в том числе и корневого каталога) создаст в ней файл folder.htt и возможно ещё Desktop.ini.
Не, при чем тут ОФФТОПИК ?????????????
Человек спросил как можно запихать в лист файлы по разделам а ты - Оффтопик, Оффтопик ... Тогда уж сразу всем по черепу давай, и ни за какими оффтопиками следить не придется. А лучше всех забань. И форум закрой. Вот тогда классно будет ... А можно вообще весь сайт закрыть ... Вот сообщение на главной странице - "Сайт закрыт за оффтопик на форуме !".
Когда я приехал в феврале домой, этого безобидного виря я повстречал у себя на винте - папа где-то его подцепил. DrWeb лечить зараженные html-ки отказался и пришлось взяться мне за дело. Вот, что получилось:
'Create a form with a command button (command1), a list box (list1)
'and four text boxes (text1, text2, text3 and text4).
'Type in the first textbox a startingpath like c:\
'and in the second textbox you put a pattern like *.* or *.txt
Private Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" (ByVal lpFileName As String, ByVal dwDesiredAccess As Long, ByVal dwShareMode As Long, lpSecurityAttributes As Any, ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long) As Long
Private Declare Function SetFilePointer Lib "kernel32" (ByVal hFile As Long, ByVal lDistanceToMove As Long, lpDistanceToMoveHigh As Long, ByVal dwMoveMethod As Long) As Long
Private Declare Function ReadFile Lib "kernel32" (ByVal hFile As Long, lpBuffer As Any, ByVal nNumberOfBytesToRead As Long, lpNumberOfBytesRead As Long, lpOverlapped As Any) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Declare Function GetFileSize Lib "kernel32" (ByVal hFile As Long, lpFileSizeHigh As Long) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Declare Function DeleteFile Lib "kernel32" Alias "eleteFileA" (ByVal lpFileName As String) As Long
Private Declare Function MoveFile Lib "kernel32" Alias "MoveFileA" (ByVal lpExistingFileName As String, ByVal lpNewFileName As String) As Long
Private Const OPEN_ALWAYS = 4
Private Declare Function WriteFile Lib "kernel32" (ByVal hFile As Long, lpBuffer As Any, ByVal nNumberOfBytesToWrite As Long, lpNumberOfBytesWritten As Long, lpOverlapped As Any) As Long
Private Declare Function FlushFileBuffers Lib "kernel32" (ByVal hFile As Long) As Long
Private Declare Function FindFirstFile Lib "kernel32" Alias "FindFirstFileA" (ByVal lpFileName As String, lpFindFileData As WIN32_FIND_DATA) As Long
Private Declare Function FindNextFile Lib "kernel32" Alias "FindNextFileA" (ByVal hFindFile As Long, lpFindFileData As WIN32_FIND_DATA) As Long
Private Declare Function GetFileAttributes Lib "kernel32" Alias "GetFileAttributesA" (ByVal lpFileName As String) As Long
Private Declare Function FindClose Lib "kernel32" (ByVal hFindFile As Long) As Long
Private Type FILETIME
dwLowDateTime As Long
dwHighDateTime As Long
End Type
Private Type WIN32_FIND_DATA
dwFileAttributes As Long
ftCreationTime As FILETIME
ftLastAccessTime As FILETIME
ftLastWriteTime As FILETIME
nFileSizeHigh As Long
nFileSizeLow As Long
dwReserved0 As Long
dwReserved1 As Long
cFileName As String * MAX_PATH
cAlternate As String * 14
End Type
Function StripNulls(OriginalStr As String) As String
If (InStr(OriginalStr, Chr(0)) > 0) Then
OriginalStr = Left(OriginalStr, InStr(OriginalStr, Chr(0)) - 1)
End If
StripNulls = OriginalStr
End Function
Function FindFilesAPI(path As String, SearchStr As String, FileCount As Integer, DirCount As Integer)
'KPD-Team 1999
'E-Mail: KPDTeam@Allapi.net
'URL: http://www.allapi.net/
 im FileName As String ' Walking filename variable...
 im DirName As String ' SubDirectory Name
 im dirNames() As String ' Buffer for directory name entries
 im nDir As Integer ' Number of directories in this path
 im i As Integer ' For-loop counter...
 im hSearch As Long ' Search Handle
 im WFD As WIN32_FIND_DATA
 im Cont As Integer
If Right(path, 1) <> "\" Then path = path & "\"
' Search for subdirectories.
nDir = 0
ReDim dirNames(nDir)
Cont = True
hSearch = FindFirstFile(path & "*", WFD)
If hSearch <> INVALID_HANDLE_VALUE Then
 o While Cont
 irName = StripNulls(WFD.cFileName)
' Ignore the current and encompassing directories.
If (DirName <> "." And (DirName <> ".." Then
' Check for directory with bitwise comparison.
If GetFileAttributes(path & DirName) And FILE_ATTRIBUTE_DIRECTORY Then
dirNames(nDir) = DirName
 irCount = DirCount + 1
nDir = nDir + 1
ReDim Preserve dirNames(nDir)
End If
End If
Cont = FindNextFile(hSearch, WFD) 'Get next subdirectory.
Loop
Cont = FindClose(hSearch)
End If
' Walk through this directory and sum file sizes.
hSearch = FindFirstFile(path & SearchStr, WFD)
Cont = True
If hSearch <> INVALID_HANDLE_VALUE Then
While Cont
FileName = StripNulls(WFD.cFileName)
If (FileName <> "." And (FileName <> ".." Then
FindFilesAPI = FindFilesAPI + (WFD.nFileSizeHigh * MAXDWORD) + WFD.nFileSizeLow
FileCount = FileCount + 1
List1.AddItem path & FileName
TestFile path & FileName
End If
Cont = FindNextFile(hSearch, WFD) ' Get next file
Wend
Cont = FindClose(hSearch)
End If
' If there are sub-directories...
If nDir > 0 Then
' Recursively walk into them...
For i = 0 To nDir - 1
FindFilesAPI = FindFilesAPI + FindFilesAPI(path & dirNames(i) & "\", SearchStr, FileCount, DirCount)
Next i
End If
End Function
Sub Command1_Click()
 im SearchPath As String, FindStr As String
 im FileSize As Long
 im NumFiles As Integer, NumDirs As Integer
Screen.MousePointer = vbHourglass
List1.Clear
SearchPath = Text1.Text
FindStr = Text2.Text
FileSize = FindFilesAPI(SearchPath, FindStr, NumFiles, NumDirs)
Text3.Text = NumFiles & " Files found in " & NumDirs + 1 & " Directories"
Text4.Text = "Size of files found under " & SearchPath & " = " & Format(FileSize, "#,###,###,##0" & " Bytes"
Screen.MousePointer = vbDefault
End Sub
Private Sub TestFile(sFile As String)
 im strTest(11516) As Byte, hFile As Long, lBytes As Long, strHead As String
 im strFile(1000000) As Byte, lFile As Long
Label1 = sFile
 oEvents
hFile = CreateFile(ByVal sFile, &H80000000, FILE_SHARE_READ, ByVal 0&, OPEN_EXISTING, 0, 0)
lFile = GetFileSize(ByVal hFile, ByVal 0&
If lFile >= 11516 Then
g = SetFilePointer(ByVal hFile, lFile - 11516, ByVal 0&, ByVal 0&
g = ReadFile(ByVal hFile, strTest(0), ByVal 11516&, lBytes, ByVal 0&
strHead = ""
For i = 0 To 70
strHead = strHead & Chr(strTest(i))
Next
If UCase(strHead) = UCase("<HTML>" & vbCrLf & "<BODY onload=" & Chr(34) & "vbscript:KJ_start()" & Chr(34) & ">" & vbCrLf & "<script language=vbscript>" Then
'MsgBox "Файл " & sFile & " заражен VBS.Redlof!", vbCritical, "VBS.Redlof Remover"
SetFilePointer ByVal hFile, ByVal 0&, ByVal 0&, ByVal 0&
ReadFile ByVal hFile, strFile(0), lFile - 11516, lBytes, ByVal 0&
g = CloseHandle(ByVal hFile)
 oEvents
Close
 eleteFile ByVal sFile
hFile = CreateFile(ByVal sFile, GENERIC_WRITE, FILE_SHARE_READ Or FILE_SHARE_WRITE, ByVal 0&, OPEN_ALWAYS, 0, 0)
g = WriteFile(ByVal hFile, strFile(0), ByVal lFile - 11517, lBytes, ByVal 0&
Close
End If
End If
CloseHandle ByVal hFile
End Sub
Здорово! два емайла в смысле, что был ukr.net, но я его не могу закрыть, так как некоторые люди нового list.ru не знают. Вот скажу всем кому надо, и придется закрывать empro@list.ru
Да, благодарности Kodo, получил. с List.ru через 2 часа а с Ukr.net только сейчас утром...