H
HHYWorld
Unregistered / Unconfirmed
GUEST, unregistred user!
问题:以下两句中的$A35DB4这个基地址是如何得来的,是用Softice还是ollydbg呢?请详细解答。
edit4.Text:= inttostr( DuMem( xpid, DuMem( xpid ,$A35DB4 ) + $24C ) );
XXMem( xpid, DuMem( xpid ,$A35DB4 ) + $24C , strtoint(edit2.Text ) );
上述问题请参照我提出的《请教如何编写游戏修改器(动态分配内存地址)》这个问题进行解答。源程序如下(红色警戒2金钱修改器):
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Label1: TLabel;
Timer1: TTimer;
Label2: TLabel;
Edit2: TEdit;
Button1: TButton;
Button2: TButton;
Label3: TLabel;
Edit4: TEdit;
procedure Timer1Timer(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
Function DuMem(pidWORD;Addres: Cardinal): Cardinal;
var PHND:THandle; bReadSucceed :BOOL; BytesReadWORD;
begin
if pid <> 0 then
begin
PHND := OpenProcess(PROCESS_VM_READ, False,pid);
if PHND <> 0 then
begin
bReadSucceed :=ReadProcessMemory(PHND, Pointer(Addres), @Result, 4, BytesRead);
if bReadSucceed = False then Result := 0 ;
end;
CloseHandle(PHND);
end else
Result := 0;
end;
Function XXMem(pidWORD;Addres: Cardinal;zhi:dword): Cardinal;
var PHND:THandle; bReadSucceed :BOOL; BytesReadWORD;
begin
if pid <> 0 then
begin
PHND := OpenProcess(PROCESS_ALL_ACCESS, False,pid);
if PHND <> 0 then
begin
bReadSucceed :=WriteProcessMemory(PHND, Pointer(Addres), @zhi, 4, BytesRead);
if bReadSucceed = False then Result := 0 ;
end;
CloseHandle(PHND);
end else
Result := 0;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var
hRedAlert2 : THandle; xpid:dword;
begin
hRedAlert2 := FindWindow('Red Alert 2', 'Red Alert 2');
if hRedAlert2<> 0 then
begin
GetWindowThreadProcessId(hRedAlert2,xpid);
edit1.Text:= inttostr( xpid );
edit4.Text:= inttostr( DuMem( xpid, DuMem( xpid ,$A35DB4 ) + $24C ) );
XXMem( xpid, DuMem( xpid ,$A35DB4 ) + $24C , strtoint(edit2.Text ) );
end else
begin
edit1.Text:='无';
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
halt;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
showmessage('程序设计:又欠'#13#10+'程序测试:安康')
end;
end.
edit4.Text:= inttostr( DuMem( xpid, DuMem( xpid ,$A35DB4 ) + $24C ) );
XXMem( xpid, DuMem( xpid ,$A35DB4 ) + $24C , strtoint(edit2.Text ) );
上述问题请参照我提出的《请教如何编写游戏修改器(动态分配内存地址)》这个问题进行解答。源程序如下(红色警戒2金钱修改器):
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Label1: TLabel;
Timer1: TTimer;
Label2: TLabel;
Edit2: TEdit;
Button1: TButton;
Button2: TButton;
Label3: TLabel;
Edit4: TEdit;
procedure Timer1Timer(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
Function DuMem(pidWORD;Addres: Cardinal): Cardinal;
var PHND:THandle; bReadSucceed :BOOL; BytesReadWORD;
begin
if pid <> 0 then
begin
PHND := OpenProcess(PROCESS_VM_READ, False,pid);
if PHND <> 0 then
begin
bReadSucceed :=ReadProcessMemory(PHND, Pointer(Addres), @Result, 4, BytesRead);
if bReadSucceed = False then Result := 0 ;
end;
CloseHandle(PHND);
end else
Result := 0;
end;
Function XXMem(pidWORD;Addres: Cardinal;zhi:dword): Cardinal;
var PHND:THandle; bReadSucceed :BOOL; BytesReadWORD;
begin
if pid <> 0 then
begin
PHND := OpenProcess(PROCESS_ALL_ACCESS, False,pid);
if PHND <> 0 then
begin
bReadSucceed :=WriteProcessMemory(PHND, Pointer(Addres), @zhi, 4, BytesRead);
if bReadSucceed = False then Result := 0 ;
end;
CloseHandle(PHND);
end else
Result := 0;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var
hRedAlert2 : THandle; xpid:dword;
begin
hRedAlert2 := FindWindow('Red Alert 2', 'Red Alert 2');
if hRedAlert2<> 0 then
begin
GetWindowThreadProcessId(hRedAlert2,xpid);
edit1.Text:= inttostr( xpid );
edit4.Text:= inttostr( DuMem( xpid, DuMem( xpid ,$A35DB4 ) + $24C ) );
XXMem( xpid, DuMem( xpid ,$A35DB4 ) + $24C , strtoint(edit2.Text ) );
end else
begin
edit1.Text:='无';
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
halt;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
showmessage('程序设计:又欠'#13#10+'程序测试:安康')
end;
end.