- 注册时间
- 2011-3-6
- 最后登录
- 1970-1-1
该用户从未签到
|
var
Form1: TForm1;
Gameh:hwnd; //游戏窗口句柄
GamePid:Thandle; //进程ID
GamehProcess:Thandle; //进程句柄
const //常量
GameCaption= '诛仙2';
GameBase=$00b269bc;
implementation
{$R *.dfm}
function GetRoleBase:integer;
var
ptmp:integer;
readByte:Dword;
begin
result:=0;
Gameh:=FindWindow(nil,GameCaption);
GetWindowThreadProcessID(Gameh,GamePid);
GamehProcess:=OpenProcess(windows.PROCESS_ALL_ACCESS,false,GamePid);
ReadProcessMemory(Gamehprocess,Pointer(GameBase+$1c),@ptmp,4,readByte);
ReadProcessMemory(Gamehprocess,Pointer(ptmp+$28),@ptmp,4,readByte);
result:=ptmp;
end;
function GetCurBlood:integer;
var
Base:integer;
ptmp:integer;
readByte:Dword;
begin
Base:=GetRoleBase;
ReadProcessMemory(Gamehprocess,Pointer(Base+$270),@ptmp,4,readByte);
result:=ptmp;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
self.Label3.Caption:=intTostr(GetCurBlood);
end;
end.
运行程序,竟然Label3直接读出数值,游戏都还没开
这段代码是照着郁金香D教程写的,不知道看视频的时候是不是漏了什么。 |
|