delphi XE2读取内存偏移数据代码  
官方Delphi 学习QQ群: 682628230(三千人)
频道

delphi XE2读取内存偏移数据代码


刚学习的时候直接读取基值是很简单的,但是类型[[[00a41ff0+1c]+34]+490]这样的偏移数值应该如何读取呢?下面给大家分享下Delphi 的代码:

复制代码
var
  GameH:HWND;             {定义窗口句柄}
  GamePid:DWORD;          {定义窗口进程ID}
  ReadByte:SIZE_T;        {实际读取字节}
  Gamehprocess: THandle;  {就是非负数的整数类型  定义进程句柄}
  HP:DWORD;
  Text:DWORD;             {看下面代码你就知道为什么要定义它了}
  //完美血值基值 [[[00a41ff0+1c]+34]+490]
begin
  GameH:=FindWindow(nil,'完美世界国际版');   //取窗口句柄
  GetWindowThreadProcessId(GameH,GamePid);   //获取进程ID
  Gamehprocess:=OpenProcess(PROCESS_All_Access,False,GamePid);  //获取进程句柄
  ReadProcessMemory(Gamehprocess,Pointer($00a41ff0),@Text,4,ReadByte);  //读取00a41ff0内存的值
  ReadProcessMemory(Gamehprocess,Pointer(Text+$1c),@Text,4,ReadByte);   //读取00a41ff0+1C的值
  ReadProcessMemory(Gamehprocess,Pointer(Text+$34),@Text,4,ReadByte);   //读取00a41ff0+1C+34的值
  ReadProcessMemory(Gamehprocess,Pointer(Text+$490),@HP,4,ReadByte);    //读取00a41ff0+1C+34+490的值
  lbl2.Caption:=inttostr(Hp); //显示血值
end;

https://www.cnblogs.com/ahroot/archive/2011/10/31/2230609.html

推荐分享
图文皆来源于网络,内容仅做公益性分享,版权归原作者所有,如有侵权请告知删除!
 

Copyright © 2014 DelphiW.com 开发 源码 文档 技巧 All Rights Reserved
晋ICP备14006235号-8 晋公网安备 14108102000087号

执行时间: 0.041092872619629 seconds