Sie sind auf Seite 1von 29

library loader;

uses
SysUtils, ShellAPI, TlHelp32, Registry,
Windows, StdCtrls,
Classes,
ExtCtrls,
Graphics,
Controls,
ComCtrls,
sLabel,
sEdit, sSplitter,
sPageControl,
sCheckBox,
sSpeedButton,
sPanel,
sListView,
acImage,
sCombobox,
AcShellCtrls,
BackgroundWorker,
sGroupBox,
sMemo,
IniFiles,
acArcControls, Menus, DateUtils,
acAlphaImageList, sTreeView, sRadioButton,
list_dir_file in '..\..\..\list_dir_file.pas',
strip in '..\..\..\strip.pas',
MD5 in '..\..\..\MD5.pas',
hex in 'hex.pas';

type
TXHandler = class
public
class procedure TreeClick(Sender: TObject);

class procedure ShellDblClick(Sender: TObject);

class procedure CustScanClick(Sender: TObject);


class procedure AddFileClick(Sender: TObject);
class procedure AddFldrClick(Sender: TObject);
class procedure DelFldrClick(Sender: TObject);

class procedure ScnPause(Sender: TObject);


class procedure ScnStop(Sender: TObject);
class procedure ScnDisi(Sender: TObject);
class procedure ScnClose(Sender: TObject);

class procedure SAL0CLick(Sender: TObject);


class procedure ThWork(Worker: TBackgroundWorker);
class procedure CleanWork(Worker: TBackgroundWorker);

class procedure ODlgCancelClick(Sender: TObject);


class procedure ODlgSelectClick(Sender: TObject);
//overview buttons and menus click
//overview scan now clicks
class procedure OvScnNowClick(Sender: TObject);
class procedure OvSmClick(Sender: TObject);
class procedure OvCmClick(Sender: TObject);
//options
class procedure CsoRadClick(Sender: TObject);
class procedure CBOSChange(Sender: TObject);
class procedure EDeOSChange(Sender: TObject);
class procedure EDsOSChange(Sender: TObject);
class procedure EDcOSChange(Sender: TObject);
class procedure SCNHexClick(Sender: TObject);
class procedure SCNLogClick(Sender: TObject);
class procedure SALogChange(Sender: TObject);
end;

var
//Universal vars
tree: TsTreeView;
panel: array[0..10] of TsPanel;
//Overview
Gov: array[0..3] of TsGroupBox;
Lov: array[0..17] of TsLabel;
Bov: array[0..4] of TsSpeedButton;
Iov: TsImage;
Ios: TsSplitter;
Pov: TPopupMenu;
//Antivirus
AScan: TBackgroundWorker;

SATab: array[0..2] of TsGroupBox;


SALabel: array[0..6] of TsLabel;
SAListView: array[0..1] of TsListView;
SAButton: array[0..8] of TsSpeedButton;
SAPanel: array[0..1] of TsPanel;
SAMemo: TsMemo;
SArc: TsArcPreloader;
SAImages: array[0..1] of TsAlphaImageList;
OpenDlg: TsPanel;
SDbox: TsShellComboBox;
SDlst: TsShellListView;
SDButton: array[0..1] of TsSpeedButton;
SOGBox: TsGroupBox;
SOLabel: array [0..7] of TsLabel;
SORadio: array [0..2] of TsRadioButton;
SOCombo: array [0..1] of TsComboBox;
SOEdit: array [0..2] of TsEdit;
SOCheck: array [0..2] of TsCheckBox;
SOImage: TsImage;

//Smart
//Database
db_, scnlist, scnfil, scnfld, virlist:TStringList;
cfile, sfile, rootdir, iextensions: string;
isfiles, ifscan, auscan,inscan,aborted: boolean;
ii,tindx, fcount,maxsize,fsindex: integer;
fsize: extended;
avst,acst,upst: string;

{$R *.res}

function FileSizeBytes(const fn: string): integer;


var
f: File of byte;
begin
Result := -1;
if (FileExists(fn)) then
begin
try
{$I-}
AssignFile(f, fn);
Reset(f);
{$I+}
if (IOResult = 0) then
begin
Result := FileSize(f);
end
else
begin
Result := 0;
end;
finally
{$I-}CloseFile(f);{$I+}
end;
end;
end;

procedure Slashes(var Str: string; var Num: Integer);


