16,749
社区成员
发帖
与我相关
我的任务
分享
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Edit1: TEdit;
Edit2: TEdit;
CheckBox1: TCheckBox;
CheckBox2: TCheckBox;
Button1: TButton;
Timer1: TTimer;
CheckBox3: TCheckBox;
Label4: TLabel;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses Unit2;
{$R *.DFM}
{$R windowsxp.RES}
procedure TForm1.Button1Click(Sender: TObject);
begin
Application.Terminate;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var
roadrashhandle:THandle;//游戏句柄
pid: dword;//游戏进程ID
curmoney:integer;//取出的金钱数目
newmoney:integer;//要改成的金钱数目
h: THandle;//进程的句柄
lpNumberOfBytesRead:DWord;//读取了多少字节
lpNumberOfBytesWrite:DWord;//写了多少字节
jiashu:integer;
//血的地址没有找准,只能放弃了
//blood:integer;
begin
roadrashHandle:=FindWindow('RashRoot','Road Rash');
if roadrashHandle=0
then
begin
Label2.caption:='游戏未运行';
Label2.Font.Color:=clRed;
end
else
begin
Label2.caption:='游戏已运行';
Label2.Font.Color:=clGreen;
GetWindowThreadProcessId(roadrashHandle, @pid);
h := OpenProcess(PROCESS_ALL_ACCESS, false, pid);
if h = 0 then Exit;
ReadProcessMemory(h,ptr($4B8A18),@curmoney,4,lpNumberOfBytesRead);
Edit2.Text:=inttostr(curmoney);
newmoney:=strtoint(edit1.text);
if CHeckBox1.Checked then
begin
//游戏中金钱的地址为$4B8A18
WriteProcessMemory(h,ptr($4B8A18),@newmoney,4,lpNumberOfBytesWrite);
end;
jiashu:=10;
if CHeckBox2.Checked then
begin
//游戏中加速的地址为$465A34
WriteProcessMemory(h,ptr($465A34),@jiashu,4,lpNumberOfBytesWrite);
end;
//以下本来是想锁定血,可是好象未能找到地址
{ blood:=$1F1F0A00;
if CHeckBox3.Checked then
begin
WriteProcessMemory(h,ptr($49E115),@blood,4,lpNumberOfBytesWrite);
end;
}
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
self.hide;
form2:=TForm2.Create(self);
try
Form2.ShowModal;
finally
Form2.Free;
Form2:=nil;
end;
self.visible:=true;
end;
end.
上面是我的一个例子,完整代码在:
http://download.csdn.net/detail/liups/2070375
下载
方法是使用CE工具查到地址(可能要查几次,所以楼主的问题是CE使用的问题),不需要多级指针。