zhangjian950617 发表于 2011-3-31 09:28:43

delphi 中 特征码查找速度慢的问题

现在的函数是在论坛找到的
不过速度很慢 搜半天才出来
范围总是在$00400000-$25000000变动。
这个问题困扰我几天了,实在是没办法,出来问问。
那位高手可以搞个速度快点的函数来用用 万分感谢
function ReadMemory(dwAddress, nSize: DWORD): DWORD;
var
BytesRead: DWORD;
R1: Byte;
R2: WORD;
R4: DWORD;
begin
case nSize of
    1 : begin
          ReadProcessMemory(ProcessID, Pointer(dwAddress), @R1, nSize, BytesRead);
          Result := R1;
      end;
    2 : begin
          ReadProcessMemory(ProcessID, Pointer(dwAddress), @R2, nSize, BytesRead);
          Result := R2;
      end;
    4 : begin
          ReadProcessMemory(ProcessID, Pointer(dwAddress), @R4, nSize, BytesRead);
          Result := R4;
      end;
end;
end;

function ScanAddr: DWORD;
const
StartAddr = $00400000;
StopAddr =$25000000;
var
Addr: DWORD;
begin
Result := 0;
Addr := StartAddr;
if StartAddr <= StopAddr then Exit;
while Addr >= StopAddr do
begin
    if (ReadMemory(Addr    ,1)= $00) and
      (ReadMemory(Addr+1,1)= $40)



      then

    begin
      Result := Addr;
      Break;
    end
    else
      dec(Addr);
end;
end;

gggxxx 发表于 2011-3-31 09:29:05

StartAddr = $00400000;
StopAddr =$25000000;
扫的内存地址太多了
比如你需要的地址是00551144
你可以StartAddr =$00500000;
结束用StopAddr =$00600000;
这样他扫的范围就小了 速度就可以提高了

aiai101 发表于 2011-3-31 09:29:15

一个函数是不可能在这么大的范围内进行转移的,建议减小查找量
页: [1]
查看完整版本: delphi 中 特征码查找速度慢的问题