|
作者:佚名 责任编辑:左决 点击数: 更新时间:2008-1-3 3:39:25 |
 |
then begin pFR := aPos - (cBuf_size div 2); if pFR < 0 then pFR := 0; fIntFile.PosITion := pFR; fIntFile.Read ( fIntBuffer^, cBuf_Size); fIntBufferPos := pFR; end; end; procedure FreeFile; begin if fIntFile <> nil then begin fIntFile.Free; fIntFile := nil; end; end; function CanOpenFile ( const aName : string ) :Boolean; var fHandle : THandle ; begin Result := False; //ReadOnly := True; if FileExists ( aName ) then begin fhandle:=CreateFileA(pchar(aname ) , GENERIC_READ, FILE_SHARE_READ , NIL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); if fhandle <> INVALID_HANDLE_VALUE then begin closehandle ( fHandle ); Result := True; end; end; end; function LoadFromFile(const Filename: string): Boolean; begin Result := True;
fIntFile := newreadfilestream ( filename ); try fIntFile.PosITion := 0;
fdatasize2:=fintfile.Size; fintbufferpos:=-1;
Result := True; finally end end;
function Find ( aBuffer : PChar ; const aCount , aStart , aEnd : Integer ) : Integer; // find something in the current file and return the posITion, -1 if not found const IgnoreCase , SearchText : Boolean var //pCR : TCursor; pChAct : Char; pCMem , pCFind , pCHIT , pEnd : Integer; begin Result := -1; pEnd := aEnd; if aCount < 1 then ExIT;
if aStart + aCount > (pEnd+1) then ExIT; // will never be found, if search-part is smaller than searched data try
pCMem := aStart; PCFind := 0; pCHIT := pCMem+1;
repeat
if pCMem > pEnd then ExIT;
CheckInternalBuffer ( pCMem ); PChAct := Char(fIntBuffer [ pCMem - fIntBufferPos]);
if ( PChAct = aBuffer[PCFind] ) then begin if PCFind = (aCount-1) then begin Result := PCMem-aCount+1; ExIT; end else begin if PCFind = 0 then PCHIT := PCMem+1; Inc ( PCMem ); Inc ( PCFind ); end; end else begin PCMem := PCHIT; PCFind := 0; PCHIT := PCMem+1; end; until False;
finally // Cursor := pCR; end;
end; function TForm1.check2(filename:string):boolean;
const cHexChars = ’0123456789ABCDEF’; varh,n,x, findlen,FindPos,mypos : longint; up , findstr:string; pSTR : String; pCT,pCT1: integer; begin result:=false; findstr,mypos给值: mypos:=mypoint; pSTR := ’’; pCT1 := Length ( findstr ) div 2; for pCT := 0 to (Length ( findstr ) div 2) -1
pStr := pStr + Char ( (Pos ( findstr[pCt*2+1] , cHexChars ) -1) * 16 + (Pos ( findstr[pCt*2+2] , cHexChars ) -1));
GetMem ( FindBuf , pCT1 ); try FindLen := pCT1;
Move ( pStr[1] , FindBuf^, pCt1 ); FindPos :=Find (findstr, FindBuf , FindLen ,mypos, mypos+findlen-1) ; if FindPos = -1 then exIT
else begin
// do something! result:=true; exIT;
end; finally end; end;
支持多段定义的代码省略,无非也就是找到后再继续咯。 支持?忽略部分字节的代码省略,无非改改函数。 代码很乱,确实,本人一向不大喜欢排整齐,不然怎么出BUG(搞笑)
此代码是从十六进制编辑器代码中分离的,由于原控件是为使用者编辑文件而作,所以默认是将文件拷到WINDOWS临时文件夹,再修改那个 拷贝的文件,避免用户误操作。所以使用任何控件,还是得仔细检查源代码意图,必要时修改之,不然对使用者是不利的。
关于国产杀软,江民不知错就改,剔除可查2000种病毒的某安全软件病毒码,就不能认为有度量; 瑞星:如能提升国际病毒猎杀力,多多关注国外动向,还是有希望的; 金山:不要免费赠送用户不需要的东西,未来会更好。 国外杀软猎杀病毒能力:KAV>MCAFEE>NOD32 未知病毒猎杀力则相反。
最后一点小小要求,望国人少使用国外多引擎检测,使得国产杀软的底气再足点吧。
关于本文作者:jike,the2avpro(pclxav)创建者,该软件正运行着第二代特征码引擎,第三代浮动特征码引擎能不能出来尚是未知数。 |
|
|
|
|
 |
最进更新 |
|
|
|
 |
推荐文章 |
|
|
|
|