تو اینترنت گشتم چیزی پیدا نکردم.شاید آخرین راه حل بچ فایل باشه.
دو تا برنامه نوشتم:یکی برنامه اصلی (bad.exe) و یکی برنامه جایگزین کننده برنامه با نسخه به روز(C:\Bad.exe)با نام(CopyBad.exe).ولی افتضاح شد.یه نگاه به کد میندازید؟
این کد برنامه ای که نیاز به آپدیت داره:
function FileSize(fileName : wideString) : Int64;
var
sr : TSearchRec;
begin
if FindFirst(fileName, faAnyFile, sr ) = 0 then
result := Int64(sr.FindData.nFileSizeHigh) shl Int64(32) + Int64(sr.FindData.nFileSizeLow)
else
result := -1;
FindClose(sr);
end;
procedure TForm1.FormCreate(Sender: TObject);
var
SourceFile:String;
begin
SourceFile:='C:\'+ExtractFileName(Application.ExeN ame);
if FileSize(Application.ExeName)<>FileSize(SourceFile ) then
Begin
Application.Terminate;
WinExec(PChar('CopyBad.exe'),SW_SHOWNORMAL );
End;
end;
این هم کد برنامه جایگزین کننده نسخه به روز(که توسط برنامه اصلی اجرا میشه!)
procedure TForm1.FormCreate(Sender: TObject);
begin
Sleep(2000);
DeleteFile('Bad.exe');
CopyFile('C:\Bad.exe','Bad.exe',false);
WinExec('Bad.exe',SW_SHOWNORMAL );
Application.Terminate;
end;
چرا مثل ویروس تکثیر میشه؟مشکل چیه؟