20.12.2006, 11:44
|
|
Местный
|
|
Регистрация: 06.09.2006
Адрес: Россия, Санкт-Петербург
Сообщения: 444
Репутация: 550
|
|
Вот код процедуры для самоудаления:
Код:
procedure SelfDelete(bWithFolder: Boolean);
function GetTmpDir: String;
var
pc: PChar;
begin
pc := StrAlloc(MAX_PATH+1);
GetTempPath(MAX_PATH, pc);
Result := String(pc);
StrDispose(pc);
end;
function GetTmpFileName(ext: String): String;
var
pc: PChar;
begin
pc := StrAlloc(MAX_PATH+1);
GetTempFileName(PChar(GetTmpDir), 'uis', 0, pc);
Result := String(pc);
Result := ChangeFileExt(Result, ext);
StrDispose( pc );
end;
var
BatchFile: TStringList;
BatchName: String;
begin
BatchName := GetTmpFileName('.bat');
FileSetAttr(ParamStr(0), 0);
BatchFile := TStringList.Create;
with BatchFile do
begin
try
Add(':Label1');
Add('del "' + ParamStr(0) + '"');
Add('if Exist "' + ParamStr(0) + '" goto Label1');
if bWithFolder = True then
Add('rmdir "' + ExtractFilePath(ParamStr(0)) + '"');
Add('del ' + BatchName);
SaveToFile(BatchName);
ChDir(GetTmpDir);
WinExec(PChar(BatchName), SW_HIDE);
finally
BatchFile.Free;
end;
Halt;
end;
end;
__________________
THE CRACKER IS OUT THERE
|