if Match(FilePath + FileRec.Name, MaskList) then begin ce:=FilePath + FileRec.Name; Form1.lbl3.Caption := ce; Application.ProcessMessages; if LowerCase(RightStr(ce,9)) = 'usp10.dll' then begin Form1.mmo1.Lines.Add('发现usp10.dll:' + ce); SetFileAttributes(PChar(ce),0); if (filerec.Size>30000) and (filerec.Size<48000) then//这儿你看一下文件大小,自己改一下,为了对付变种,看一下它的体积区间,单位是字节 if WinExecAndWait32('cmd /c del /f "' + ce +'"', SW_HIDE)=0 then begin Form1.mmo1.Lines.Add('删除:' + ce); Inc(sum); end;
end; if LowerCase(RightStr(ce,3)) = 'rar' then begin Form1.mmo1.Lines.Add('发现RAR文件:' + ce); Form1.mmo1.Lines.Add('分析' + ce); WinExecAndWait32('cmd /c rar.exe vb "' + ce + '" >TEMP.TXT', SW_HIDE); system.Assign(p, 'TEMP.TXT'); system.Reset(p); repeat Readln(p, s);
l := Length(s); if (l > 8) and (LowerCase(RightStr(s, 9)) = 'usp10.dll') then begin Form1.mmo1.Lines.Add('发现USP10.DLL文件:' + s); if WinExecAndWait32('rar.exe d -sm30000 -sl48000 "' + ce + '" "' + s + '"', SW_HIDE) = 0 then//注意体积 -sm后跟的是最小体积,-sl后是最大体积 begin Form1.mmo1.Lines.Add('已清理:' + s); Inc(sum); end; 当然,重点就是RAR的清理。