線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:1688
推到 Plurk!
推到 Facebook!

ReadProcessMemory當數值過大實無法正常讀取

缺席
lirick2003
一般會員


發表:17
回覆:16
積分:11
註冊:2007-02-23

發送簡訊給我
#1 引用回覆 回覆 發表時間:2008-09-27 10:54:25 IP:123.204.xxx.xxx 訂閱
=============================================================
今日我使用ReadProcessMemory去讀取一些位址的記憶體~
當數值小時...還可以正常讀取...可是一但數值過大...則無法正確讀許記憶體?
請教一下?我是聽說因為我的source只配置1byte...所以最大值只有255
=============================================================
[code delphi]
procedure TMainForm.NimoTimer(Sender: TObject);
var
AProcessID: DWORD;
WHP:DWord;
WMaxHP:DWord;
WMP:DWord;
WMaxMP:DWord;
WEXP:DWord;
WMaxExP:DWord;
WRed:DWord;
Hpbyte:Byte;
MaxHpbyte:Byte;
Mpbyte:Byte;
MaxMpbyte:Byte;
Expbyte:Byte;
MaxExpbyte:Byte;
Redbyte:Byte;
NimoHandle,NimoWinHWN:THandle;
Por: integer;
begin
NimoWinHwn:=FindWindowA(nil,'You can''t see me~');
GetWindowThreadProcessId(NimoWinHwn, @AProcessID);//取得記憶體進程id
NimoHandle:=openprocess(PROCESS_VM_READ,false,AProcessID);//要求打開拜訪行程
if NimoHandle > 0 then begin
msload.Caption:='載入成功';
ReadProcessMemory(NimoHandle,Pointer($00100000),@HpByte,1,WHP);
ReadProcessMemory(NimoHandle,Pointer($00100004),@MaxHpByte,1,WMaxHp);
ReadProcessMemory(NimoHandle,Pointer($00100008),@MpByte,1,WMP);
ReadProcessMemory(NimoHandle,Pointer($0010000c),@MaxMpByte,1,WMaxMp);
ReadProcessMemory(NimoHandle,Pointer($00100010),@ExpByte,1,WExp);
ReadProcessMemory(NimoHandle,Pointer($00100014),@MaxExpByte,1,WMaxExp);
ReadProcessMemory(NimoHandle,Pointer($00100018),@RedByte,1,WRed);
HPLabel.Caption:='生命值: ' InttoStr(HpByte) ' / ' InttoStr(maxHpByte);
MPLabel.Caption:='魔力值: ' InttoStr(MpByte) ' / ' InttoStr(maxMpByte);
ExPLabel.Caption:='經驗值: ' InttoStr(ExpByte) ' / ' InttoStr(maxExpByte);
RedLabel.Caption:='地圖紅點: ' InttoStr(RedByte);
end;
[/code]
lirick2003
一般會員


發表:17
回覆:16
積分:11
註冊:2007-02-23

發送簡訊給我
#2 引用回覆 回覆 發表時間:2008-09-28 15:34:20 IP:123.204.xxx.xxx 訂閱
=======================================================================================
問題解決了~原來是我宣告錯了

[code delphi]
procedure TMainForm.NimoTimer(Sender: TObject);
var
AProcessID: DWORD;
WHP: DWord;
WMaxHP: DWord;
WMP: DWord;
WMaxMP: DWord;
WEXP: DWord;
WMaxExP: DWord;
WRed: DWord;
NTag: DWord;
NimoHandle,NimoWinHWN: THandle;
Por: integer;
begin
NimoWinHwn:=FindWindowA(nil,'123456');
GetWindowThreadProcessId(NimoWinHwn, @AProcessID);//取得記憶體進程id
NimoHandle:=openprocess(PROCESS_VM_READ,false,AProcessID);//要求打開拜訪行程
if NimoHandle > 0 then begin
msload.Caption:='載入成功';
ReadProcessMemory(NimoHandle,Pointer($00100000),@WHP,4,NTag);
ReadProcessMemory(NimoHandle,Pointer($00100004),@WMaxHP,4,NTag);
ReadProcessMemory(NimoHandle,Pointer($00100008),@WMP,4,NTag);
ReadProcessMemory(NimoHandle,Pointer($0010000c),@WMaxMP,4,NTag);
ReadProcessMemory(NimoHandle,Pointer($00100010),@WEXP,4,NTag);
ReadProcessMemory(NimoHandle,Pointer($00100014),@WMaxEXP,4,NTag);
ReadProcessMemory(NimoHandle,Pointer($00100018),@WRed,4,NTag);
HPLabel.Caption:='生命值: ' InttoStr(WHP) ' / ' InttoStr(WMaxHP);
MPLabel.Caption:='魔力值: ' InttoStr(WMP) ' / ' InttoStr(WMaxMP);
ExPLabel.Caption:='經驗值: ' InttoStr(WEXP) ' / ' InttoStr(WMaxEXP);
RedLabel.Caption:='地圖紅點: ' InttoStr(WRed);
end;
end;
[/code]
系統時間:2024-05-05 7:06:48
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!