MatchesMask Is using when you want to compare between FileNames :
Like This :
const s = 'http://www.delphisources.ru';
MatchesMask(s,'h?p://*') == FALSE
MatchesMask(s,'h??p://*') == TRUE
MatchesMask(s,'http://*') == TRUE
MatchesMask(s,'http://*.ru') == TRUE
MatchesMask(s,'http://*.net') == FALSE
But what i'm doing is Looking in Strings not Files .
That's why i used the FastPos from the FastStrings .
I will show you here :
if (FastPos( s,
lVirus^.Signature,
sLen,
lVirus^.SigLen, 1) > 0) then
result := gSignatures.IndexOf(lVirus);
S: is the Buffer i'm searching In .
lVirus^.Signature : is the Pattern i'm using ( Virus Signature )
sLen : the Buffer Length i'm searching in this will narrow the Pattern and fasten the scanning.
lVirus^.SigLen: the Virus Signature Length , why i use it because if we find a Virus with a 255 Signature then don't use this Length for all othere Viruses , but Use an othere Signature Length .
1: Is the Default Start Point in FastPos in FastStrings otherwise you will get nothing .
Many thanks .
|