|
[C++] Viết chuơng trình vô hiệu hóa các chuơng trình auto Sat Mar 26, 2011 3:36 am | |
| NeroChaos Developer
| | Sex : Bài gửi : 198 SCoin : 98 Thanks : 20
| Sex : | |
| |
Tiêu đề: [C++] Viết chuơng trình vô hiệu hóa các chuơng trình auto | |
|
1.Dùng C++ viết chuơng trình vô hiệu hóa các phần mềm , ứng dụng tự động chạy khi log in vào window . <br> <br> 2.Viết chuơng trình xóa tất cả các file có định dạng *.exe trong folder cho trước trong window ( vd : xóa file exe trong newfolder đc cho bởi đường dẫn E:\newfolder) .<br> <br> 3. Kiểm tra trong thư mục E:\pressing có file *.inf nào có nội dung chứa đoạn mã : (open="virus.exe" auto="true" ) ko , nếu có thì xóa file đó .<br> <br> Mình đang cần gấp lắm , pro nào làm đc giúp mình với , xin cảm ơn . <br> Có thể dùng freepascal .<br>Hãy tham khảo code tìm file này nhé: <br> FP <khi nào thật rỗi mình làm cho<br> - Code:
-
<pre class="bbcode_code" style="height: 372px;">uses crt,dos;<br>const KqFile='d:\kq.txt';<br>var count:longint;<br>path,FileName:string;<br>Kq:text; c:char;<br><br>function Up(s:string):string;<br>var i:byte;<br>begin<br> if s[length(s)]='\' then delete(s,length(s),1);<br> for i:=length(s) downto 1 do<br> if s[i]='\' then break;<br> exit(copy(s,1,i));<br>end;<br><br>function InList(list:string;title:string):boolean;<br> var s:string;<br>begin<br> if List[Length(list)]<>';' then List:=List+';';<br> repeat<br> s:=copy(list,1,pos(';',list)-1)+' '; delete(list,1,pos(';',list));<br> repeat<br> if pos( copy(s,1,pos(' ',s)-1) ,title)=0 then break<br> else<br> begin<br> delete(s,1,pos(' ',s));<br> if s='' then exit(true);<br> end;<br> until false;<br> until pos(';',List)=0;<br> exit(false);<br>end;<br><br>function GetCommand(path:string):string;<br>var<br> I,J: Integer;<br> Attr: Word;<br> S: PathStr;<br> D: DirStr;<br> N: NameStr;<br> E: ExtStr;<br> F: File;<br>begin<br> Path := FExpand(Path);<br> if Path[Length(Path)] <> '\' then<br> begin<br> Assign(F, Path);<br> GetFAttr(F, Attr);<br> if (DosError = 0) and (Attr and Directory <> 0) then<br> Path := Path + '\';<br> end;<br> FSplit(Path, D, N, E);<br> if N = '' then N := '*';<br> if E = '' then E := '.*';<br> Path := D + N + E; exit(path);<br>end;<br><br>Function L0(w:word):string;<br> var<br> s : string;<br> begin<br> Str(w,s);<br> if w<10 then L0:='0'+s<br> else L0:=s;<br> end;<br><br>procedure FindFiles(path:string;FileName:string);<br>var<br> F: SearchRec;<br>begin<br> if keypressed then exit;<br> path:=getcommand(path);<br> FindFirst(path, Directory+ReadOnly+Archive, F);<br> while (DosError=0) do<br> if f.name[1]='.' then FindNext(f)<br> else begin<br> if InList(FileName,UpCase(f.name)) then<br> begin writeln(kq,Up(path)+f.name); inc(count); end;<br> if f.attr and directory<>0 then<br> FindFiles(Up(path)+f.name,FileName);<br> FindNext(F);<br> end;<br> FindClose(F);<br>end;<br><br>procedure PrintFile;<br>var s:string;<br>begin<br> reset(kq);<br> while not eof(kq) do<br> begin<br> readln(kq,s);<br> writeln(s);<br> if keypressed then<br> if readkey=#27 then exit<br> else if readkey=#27 then exit;<br> end;<br>end;<br><br>BEGIN<br>repeat count:=0; assign(kq,kqfile); rewrite(kq);<br> write('Path: '); readln(path); path:=Upcase(path);<br> write('Name: '); readln(FileName); FileName:=Upcase(FileName);<br> findfiles(Path,FileName);<br> if keypressed then<br> begin writeln('Stoped search.'); readkey; end;<br> writeln(count,' files found');<br> writeln('You can see the search results in ',kqfile);<br> writeln('Or press SpaceBar');<br> c:=readkey;<br> if c=#32 then printfile;<br> close(kq);<br>until readkey=#27;<br>END.</pre> <br> |
|
|
|
Trả lời nhanh - Quick Reply Trang 1 trong tổng số 1 trang | | * Viết tiếng Việt có dấu, là tôn trọng người đọc. * Chia sẻ bài sưu tầm có ghi rõ nguồn, là tôn trọng người viết. * Thực hiện những điều trên, là tôn trọng chính mình.-Nếu chèn smilies có vấn đề thì bấm A/a trên phải khung viết bài
| Permissions in this forum: | Bạn không có quyền trả lời bài viết
| |
| |
|