delphi中readprocessMemory 读取出来的值总为0

[复制链接]
查看11 | 回复1 | 2010-10-13 13:59:11 | 显示全部楼层 |阅读模式
var
Gameh:hwnd;
//游戏窗口句柄
Gamepid:thandle;//游戏进程ID
Gameprocess:Thandle; //进程句柄
const
Gamecaption='Element Client';
Gamewodcalssname='QElementClient Window';
GameBaes=$a8ff08;
implementation
functionyxjz:integer;
//游戏基址
var
ptmp:integer;
byte:Dword;
begin

result:=0;

gameh:=findwindow(nil,gamecaption);

if gameh=0 then exit;

GetwindowThreadProcessID(gameh,gamepid);

gameprocess:=openProcess(windows.PROCESS_ALL_ACCESS,false,gamepid);

readprocessMemory(gameprocess,pointer(gamebaes+$1c),@ptmp,4,Byte);

readprocessMemory(gameprocess,pointer(gamebaes+$24),@ptmp,4,Byte);

result:=ptmp;
end;
function yxxz:integer;
//人物血值
var
base:integer;
ptmp:integer;
byte:Dword;
begin
result:=0;

base := yxjz;

Gameh:=findwindow(nil,GameCaption);

if gameh=0 then exit;
GetwindowThreadProcessID(gameh,gamepid);
gameprocess:=openProcess(windows.PROCESS_ALL_ACCESS,false,gamepid);
readprocessMemory(gameprocess,pointer(base+$260),@ptmp,4,Byte);
result:=ptmp;
end;
请高手,帮我看看,哪里出了问题,是否是权限问题,如果是的话,要怎么样改写代码才可以解决.

回复

使用道具 举报

千问 | 2010-10-13 13:59:11 | 显示全部楼层
varGameh:hwnd;
//游戏窗口句柄Gamepid:thandle;//游戏进程IDGameprocess:Thandle; //进程句柄constGamecaption='Element Client';Gamewodcalssname='QElementClient Window';GameBaes=$a8ff08;implementationfunctionyxjz:integer;
//游戏基址varptmp:integer;byte:Dword;begin
result:=0;
gameh
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行