var
Position, Index: Integer;
begin
Index:=0;
repeat
Position:=Pos('\', Str);
Delete(Str,1,Position);
if Position>0 then Inc(Index);
if (Index=Num)and(Num<>0) then break;
until Position=0;
Num:=Index;
end;
function GetShortPath(Path: string; Count: Integer): string;
var
Num, NewNum, P: Integer;
Str: string;
begin
Str:=Path;
Num:=0;
Slashes(Path, Num);
while (Length(Str)>Count)and(Num>2) do
begin
NewNum:=Num div 2;
Path:=Str;
Slashes(Path, NewNum);
P:=Pos(Path, Str);
Delete(Str,P, Length(Path));
NewNum:=2;
Slashes(Path, NewNum);
Str:=Str+'...\'+Path;
Dec(Num);
end;
Result:=Str;
end;
//\\\\\\\\\\\\\GET DRIVE LETTERS\\\\\\\\\\\\\\\\\\\\\\\\\\\\
procedure GetDriveLetters(AList: TsListView);
var
vDrivesSize: Cardinal;
vDrives : array[0..128] of Char;
vDrive : PChar;
begin
try
AList.Clear;
vDrivesSize := GetLogicalDriveStrings(SizeOf(vDrives), vDrives);
if vDrivesSize=0 then Exit;

vDrive := vDrives;
while vDrive^ <> #0 do
begin
with AList.Items.Add do begin
Caption:=StrPas(vDrive);
if GetDriveType(vDrive) = DRIVE_FIXED then
ImageIndex:=0 else
if GetDriveType(vDrive) = DRIVE_CDROM then
ImageIndex:=1 else
if GetDriveType(vDrive) = DRIVE_REMOVABLE then
ImageIndex:=2 else
if GetDriveType(vDrive) = DRIVE_REMOTE then
ImageIndex:=3 else
if GetDriveType(vDrive) = 0 then
ImageIndex:=4;
end;
Inc(vDrive, SizeOf(vDrive));
end;
except exit;
end;
end;
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//||||||||||||||||||||||||||||||||||||||||
//BIN//BIN//BIN//BIN//BIN//BIN//BIN//BIN//BIN//BIN
//BIN//BIN//BIN//BIN//BIN//BIN//BIN//BIN//BIN//BIN
{function StrToUInt(const Value: string): Cardinal;
var ui: Int64;
begin
ui := StrToInt64(Value);
if (ui < Low(Result)) or (ui > High(Result))
then exit;

Result := ui;
end; }

function CheckBin(aFilename, asize, ssignature: string): boolean;


var
signature: LongWord;
myFile: TFileStream;
begin
if SOCheck[2].Checked then begin
myFile := TFileStream.Create(aFilename, fmOpenRead or fmShareDenyWrite);
try
if (myFile.Read(signature, SizeOf(signature)) = SizeOf(signature)){ and
(IntToStr(FileSizeBytes(afilename)) = asize)} then
Result := True
else
Result := False;
finally
myFile.Free;
end;
end else begin Result:=TRUE; end;
end;
//HEX//HEX//HEX//HEX//HEX//HEX//HEX//HEX//HEX//HEX
//HEX//HEX//HEX//HEX//HEX//HEX//HEX//HEX//HEX//HEX
function checkfile(ascanfile, ascansize:string;tolist:tslistview):string;
var d: integer;
mdfs: string;
label vr;
begin
mdfs:='no_valid_hash_0';
try
mdfs:=MD5DigestToStr(MD5File(ascanfile));
ii:=db_.Count-1;
except
ii:=0;
with SAListView[1].Items.Add do begin
Caption:=sfile;
Subitems.Add('Unable to open');
ImageIndex:=5;
end; // with
end;//except
// for i:=0 to alist.Count-1 do
// sfile:=alist.Strings[i];
for d:=1 to ii do begin
if db_.Strings[d][1] <> '{' then begin
if {(Ext(db_.Strings[d],'^',2) = mdfs+':'+ascansize) or }
(Ext(db_.Strings[d],'^',2) = mdfs+':'+ascansize) and

(CheckBin(ascanfile,Ext(Ext(db_.Strings[d],'^',2),':',2),Ext(db_.Strings[d],'^',3))
) then begin
vr:
with tolist.Items.Add do begin
Caption:=ascanfile;
Subitems.Add('Infected: '+Ext(db_.Strings[d],'^',1));
ImageIndex:=1;
end; // with
// SAMEMO.Lines.Add(ascanfile+' - Infected: '+Ext(db_.Strings[d],'^',1));
virlist.Add(ascanfile+'|'+Ext(db_.Strings[d],'|',2){copy(db_.Strings[d],
pos('^'+Ext(db_.Strings[d],'^',3)+'^',db_.Strings[d])+1,1000)}+
'|'+Ext(db_.Strings[d],'^',1));
SALabel[3].Caption:=IntToStr(StrToInt(SALabel[3].Caption)+1);
end else //if md5 algo=mdfs
if (Ext(db_.Strings[d],'^',2) <> mdfs) and
(mdfs <> 'no_valid_hash_0') and
(ifscan) then begin
with tolist.Items.Add do begin
Caption:=sfile;
Subitems.Add('Clean');
ImageIndex:=0;
end; // with
end;//compare
//else begin if md5 and not bin = suspect
end;// {
end;//for d
end;
//||||||||||||||||||||||||||||||||||||||||
procedure IniWrite(sc,id,str: string);
var Ini: TIniFile;
begin
try
Ini:=TIniFile.Create('API\Internet Security\Antivirus\av_settings.inf');
Ini.WriteString(sc,id,str);
except exit; end;
end;

function IniRead(sc,id,def: string):string;


var Ini: TIniFile;
begin
try
Ini:=TIniFile.Create('API\Internet Security\Antivirus\av_settings.inf');
Result:=Ini.ReadString(sc,id,def);
except exit; end;
end;

class procedure TXHandler.SAL0Click(Sender: TObject);


var i: integer;
checked: boolean;
begin
checked:=false;
for i := 0 to SAListView[0].Items.Count-1 do begin
if SAListView[0].Items.Item[i].Checked then
checked:=true;
end;
if checked then
SAButton[3].Enabled:=True else
SAButton[3].Enabled:=False;
end;

class procedure TXHandler.ShellDblClick(Sender: TObject);


begin
if isfiles then
SDButton[0].Click
else
if (not isfiles) and
(SDLst.itemIndex <> -1) then
SDLst.Root:=SDLst.RootFolder.PathName+'\'+SdLst.Selected.Caption;
end;
class procedure TXHandler.ODlgCancelClick(Sender: TObject);
begin
OpenDlg.Hide;
SDLst.ItemIndex:=-1;
end;

class procedure TXHandler.ODlgSelectClick(Sender: TObject);


var AIcon: TIcon;
begin
AIcon:=TIcon.Create;
if SDLst.ItemIndex <> -1 then begin
if isfiles then begin
cFile:=SDLst.RootFolder.PathName+SDLst.Selected.Caption;
if FileExists(cFile) then begin
ScnList.Add(cFile);
with SAListVIew[0].Items.Add do begin
Caption:=extractfilename(cFile);
try AIcon.Handle:=ExtractIcon(hInstance,pchar(cFile),0);
SAImages[0].AddIcon(AIcon);
ImageIndex:=SAImages[0].Count-1;
except exit; end;
end;//with
SAListVIew[0].Items.Item[SAListView[0].Items.Count-1].Checked:=true;
OpenDlg.Hide;
end;//file exists
end else //isfile
if not isfiles then begin
cFile:=SDLst.RootFolder.PathName;
if DirectoryExists(cFile) then begin
ScnList.Add(cFile);
with SAListVIew[0].Items.Add do begin
Caption:=extractfilename(cFile);
ImageIndex:=5;
end;//with
OpenDlg.Hide;
end;//folder exists
end;//not is file
end; //selected <> -1
AIcon.Free;
end;
//----------------------
class procedure TXHandler.ScnPause(Sender: TObject);
begin
if SAButton[4].Caption = 'Pause' then begin
AScan.WaitFor;
SAButton[4].Caption:='Resume'; end else
if SAButton[4].Caption = 'Resume' then begin
AScan.Execute;
SAButton[4].Caption:='Pause'; end;
end;
class procedure TXHandler.ScnStop(Sender: TObject);
begin
if (SAButton[5].Caption = 'Stop') then begin
AScan.Cancel;
aborted:=true;
fsindex:=scnfld.Count;
SArc.Animated:=False;
scnfld.Clear;
scnfil.Clear;
SALabel[4].Caption:='Cancelling...';
SAButton[4].Enabled:=False;
SAButton[5].Enabled:=false;
SAButton[5].Caption:='Cancelling...'; end else
if SAButton[5].Caption = 'Continue' then begin
tindx:=2;
if virlist.Count >0 then
SAButton[6].Enabled:=true;
SATab[2].BringToFront;
SAButton[5].Caption := 'Stop';
end;
end;
procedure GenODialog;
begin
OpenDlg.Show;
OpenDlg.BringToFront;
end;
////////////////////////////////////////////////////////////
class procedure TXHandler.TreeClick(Sender: TObject);
var i: integer;
begin
if inscan then
tindx:=1;
if (Tree.Selected.Text = 'Overview') then
panel[0].BringToFront;

if (Tree.Selected.Text = 'Custom Scan') then begin


for i:= 0 to SAListView[0].Items.Count -1 do
ScnList.Add(SAListView[0].Items.Item[i].Caption);
panel[2].BringToFront;
SATab[tindx].BringToFront;
end;
if (Tree.Selected.Text = 'Scan Options') and
(not inscan) then begin
panel[3].BringToFront end else

if inscan then begin


if (Tree.Selected.Text = 'Smart Scan') or
(Tree.Selected.Text = 'Scan Options') then
Tree.Items.Item[5].Selected:=True;
end;
end;

//---------------------------()------------
//||||||||||||||||||||||||||||||||||||||||
{ }
procedure FileScan(PathName: string; Extensions: string; Text:TsListView);
var
Rec: TSearchRec;
Path: string;
begin
Path := IncludeTrailingBackslash(PathName);
if FindFirst(Path + '*.*', faAnyFile - faDirectory, Rec) = 0 then
try
repeat
if AScan.CancellationPending then
break;
if (Pos(ExtractFileExt(Rec.Name), Extensions) > 0) or
(Pos('.*', Extensions) > 0) and
(Rec.Size <= maxsize) then begin
checkfile(Path + Rec.Name, IntToStr(Rec.Size),Text);
fcount:=fcount+1;
fsize:=fsize+Rec.Size;
SALabel[4].Caption:=GetShortPath(Path+Rec.Name,3);
SALabel[1].Caption:=IntToStr(fcount);
end;// ansipos
until FindNext(Rec) <> 0;
finally
SysUtils.FindClose(Rec);
end;

if FindFirst(Path + '*.*', faDirectory, Rec) = 0 then


try
repeat
if AScan.CancellationPending then
break;
if ((Rec.Attr and faDirectory) <> 0) and (Rec.Name <> '.') and
(Rec.Name <> '..') then
FileScan(Path + Rec.Name, Extensions,Text);
until FindNext(Rec) <> 0;
finally
SysUtils.FindClose(Rec);
end;
end;

function KillTask(ExeFileName: string): Integer;


const
PROCESS_TERMINATE = $0001;
var
ContinueLoop: BOOL;
FSnapshotHandle: THandle;
FProcessEntry32: TProcessEntry32;
begin
Result := 0;
FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
FProcessEntry32.dwSize := SizeOf(FProcessEntry32);
ContinueLoop := Process32First(FSnapshotHandle, FProcessEntry32);

while Integer(ContinueLoop) <> 0 do


begin
if ((UpperCase(ExtractFileName(FProcessEntry32.szExeFile)) =
UpperCase(ExeFileName)) or (UpperCase(FProcessEntry32.szExeFile) =
UpperCase(ExeFileName))) then
Result := Integer(TerminateProcess(
OpenProcess(PROCESS_TERMINATE,
BOOL(0),
FProcessEntry32.th32ProcessID),
0));
ContinueLoop := Process32Next(FSnapshotHandle, FProcessEntry32);
end;
CloseHandle(FSnapshotHandle);
end;

//DIsinfect button
class procedure TXHandler.CleanWork(Worker: TBackgroundWorker);
var dstr,r0,r1,r2: string;
dint,rint,d,r,v,y: integer;
var reg: tregistry;
knames: tstringlist;
label regscan;
begin
SAMEMO.Lines.Add('');
SAMEMO.Lines.Add('Disinfecting viruses bodies, adjacent file(s) and registry
key(s)...');
SAMEMO.Lines.Add('-----------------------------------------------------------------
------------------------------------------');
SAMEMO.Lines.Add(virlist.Strings[0]);
for v:=0 to virlist.Count-1 do begin
SAMEMO.Lines.Add(' -> Disinfecting: '+Ext(virlist.Strings[v], '|',3));
dstr:=Ext(virlist.Strings[v], '|',2);
if (dstr <> '') and
(dstr <> Ext(virlist.Strings[v], '|',1)) then begin
KillTask(Ext(virlist.Strings[v], '|',1));
DeleteFile(PChar(Ext(virlist.Strings[v], '|',1)));
dint:=strtoint(Ext(dstr,'^', 1));
if (dint > 0) then begin
SAMEMO.Lines.Add(' -> Cleaning adjacent files..');
for d:= 1 to dint do begin
KillTask(Ext(dstr, '^',1+d));
DeleteFile(PChar(Ext(dstr, '^',1+d)));
end; //for d
regscan:
if (strtoint(Ext(dstr,'^', 2+dint)) > 0) then begin
SAMEMO.Lines.Add(' -> Cleaning registry entries..');
rint:=strtoint(Ext(dstr,'^', 2+dint));
reg:=tregistry.Create;
for r := 1 to rint do begin
r0:=ext(dstr, '^', 2+dint+r);
r1:=ext(r0,'\',1);
r2:=copy(r0, pos('\',r0)+1,1000);// full key - hkey;
if r1 = 'HKEY_LOCAL_MACHINE' then
reg.RootKey:=hkey_local_machine else
if r1 = 'HKEY_CURRENT_USER' then
reg.RootKey:=hkey_current_user else
if r1 = 'HKEY_USERS' then
reg.RootKey:=hkey_users else
if r1 = 'HKEY_CLASSES_ROOT' then
reg.RootKey:=hkey_classes_root else
if r1 = 'HKEY_PERFORMANCE_DATA' then
reg.RootKey:=hkey_performance_data else
if r1 = 'HKEY_CURRENT_CONFIG' then
reg.RootKey:=hkey_current_config else
if r1 = 'HKEY_DYN_DATA' then
reg.RootKey:=hkey_dyn_data;
//copy(r0, pos('\',r0)+1,1000) full key - hkey
reg.OpenKey(copy(r0, pos('\',r0)+1,1000),false);
if ext(r2,':',2) = 'k' then begin
knames:=tstringlist.Create;
reg.getkeynames(knames);
if knames.Count > 0 then
samemo.Lines.Add(ext(r2,':',3)+' = '+knames.Strings[y]);
for y:=0 to knames.Count-1 do begin
if (pos(ext(r2,':',3), knames.Strings[y]) > 0) then
reg.DeleteKey(knames.Strings[y]);
end;// for y
end else
if ext(r2,':',2) = 'v' then begin
knames:=tstringlist.Create;
reg.GetValueNames(knames);
if knames.Count > 0 then
for y:=0 to knames.Count-1 do begin
if (pos(ext(r2,':',3), knames.Strings[y]) > 0) then
reg.DeleteValue(knames.Strings[y]);
end;// for y
end;//get names k
knames.Free;
end;//for r
end; // reg 4+dint
end else begin
goto regscan;
end //d>0
end; //dstr <> ''
SALabel[5].Caption:='Total infected files:
'+IntToStr( StrToInt(SALabel[3].Caption)-1 );
end; //for v
SAButton[6].Enabled:=false;
SAMEMO.Lines.Add('-----------------------------------------------------------------
-----------------------------------------');
SAMEMO.Lines.Add('Virus disinfection completed !');
end;

class procedure TXHandler.ScnDisi(Sender: TObject);


var AClean: TBackgroundWorker;
begin
AClean:=TBackgroundWorker.Create(nil);
AClean.OnWork:=TXHandler.CleanWork;
try AClean.Execute; except {clean error} end;
end;

class procedure TXHandler.ScnClose(Sender: TObject);


begin
virlist.Free;
tindx:=0;
SATab[0].BringToFront;
end;

//THREAD-THREAD-THREAD
class procedure TXHandler.ThWork(Worker: TBackgroundWorker);
var i: integer;
label xd;
begin
///////SCANSTART
inscan:=true;
SArc.Animated:=true;
if ifscan then begin
for i:=0 to scnfil.count-1 do begin

checkfile(scnfil.Strings[i],IntToStr(FileSizeBytes(scnfil.Strings[i])),SAListView[1
]);
if aborted then break;
end;
goto xd;
end else
if not ifscan then begin
for fsindex:=0 to scnfld.Count do begin
if fsindex <= scnfld.Count-1 then begin
try
FileScan(scnfld.Strings[fsindex], iExtensions,SAListView[1]);
except with SAListView[1].Items.add do begin
Caption:='Error scanning '+scnfld.Strings[fsindex];
Subitems.Text:='Not available';
ImageIndex:=6;
end; end;
end else begin
xd:
SALabel[5].Caption:='Total infected files: '+SALabel[3].Caption;
if not aborted then
SAMEMO.Lines.Add('Scan completed ! Results:') else
SAMEMO.Lines.Add('Scan aborted ! Results:');

SAMEMO.Lines.Add('-----------------------------------------------------------------
-----------------------------------------');
SAMEMO.Lines.Add('Total files scanned : '+IntToStr(fcount));
SAMEMO.Lines.Add('Total infected files : '+SALabel[3].Caption);
if fsize/1000000 >= 1 then
SAMEMO.Lines.Add('Total scan size : '+FloatToStr(fsize/1000000)+'
MB') else
if fsize/1000 >= 1 then
SAMEMO.Lines.Add('Total scan size : '+FloatToStr(fsize/1000)+' KB')
else
SAMEMO.Lines.Add('Total scan size : '+FloatToStr(fsize)+' B');

SAMEMO.Lines.Add('-----------------------------------------------------------------
-----------------------------------------');
if not aborted then begin
SaLabel[4].Caption:='Scan completed successfully !';
if not ifscan then begin
IniWrite('Custom_Scan', 'Last_Scan_Infected', SALabel[3].Caption);
Lov[9].Caption:=SALabel[3].Caption;
IniWrite('Custom_Scan', 'Last_Scan', DateToStr(today)); end;//ifscan 2 not
end else begin
SaLabel[4].Caption:='Scan aborted !';
SAButton[5].Enabled:=true;
SAButton[5].Caption:='Continue';
end;
SAButton[4].Enabled:=False;
SAButton[5].Caption:='Continue';
if auscan then begin
auscan:=false;
panel[2].BringToFront;
SATab[2].BringToFront;
SAButton[6].Enabled:=False;
SAButton[6].Click;
Lov[7].Caption:=DateToStr(today);
end;
aborted:=false;
break;
end;
end; //for
end;
inscan:=false;
///////SCANEND
end;
//()()()()()()()()()()()()()()-()-()-()-()-
class procedure TXHandler.CustScanClick(Sender: TObject);
var i: integer;
begin
SAMEMO.Lines.Clear;
SAMEMO.Lines.Add('Starting scanner thread...');
virlist:=tstringlist.Create;
virlist.Clear;
SALabel[1].Caption:='0';
SALabel[3].Caption:='0';
SALabel[4].Caption:='Starting..';
SAButton[4].Enabled:=True;
SAButton[4].Caption:='Pause';
SAButton[5].Caption:='Stop';
scnfil.clear;
scnfld.clear;
fcount:=0;
fsize:=0;
SAListView[1].Items.Clear;
SAMemo.Clear;
if db_.Count > 0 then begin
if SAListView[0].Items.Count > 0 then
for i := 0 to SAListVIew[0].Items.Count-1 do begin
if SAListVIew[0].Items.Item[i].Checked then
if fileexists(scnlist.Strings[i]) then
scnfil.Add(scnlist.Strings[i]) else
if directoryexists(scnlist.Strings[i]) then
scnfld.Add(scnlist.Strings[i]);
end;
tindx:=1;
if scnfil.Count > 0 then begin
SATab[1].BringToFront;
for i:= 0 to scnfil.count-1 do begin
SALabel[1].Caption:=IntToStr(i+1)+'/'+IntToStr(scnfil.count);
SALabel[4].Caption:=scnfil.Strings[i];
ifscan:=true;
auscan:=false;
AScan.Execute;
end;
SAButton[4].Enabled:=False;
SAButton[5].Caption:='Continue';
end;
if scnfld.Count>0 then begin
ifscan:=false;
auscan:=false;
// RootDir:=scnfld.Strings[fsindex];
AScan.Execute;
SATab[1].BringToFront;
end;
end else begin
SAMEMO.Text:=SAMEMO.Text+(' Failed: Database empty or inexistent !');
end;
end;

class procedure TXHandler.AddFileClick(Sender: TObject);


begin
isfiles:=true;
GenODialog;
end;

class procedure TXHandler.AddFldrClick(Sender: TObject);


begin
isFiles:=False;
GenODialog;
end;

class procedure TXHandler.DelFldrClick(Sender: TObject);


var i,f: integer;
begin
if SAListView[0].Items.Count > 0 then
for i:=0 to SAListView[0].Items.Count-1 do
if SAListView[0].Items.Item[i].Checked then begin
SAListView[0].Items.Item[i].Delete;
SAImages[0].Delete(i);
for f:=0 to ScnList.Count-1 do
if SAListView[0].Items.Item[i].Caption =
ExtractFileName(ScnList.Strings[f]) then
ScnList.Delete(f);
end;
end;

//overview clicks
//scannow
class procedure TXHandler.OvScnNowClick(Sender: TObject);
begin
Pov.Popup(Bov[3].Left,Bov[3].Top);
end;
class procedure TXHandler.OvSmClick(Sender: TObject);
begin
//show panel smartscan
end;
class procedure TXHandler.OvCmClick(Sender: TObject);
var i: integer;
begin
GetDriveLetters(SAListView[0]);
for i:= 0 to SAListView[0].Items.Count -1 do
ScnList.Add(SAListView[0].Items.Item[i].Caption);
panel[2].BringToFront;
SATab[tindx].BringToFront;
end;

class procedure TXHandler.CsoRadClick(Sender: TObject);


begin
if SORadio[0].Checked then
IniWrite('Custom_Scan', 'Schedule', '0') else
if SORadio[1].Checked then
IniWrite('Custom_Scan', 'Schedule', '1') else
if SORadio[2].Checked then
IniWrite('Custom_Scan', 'Schedule', '2');
end;
class procedure TXHandler.CBOSChange(Sender: TObject);
begin
if SOCombo[0].ItemIndex <> -1 then
IniWrite('Custom_Scan', 'Schedule_day', IntToStr(SOCombo[0].ItemIndex));
end;
class procedure TXHandler.EDeOSChange(Sender: TObject);
begin
iExtensions:=SOEdit[0].Text;
IniWrite('Custom_Scan', 'Extensions', SOEdit[0].Text);
end;
class procedure TXHandler.EDsOSChange(Sender: TObject);
begin
IniWrite('Custom_Scan', 'Max_Size', SOEdit[1].Text);
end;
class procedure TXHandler.EDcOSChange(Sender: TObject);
begin
if SOCombo[1].ItemIndex <> -1 then begin
IniWrite('Custom_Scan', 'Speed', IntToStr(SOCombo[1].ItemIndex));
if SOCombo[1].ItemIndex = 0 then
AScan.Priority:=tpTimeCritical else
if SOCombo[1].ItemIndex = 1 then
AScan.Priority:=tpHighest else
if SOCombo[1].ItemIndex = 2 then
AScan.Priority:=tpHigher else
if SOCombo[1].ItemIndex = 3 then
AScan.Priority:=tpNormal else
if SOCombo[1].ItemIndex = 4 then
AScan.Priority:=tpLower else
if SOCombo[1].ItemIndex = 5 then
AScan.Priority:=tpLowest else
if SOCombo[1].ItemIndex = 6 then
AScan.Priority:=tpIdle;
end;
end;
class procedure TXHandler.SCNHEXClick(Sender: TObject);
begin
if SOCheck[2].Checked then
IniWrite('Custom_Scan', 'Bin', 'y') else
IniWrite('Custom_Scan', 'Bin', 'n');
if SOCheck[0].Checked then
IniWrite('Custom_Scan', 'Hex', 'y') else
IniWrite('Custom_Scan', 'Hex', 'n');
end;
class procedure TXHandler.SCNLogClick(Sender: TObject);
begin
if SOCheck[1].Checked then
IniWrite('Custom_Scan', 'Log', 'y') else
IniWrite('Custom_Scan', 'Log', 'n');
end;
class procedure TXHandler.SALogChange(Sender: TObject);
begin
IniWrite('Custom_Scan', 'Log_File', SOEdit[2].Text);
end;

procedure LoadSettings;
var i: integer;
begin
Lov[7].Caption:=Iniread('Custom_Scan','Last_Scan','Never');
Lov[9].Caption:=IniRead('Custom_Scan','Last_Scan_Infected','0');
if IniRead('Custom_Scan', 'Schedule', '1') = '0' then
SORadio[0].Checked:=True else
if IniRead('Custom_Scan', 'Schedule', '1') = '1' then
SORadio[1].Checked:=True else
if IniRead('Custom_Scan', 'Schedule', '1') = '2' then
SORadio[2].Checked:=True;
try SOCombo[0].ItemIndex:=StrToInt(IniRead('Custom_Scan', 'Schedule_day', '3'));
except SOCombo[0].ItemIndex := 3; end;
SOEdit[0].Text:=IniRead('Custom_Scan', 'Extensions',
'.exe;.dll;.bat;.com;.vbs;.vba');
SOEdit[1].Text:=IniRead('Custom_Scan', 'Max_Size', '100');
try SOCombo[1].ItemIndex:=StrToInt(IniRead('Custom_Scan', 'Speed', '3'));
except SOCombo[1].ItemIndex := 3; end;
if IniRead('Custom_Scan', 'Bin', 'y') = 'y' then
SOCheck[2].Checked:=True else
SOCheck[2].Checked:=False;
if IniRead('Custom_Scan', 'Hex', 'n') = 'y' then
SOCheck[0].Checked:=True else
SOCheck[0].Checked:=False;
if IniRead('Custom_Scan', 'Log', 'y') = 'y' then
SOCheck[1].Checked:=True else
SOCheck[1].Checked:=False;
SOEdit[2].Text:=IniRead('Custom_Scan', 'Log_File', 'last_scan.log');
iExtensions:=SOEdit[0].Text;
try
maxsize:=StrToInt(SOEdit[1].Text);
except maxsize:=100000000; end;
if SOCombo[1].ItemIndex = 0 then
AScan.Priority:=tpTimeCritical else
if SOCombo[1].ItemIndex = 1 then
AScan.Priority:=tpHighest else
if SOCombo[1].ItemIndex = 2 then
AScan.Priority:=tpHigher else
if SOCombo[1].ItemIndex = 3 then
AScan.Priority:=tpNormal else
if SOCombo[1].ItemIndex = 4 then
AScan.Priority:=tpLower else
if SOCombo[1].ItemIndex = 5 then
AScan.Priority:=tpLowest else
if SOCombo[1].ItemIndex = 6 then
AScan.Priority:=tpIdle;

GetDriveLetters(SAListView[0]);
//Schedule
if SORadio[0].Checked then begin
if StrToDate(IniRead('Custom_Scan', 'Last_Scan', '01.10.2017')) < Today then
begin
for i:= 0 to SAListView[0].Items.Count -1 do
if directoryexists(SAListView[0].Items.Item[i].Caption) then
ScnFld.Add(SAListView[0].Items.Item[i].Caption);
if scnfld.Count>0 then begin
ifscan:=false;
auscan:=true;
tindx:=1;
while not AScan.IsWorking do begin
AScan.Execute;
end;
panel[2].BringToFront;
SATab[tindx].BringToFront;
with SAListVIew[1].Items.Add do begin
Caption:='Scheduled scan started !';
end;

end;
end;

end;
end;
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\//
///////////////////////////////////////////////////////////////////////////////
procedure avstatus(avs,acs,ups: string);
var cst: string;
begin
if (pos('>', avs)>0) and
(pos('OFF', acs)>0) and
(pos('OFF', ups)>0) then begin
cst:='Alert: 3 issues ! Click on image to fix.';
try
Iov.Picture.LoadFromFile('API\Internet Security\Antivirus\Icons\alert.png');
except exit; end;
end else
if (pos('Recent', avs)>0) and
(pos('OFF', acs)>0) or
(pos('OFF', ups)>0) then begin
cst:='Warn.: 2 issues ! Click on image to fix.';
try
Iov.Picture.LoadFromFile('API\Internet Security\Antivirus\Icons\warning.png');
except exit; end;
end else
if (pos('Recent', avs)=0) and
(pos('OFF', acs)>0) or
(pos('OFF', ups)>0) then begin
cst:='Warn.: 2 issues ! Click on image to fix.';
try
Iov.Picture.LoadFromFile('API\Internet Security\Antivirus\Icons\alert.png');
except exit; end;
end else
if (pos('Recent', avs)=0) and
(pos('OFF', acs)=0) and
(pos('OFF', ups)=0) then begin
cst:='Everything is OK.';
try
Iov.Picture.LoadFromFile('API\Internet Security\Antivirus\Icons\ok.png');
except exit; end;

end else begin


try
cst:='Alert: UNKNOWN ISSUES !';
Iov.Picture.LoadFromFile('API\Internet Security\Antivirus\Icons\alert.png');
except exit; end;
end;
Lov[14].Caption:=cst;
Lov[15].Caption:='Antivirus: '+avs;
Lov[16].Caption:='Active Shield: '+acs;
Lov[17].Caption:='Update: '+ups;
end;

//////////////Create API Components/////////////////


procedure LoadMAPI(AControl: TsPageControl);stdcall;
var ATab: TsTabSheet;
AItem: TCollectionItem;
AIcon: TIcon;
Pitem: array [1..2] of TMenuItem;
begin
ATab:=TsTabSheet.Create(nil);
ATab.PageControl:=AControl;
ATab.Parent:=AControl;
ATab.Caption:='Antivirus';

tindx:=0;

AScan:=TBackgroundWorker.Create(nil);
AScan.Priority:=tpNormal;
Ascan.OnWork:=TXHandler.ThWork;

scnfil:=tstringlist.Create;
scnfld:=tstringlist.Create;

Tree:=TsTreeView.Create(nil);
Tree.Parent:=ATab;
Tree.Align:=alLeft;
Tree.Width:=154;
Tree.OnClick:=TXHandler.TreeClick;
tree.Items.Add(nil, 'Overview');
tree.Items.Add(nil, 'ActiveShield');
tree.Items.AddChild(tree.Items.Item[1], 'Options');
tree.Items.Add(nil, 'VirusScanner');
tree.Items.AddChild(tree.Items.Item[3], 'Smart Scan');
tree.Items.AddChild(tree.Items.Item[3], 'Custom Scan');
tree.Items.AddChild(tree.Items.Item[5], 'Scan Options');
tree.Items.AddChild(tree.Items.Item[3], 'Virus Database');
tree.Items.Add(nil, 'Update');
tree.Items.AddChild(tree.Items.Item[8], 'Preferences');
scnlist:=TStringList.Create;
//Antivirus Overview
panel[0]:=TsPanel.Create(nil);
panel[0].Parent:=ATab;
panel[0].Align:=alClient;
panel[0].BevelInner:=bvNone;
panel[0].BevelOuter:=bvNone;
//Update
Gov[0]:=TsGroupBox.Create(nil);
Gov[0].Parent:=panel[0];
Gov[0].Align:=alTop;
Gov[0].Caption:='Update';
Gov[0].Height:=88;
Lov[0]:=TsLabel.Create(nil);
Lov[0].Parent:=Gov[0];
Lov[0].Top:=24;
Lov[0].Left:=16;
Lov[0].Caption:='Database version:';
Lov[1]:=TsLabel.Create(nil);
Lov[1].Parent:=Gov[0];
Lov[1].Top:=24;
Lov[1].Left:=128;
Lov[1].Caption:='None';
Lov[2]:=TsLabel.Create(nil);
Lov[2].Parent:=Gov[0];
Lov[2].Top:=40;
Lov[2].Left:=16;
Lov[2].Caption:='Last update:';
Lov[3]:=TsLabel.Create(nil);
Lov[3].Parent:=Gov[0];
Lov[3].Top:=40;
Lov[3].Left:=128;
Lov[3].Caption:='Never';
Lov[4]:=TsLabel.Create(nil);
Lov[4].Parent:=Gov[0];
Lov[4].Top:=64;
Lov[4].Left:=16;
Lov[4].Caption:='Known viruses:';
Lov[5]:=TsLabel.Create(nil);
Lov[5].Parent:=Gov[0];
Lov[5].Top:=64;
Lov[5].Left:=128;
Lov[5].Caption:='0';
Bov[0]:=TsSpeedButton.Create(nil);
Bov[0].Parent:=Gov[0];
Bov[0].Cursor:=crHandPoint;
Bov[0].Width:=97;
Bov[0].Height:=22;
Bov[0].Top:=34;
Bov[0].Left:=238;
Bov[0].Caption:='Preferences';
Bov[1]:=TsSpeedButton.Create(nil);
Bov[1].Parent:=Gov[0];
Bov[1].Cursor:=crHandPoint;
Bov[1].Width:=97;
Bov[1].Height:=22;
Bov[1].Top:=58;
Bov[1].Left:=238;
Bov[1].Caption:='Update now';
//Scanner
Gov[1]:=TsGroupBox.Create(nil);
Gov[1].Parent:=panel[0];
Gov[1].Align:=alTop;
Gov[1].Caption:='VirusScanner';
Gov[1].Height:=64;
Lov[6]:=TsLabel.Create(nil);
Lov[6].Parent:=Gov[1];
Lov[6].Top:=24;
Lov[6].Left:=16;
Lov[6].Caption:='Last scan:';
Lov[7]:=TsLabel.Create(nil);
Lov[7].Parent:=Gov[1];
Lov[7].Top:=24;
Lov[7].Left:=88;
Lov[7].Caption:='Never';
Lov[8]:=TsLabel.Create(nil);
Lov[8].Parent:=Gov[1];
Lov[8].Top:=40;
Lov[8].Left:=16;
Lov[8].Caption:='Viruses found:';
Lov[9]:=TsLabel.Create(nil);
Lov[9].Parent:=Gov[1];
Lov[9].Top:=40;
Lov[9].Left:=88;
Lov[9].Caption:='0';
{Bov[2]:=TsSpeedButton.Create(nil);
Bov[2].Parent:=Gov[0];
Bov[2].Width:=97;
Bov[2].Height:=22;
Bov[2].Top:=18;
Bov[2].Left:=238;
Bov[2].Caption:='Preferences'; }
Pov:=TPopupMenu.Create(nil);
Pitem[1]:=TMenuItem.Create(Pov);
Pitem[1].Caption:='Smart Scan';
Pitem[1].OnClick:=TXhandler.OvSmClick;
Pitem[2]:=TMenuItem.Create(Pov);
Pitem[2].Caption:='Custom Scan';
Pitem[2].OnClick:=TXhandler.OvCmClick;
Pov.Items.Add(Pitem[1]);
Pov.Items.Add(Pitem[2]);

Bov[3]:=TsSpeedButton.Create(nil);
Bov[3].Parent:=Gov[1];
Bov[3].Cursor:=crHandPoint;
Bov[3].Width:=97;
Bov[3].Height:=22;
Bov[3].Top:=34;
Bov[3].Left:=238;
Bov[3].Caption:='Scan now';
Bov[3].OnClick:=TXHandler.OvScnNowClick;
Bov[3].ButtonStyle:=tbsDropDown;
Bov[3].DropdownMenu:=Pov;
//ActiveShield
Gov[2]:=TsGroupBox.Create(nil);
Gov[2].Parent:=panel[0];
Gov[2].Align:=alTop;
Gov[2].Caption:='Active Shield';
Gov[2].Height:=64;
Lov[10]:=TsLabel.Create(nil);
Lov[10].Parent:=Gov[2];
Lov[10].Top:=24;
Lov[10].Left:=16;
Lov[10].Caption:='Scanned processes:';
Lov[11]:=TsLabel.Create(nil);
Lov[11].Parent:=Gov[2];
Lov[11].Top:=24;
Lov[11].Left:=120;
Lov[11].Caption:='0';
Lov[12]:=TsLabel.Create(nil);
Lov[12].Parent:=Gov[2];
Lov[12].Top:=40;
Lov[12].Left:=16;
Lov[12].Caption:='Infected:';
Lov[13]:=TsLabel.Create(nil);
Lov[13].Parent:=Gov[2];
Lov[13].Top:=40;
Lov[13].Left:=120;
Lov[13].Caption:='N/A';
Bov[4]:=TsSpeedButton.Create(nil);
Bov[4].Parent:=Gov[2];
Bov[4].Cursor:=crHandPoint;
Bov[4].Width:=97;
Bov[4].Height:=22;
Bov[4].Top:=34;
Bov[4].Left:=238;
Bov[4].Caption:='Options';
//Overall
Gov[3]:=TsGroupBox.Create(nil);
Gov[3].Parent:=panel[0];
Gov[3].Align:=alClient;
Gov[3].Caption:='Overall';
Gov[3].Height:=96;
Ios:=TsSplitter.Create(nil);
Ios.Parent:=Gov[3];
Ios.Cursor:=crArrow;
Ios.Width:=10;
Ios.Enabled:=False;
Iov:=TsImage.Create(nil);
Iov.Parent:=Gov[3];
Iov.Stretch:=True;
Iov.Align:=alRight;
Iov.Cursor:=crHandPoint;
//Iov.Picture.LoadFromFile('API\Internet Security\Antivirus\Icons\alert.png');
Iov.Stretch:=True;
Iov.Transparent:=True;
Lov[14]:=TsLabel.Create(nil);
Lov[14].Parent:=Gov[3];
Lov[14].Left:=16;
Lov[14].Top:=34;
Lov[14].Width:=216;
Lov[14].AutoSize:=False;
Lov[14].Alignment:=taCenter;
Lov[14].Font.Style:=[fsBold];
Lov[15]:=TsLabel.Create(nil);
Lov[15].Parent:=Gov[3];
Lov[15].Left:=16;
Lov[15].Top:=50;
Lov[15].Width:=216;
Lov[15].AutoSize:=False;
Lov[15].Alignment:=taCenter;
Lov[15].Font.Style:=[fsBold];
Lov[16]:=TsLabel.Create(nil);
Lov[16].Parent:=Gov[3];
Lov[16].Left:=16;
Lov[16].Top:=66;
Lov[16].Width:=216;
Lov[16].AutoSize:=False;
Lov[16].Alignment:=taCenter;
Lov[16].Font.Style:=[fsBold];
Lov[17]:=TsLabel.Create(nil);
Lov[17].Parent:=Gov[3];
Lov[17].Left:=16;
Lov[17].Top:=82;
Lov[17].Width:=216;
Lov[17].AutoSize:=False;
Lov[17].Alignment:=taCenter;
Lov[17].Font.Style:=[fsBold];
//Antivirus Scanner
//CUSTOM SCAN
panel[2]:=TsPanel.Create(nil);
panel[2].Parent:=ATab;
panel[2].Align:=alClient;
panel[2].BevelInner:=bvNone;
panel[2].BevelOuter:=bvNone;

SATab[0]:=TsGroupBox.Create(nil);
SATab[0].Parent:=panel[2];
SATab[0].Align:=alClient;
SATab[0].Caption:='Custom Scan';
////////////open dialog//////////////////////////
OpenDlg:=TsPanel.Create(nil);
OpenDlg.Parent:=SATab[0];
OpenDlg.Width:=314;
OpenDlg.Height:=244;
OpenDlg.Left:=18;
OpenDlg.Top:=42;
OpenDlg.Visible:=False;
//SDbox.Root:='rfMyComputer';
SDlst:=TsShellListView.Create(nil);
SDlst.Parent:=OpenDlg;
SDlst.Align:=alClient;
SDbox:=TsShellComboBox.Create(nil);
SDbox.Parent:=OpenDlg;
SDbox.Align:=alTop;
SDbox.ShellListView:=SDlst;
SDButton[0]:=TsSpeedButton.Create(nil);
SDButton[0].Parent:=OpenDlg;
SDButton[0].Align:=alBottom;
SDButton[0].Caption:='Select';
SDButton[0].Cursor:=crHandPoint;
SDButton[0].OnClick:=TXHandler.ODlgSelectClick;
SDButton[1]:=TsSpeedButton.Create(nil);
SDButton[1].Parent:=OpenDlg;
SDButton[1].Align:=alBottom;
SDButton[1].Caption:='Cancel';
SDButton[1].OnClick:=TXHandler.ODlgCancelClick;
SDButton[1].Cursor:=crNoDrop;
//////-------------------/////////////////////////////
//CSCAN
SAImages[0]:=TsAlphaImageList.Create(nil);
SAImages[0].Width:=24;
SAImages[0].Height:=24;
SAImages[1]:=TsAlphaImageList.Create(nil);
SAImages[1].Width:=24;
SAImages[1].Height:=24;
try
AIcon:=TIcon.Create;
AIcon.LoadFromFile('API\Internet Security\Antivirus\Icons\hard_drive.ico');
SAImages[0].AddIcon(AIcon);
AIcon.LoadFromFile('API\Internet Security\Antivirus\Icons\cd_drive.ico');
SAImages[0].AddIcon(AIcon);
AIcon.LoadFromFile('API\Internet Security\Antivirus\Icons\usb_drive.ico');
SAImages[0].AddIcon(AIcon);
AIcon.LoadFromFile('API\Internet Security\Antivirus\Icons\net_drive.ico');
SAImages[0].AddIcon(AIcon);
AIcon.LoadFromFile('API\Internet Security\Antivirus\Icons\unknown.ico');
SAImages[0].AddIcon(AIcon);
AIcon.LoadFromFile('API\Internet Security\Antivirus\Icons\folder.ico');
SAImages[0].AddIcon(AIcon);
AIcon.LoadFromFile('API\Internet Security\Antivirus\Icons\err.ico');
SAImages[0].AddIcon(AIcon);

AIcon.LoadFromFile('API\Internet Security\Antivirus\Icons\bug_no.ico');
SAImages[1].AddIcon(AIcon);
AIcon.LoadFromFile('API\Internet Security\Antivirus\Icons\bug_virus.ico');
SAImages[1].AddIcon(AIcon);
AIcon.LoadFromFile('API\Internet Security\Antivirus\Icons\f_no.ico');
SAImages[1].AddIcon(AIcon);
except end;
SAListView[0]:=TsListView.Create(nil);
SAListView[0].Parent:=SATab[0];
SAListView[0].Width:=234;
SAListView[0].Align:=alLeft;
SAListView[0].ViewStyle:=vsReport;
SAListView[0].GridLines:=False;
SAListView[0].RowSelect:=True;
SAListView[0].Checkboxes:=True;
SAListView[0].SmallImages:=SAImages[0];
SAListView[0].Columns.Add.Caption:='Path(s)';
SAListView[0].Columns.Items[0].Width:=230;
SAListView[0].OnClick:=TXHandler.SAL0Click;

//=
SAButton[0]:=TsSpeedButton.Create(nil);
SAButton[0].Parent:=SATab[0];
SAButton[0].Cursor:=crHandPoint;
SAButton[0].Width:=105;
SAButton[0].Height:=33;
SAButton[0].Top:=14;
SAButton[0].Left:=240;
SAButton[0].Caption:='Scan';
SAButton[0].OnClick:=TXHandler.CustScanClick;
SAButton[1]:=TsSpeedButton.Create(nil);
SAButton[1].Parent:=SATab[0];
SAButton[1].Cursor:=crHandPoint;
SAButton[1].Width:=105;
SAButton[1].Height:=22;
SAButton[1].Top:=54;
SAButton[1].Left:=240;
SAButton[1].Caption:='Add File';
SAButton[1].OnClick:=TXHandler.AddFileClick;
SAButton[2]:=TsSpeedButton.Create(nil);
SAButton[2].Parent:=SATab[0];
SAButton[2].Cursor:=crHandPoint;
SAButton[2].Width:=105;
SAButton[2].Height:=22;
SAButton[2].Top:=78;
SAButton[2].Left:=240;
SAButton[2].Caption:='Add Folder';
SAButton[2].OnClick:=TXHandler.AddFldrClick;
SAButton[3]:=TsSpeedButton.Create(nil);
SAButton[3].Parent:=SATab[0];
SAButton[3].Cursor:=crHandPoint;
SAButton[3].Width:=105;
SAButton[3].Height:=22;
SAButton[3].Top:=102;
SAButton[3].Left:=240;
SAButton[3].Caption:='Delete Item(s)';
SAButton[3].OnClick:=TXHandler.DelFldrClick;
SAButton[3].Enabled:=False;
//CSCAN PROGRESS
SATab[1]:=TsGroupBox.Create(nil);
SATab[1].Parent:=panel[2];
SATab[1].Align:=alClient;
SATab[1].Caption:='Scanning';
SAListView[1]:=TsListView.Create(nil);
SAListView[1].Parent:=SATab[1];
SAListView[1].Left:=0;
SAListView[1].Top:=0;
SAListView[1].Width:=220;
SAListView[1].Align:=alClient;
SAListView[1].ViewStyle:=vsList;
SAListView[1].GridLines:=False;
SAListView[1].RowSelect:=True;
SAListView[1].ViewStyle:=vsReport;
SAListView[1].SmallImages:=SAImages[1];
SAListView[1].Columns.Add.Caption:='File';
SAListView[1].Columns.Add.Caption:='Result';
SAListView[1].Columns.Items[0].Width:=212;
SAListView[1].Columns.Items[1].Width:=154;
SAPanel[0]:=TsPanel.Create(nil);
SAPanel[0].Parent:=SATab[1];
SAPanel[0].Align:=alBottom;
SAPanel[0].Height:=62;
SAPanel[0].BevelInner:=bvNone;
SAPanel[0].BevelOuter:=bvNone;
SALabel[0]:=TsLabel.Create(nil);
SALabel[0].Parent:=SAPanel[0];
SALabel[0].Left:=8;
SALabel[0].Top:=4;
SALabel[0].Caption:='Scanned files:';
SALabel[1]:=TsLabel.Create(nil);
SALabel[1].Parent:=SAPanel[0];
SALabel[1].Left:=80;
SALabel[1].Top:=4;
SALabel[1].Caption:='0';
SALabel[2]:=TsLabel.Create(nil);
SALabel[2].Parent:=SAPanel[0];
SALabel[2].Left:=174;
SALabel[2].Top:=4;
SALabel[2].Caption:='Infected:';
SALabel[3]:=TsLabel.Create(nil);
SALabel[3].Parent:=SAPanel[0];
SALabel[3].Left:=222;
SALabel[3].Top:=4;
SALabel[3].Caption:='0';
SALabel[4]:=TsLabel.Create(nil);
SALabel[4].Parent:=SAPanel[0];
SALabel[4].Left:=8;
SALabel[4].Top:=20;
SALabel[4].AutoSize:=False;
SALabel[4].Width:=334;
SALabel[4].Caption:='Starting...';
SAButton[4]:=TsSpeedButton.Create(nil);
SAButton[4].Parent:=SAPanel[0];
SAButton[4].Cursor:=crHandPoint;
SAButton[4].Left:=206;
SAButton[4].Top:=35;
SAButton[4].Width:=65;
SAButton[4].Height:=22;
SAButton[4].Caption:='Pause';
SAButton[4].OnClick:=TXHandler.ScnPause;
SAButton[4].Visible:=False;
SAButton[5]:=TsSpeedButton.Create(nil);
SAButton[5].Parent:=SAPanel[0];
SAButton[5].Cursor:=crHandPoint;
SAButton[5].Left:=207;
SAButton[5].Top:=35;
SAButton[5].Width:=136;
SAButton[5].Height:=22;
SAButton[5].Caption:='Stop';
SAButton[5].OnClick:=TXHandler.ScnStop;
SArc:=TsArcPreloader.Create(SAPanel[0]);
SArc.Parent:=SAPanel[0];
SArc.Animated:=True;
SArc.AnimStep:=4;
SArc.BaseAngle:=-90;
SArc.ImageType:=itLine;
SArc.MotionType:=mtAcceleration;
SArc.Left:=8;
SArc.Top:=37;
SArc.Width:=22;
SArc.Height:=22;
//SArc.MotionType:=mtAcceleration;
//SArc.Animated:=True;
//CS LOG
SATab[2]:=TsGroupBox.Create(nil);
SATab[2].Parent:=panel[2];
SATab[2].Align:=alClient;
SATab[2].Caption:='Scan Log';

SAMemo:=TsMemo.Create(nil);
SAMemo.Parent:=SATab[2];
SAMemo.ScrollBars:=ssBoth;
SAMemo.Align:=alClient;
SAPanel[1]:=TsPanel.Create(nil);
SAPanel[1].Parent:=SATab[2];
SAPanel[1].Align:=alBottom;
SAPanel[1].Height:=32;
SAPanel[1].BevelInner:=bvNone;
SAPanel[1].BevelOuter:=bvNone;
SALabel[5]:=TsLabel.Create(nil);
SALabel[5].Parent:=SAPanel[1];
SALabel[5].Left:=0;
SALabel[5].Top:=10;
SALabel[5].Width:=202;
SALabel[5].Alignment:=taCenter;
SALabel[5].AutoSize:=False;
SALabel[5].Caption:='Total files infected: 0';

SAButton[6]:=TsSpeedButton.Create(nil);
SAButton[6].Parent:=SAPanel[1];
SAButton[6].Cursor:=crHandPoint;
SAButton[6].Left:=207;
SAButton[6].Top:=5;
SAButton[6].Width:=65;
SAButton[6].Height:=22;
SAButton[6].Caption:='Disinfect';
SAButton[6].Enabled:=False;
SAButton[6].OnClick:=TXHandler.ScnDisi;
SAButton[7]:=TsSpeedButton.Create(nil);
SAButton[7].Parent:=SAPanel[1];
SAButton[7].Cursor:=crHandPoint;
SAButton[7].Left:=278;
SAButton[7].Top:=5;
SAButton[7].Width:=65;
SAButton[7].Height:=22;
SAButton[7].Caption:='Close';
SAButton[7].OnClick:=TXHandler.ScnClose;

//CUSTOM SCAN OPTIONS---------------------------


panel[3]:=TsPanel.Create(nil);
panel[3].Parent:=ATab;
panel[3].Align:=alClient;
panel[3].BevelInner:=bvNone;
panel[3].BevelOuter:=bvNone;
SOGBox:=TsGroupBox.Create(nil);
SOGBox.Parent:=panel[3];
SOGBox.Align:=alClient;
SOGBox.Caption:='Custom Scan Options';

SOLabel[0]:=TsLabel.Create(nil);
SOLabel[0].Parent:=SOGBox;
SOLabel[0].Top:=32;
SOLabel[0].Left:=30;
SOLabel[0].Caption:='Schedule';
SORadio[0]:=TsRadioButton.Create(nil);
SORadio[0].Parent:=SOGBox;
SORadio[0].Top:=48;
SORadio[0].Left:=34;
SORadio[0].Caption:='Daily';
SORadio[0].OnClick:=TXHandler.CsoRadClick;
SORadio[1]:=TsRadioButton.Create(nil);
SORadio[1].Parent:=SOGBox;
SORadio[1].Top:=64;
SORadio[1].Left:=40;
SORadio[1].Caption:='Weekly';
SORadio[1].OnClick:=TXHandler.CsoRadClick;
SORadio[2]:=TsRadioButton.Create(nil);
SORadio[2].Parent:=SOGBox;
SORadio[2].Top:=80;
SORadio[2].Left:=48;
SORadio[2].Caption:='Monthly';
SORadio[2].OnClick:=TXHandler.CsoRadClick;
SOLabel[1]:=TsLabel.Create(nil);
SOLabel[1].Parent:=SOGBox;
SOLabel[1].Top:=104;
SOLabel[1].Left:=30;
SOLabel[1].Caption:='Scan day:';
SOCombo[0]:=TsComboBox.Create(nil);
SOCombo[0].Parent:=SOGBox;
SOCombo[0].Left:=30;
SOCombo[0].Top:=120;
SOCombo[0].Width:=83;
SOCombo[0].OnChange:=TXHandler.CBOSChange;
with SOCombo[0].Items do begin
Add('Monday');
Add('Tuesday');
Add('Wednesday');
Add('Thursday');
Add('Friday');
Add('Saturday');
Add('Sunday');
end;
SOImage:=TsImage.Create(nil);
SOImage.Parent:=SOGBox;
SOImage.Left:=196;
SOImage.Top:=26;
SOImage.Width:=121;
SOImage.Height:=121;
try
SOImage.Picture.LoadFromFile('API\Internet
Security\Antivirus\icons\scan_options.png');
except exit; end;
SOLabel[2]:=TsLabel.Create(nil);
SOLabel[2].Parent:=SOGBox;
SOLabel[2].Left:=14;
SOLabel[2].Top:=153;
SOLabel[2].Caption:='______________________________________________________';
SOLabel[3]:=TsLabel.Create(nil);
SOLabel[3].Parent:=SOGBox;
SOLabel[3].Left:=16;
SOLabel[3].Top:=184;
SOLabel[3].Caption:='Scan following extensions (ex.: .exe,.dll or *.*):';
SOEdit[0]:=TsEdit.Create(nil);
SOEdit[0].Parent:=SOGBox;
SOEdit[0].Left:=16;
SOEdit[0].Top:=200;
SOEdit[0].Width:=321;
SOEdit[0].Text:='.exe;.dll;.bat;.com;.vbs;*.vba;.doc;.docx';
SOEdit[0].OnChange:=TXHandler.EDeOSChange;
SOLabel[4]:=TsLabel.Create(nil);
SOLabel[4].Parent:=SOGBox;
SOLabel[4].Left:=16;
SOLabel[4].Top:=224;
SOLabel[4].Caption:='Max file size:';
SOEdit[1]:=TsEdit.Create(nil);
SOEdit[1].Parent:=SOGBox;
SOEdit[1].Left:=16;
SOEdit[1].Top:=240;
SOEdit[1].Width:=33;
SOEdit[1].Text:='100';
SOEdit[1].OnChange:=TXHandler.EDsOSChange;
SOLabel[5]:=TsLabel.Create(nil);
SOLabel[5].Parent:=SOGBox;
SOLabel[5].Left:=52;
SOLabel[5].Top:=243;
SOLabel[5].Caption:='MB';
SOLabel[6]:=TsLabel.Create(nil);
SOLabel[6].Parent:=SOGBox;
SOLabel[6].Left:=97;
SOLabel[6].Top:=224;
SOLabel[6].Caption:='Scan speed:';
SOCombo[1]:=TsComboBox.Create(nil);
SOCombo[1].Parent:=SOGBox;
SOCombo[1].Left:=97;
SOCombo[1].Top:=240;
SOCombo[1].Width:=102;
SOCombo[1].OnChange:=TXHandler.EDcOSChange;
with SOCombo[1].Items do begin
Add('Fastest');
Add('Very Fast');
Add('Fast');
Add('Normal');
Add('Low');
Add('Very Low');
Add('Lowest');
end;
SOCombo[0].IndexOf('Normal');
SOCheck[0]:=TsCheckBox.Create(nil);
SOCheck[0].Parent:=SOGBox;
SOCheck[0].Left:=215;
SOCheck[0].Top:=250;
SOCheck[0].Caption:='Scan HEX signatures';
SOCheck[0].OnClick:=TXHandler.SCNHexClick;
SOCombo[0].IndexOf('Normal');
SOCheck[2]:=TsCheckBox.Create(nil);
SOCheck[2].Parent:=SOGBox;
SOCheck[2].Left:=215;
SOCheck[2].Top:=232;
SOCheck[2].Caption:='Scan BIN signatures';
SOCheck[2].OnClick:=TXHandler.SCNHexClick;
SOCheck[1]:=TsCheckBox.Create(nil);
SOCheck[1].Parent:=SOGBox;
SOCheck[1].Left:=16;
SOCheck[1].Top:=264;
SOCheck[1].Caption:='Automaticlly save scan log';
SOCheck[1].OnClick:=TXHandler.SCNLogClick;
SOLabel[7]:=TsLabel.Create(nil);
SOLabel[7].Parent:=SOGBox;
SOLabel[7].Left:=24;
SOLabel[7].Top:=280;
SOLabel[7].Caption:='Log file:';
SOEdit[2]:=TsEdit.Create(nil);
SOEdit[2].Parent:=SOGBox;
SOEdit[2].Left:=24;
SOEdit[2].Top:=296;
SOEdit[2].Width:=313;
SOEdit[2].Text:='lastscan.log';
SOEdit[2].OnChange:=TXHandler.SALogChange;
{SOLabel: array [0..7] of TsLabel; fsefs
SORadio: array [0..2] of TsRadioButton;
SOCombo: array [0..1] of TsComboBox;
SOEdit: array [0..2] of TsEdit;
SOCheck: array [0..1] of TsCheckBox; }

//LOAD DATABASE
db_:=TStringList.Create;
if fileexists('API\Internet Security\Antivirus\database\definitions.dvir') then
begin
db_.LoadFromFile('API\Internet Security\Antivirus\database\definitions.dvir');
Lov[1].Caption:=Ext(db_.Strings[0],'^',1);
Lov[3].Caption:=Ext(db_.Strings[0],'^',2);
Lov[5].Caption:=IntToStr(db_.Count-1);
end else begin
Lov[1].Caption:='Database error !';
Lov[3].Caption:='Never';
Lov[5].Caption:='0';
end;
//Last antivirus scan
//Lov[9].Caption:=IniRead('Antivirus','Found','0');
Lov[14].Caption:=#10#13+#10#13+'Status: Antivirus has issues !'+#10#13+ //Full AV
Protection
#10#13+'Antivirus: Error !'+
#10#13+'Active Shield: Error !'+
#10#13+'Update: Error !';
LoadSettings;
try
if DaysBetween(today, StrToDate(Lov[7].Caption)) > 7 then begin
avst:='Recent scan > '+IntToStr(DaysBetween(today, StrToDate(Lov[7].Caption)));
end else begin
avst:='Recent scan < 7 days. OK';
end;
except avst:='Recent scan unknown.' end;
acst:='OFF';
upst:='OFF';
avstatus(avst,acst,upst);
Panel[0].BringToFront;
end;
//////////////////////////////////////////////////
exports LoadMAPI;
begin
end.

Das könnte Ihnen auch gefallen