delphi中多级指针与偏移,应该怎么写程序?

xyzivan 2016-11-04 10:35:11
procedure TForm1.Button1Click(Sender: TObject);
var
x,y,z:string;
h:hwnd;
id,cunfang,shiji:dword;
jb:thandle;
begin
myini:=Tinifile.Create('d:\yzautomation_read.ini');
h:=findwindow('TSMCNCFrame',nil);
getwindowthreadprocessid(h,id);//
jb:=openprocess(process_vm_read, false,id);
readprocessmemory(jb,pointer($7F6ADB14),@cunfang,4,shiji);
label4.Caption:=floattostr(strtoint(inttostr(integer(cunfang)))/1000); //从存放的地址取出来并显示
end;

end.

readprocessmemory(jb,pointer($7F6ADB14),@cunfang,4,shiji);
麻烦详细讲解一下这句的意思,@代表的是什么?
如果是多级指针与偏移,应该要怎么写呢?

如下图

...全文
323 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
xyzivan 2016-11-08
  • 打赏
  • 举报
回复
先结贴,实际上我要找的是一个CNC加工程序,里面的数据都去用从DLL文件里读出来的,一直没找到,先放这里后面再弄,头疼
xyzivan 2016-11-06
  • 打赏
  • 举报
回复
而且不用指针的话关机再开就没有了
xyzivan 2016-11-06
  • 打赏
  • 举报
回复
我是要用delphi编程的啊
liups 2016-11-06
  • 打赏
  • 举报
回复
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使用的问题),不需要多级指针。
liups 2016-11-05
  • 打赏
  • 举报
回复
cheat engine多找几次找能获得最终地址了,不需要什么多级指针
tcmakebest 2016-11-05
  • 打赏
  • 举报
回复
@符号是取得那个变量的地址. 多级指针没用过.

16,749

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 语言基础/算法/系统设计
社区管理员
  • 语言基础/算法/系统设计社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