The problem is, I want to get away from API calls because a few games I play like to hook the API calls I use, occasionally crashing my app. I'm new to Madshi's code, so I'm still learning how to do process reads. For my tests, I am looking for the word "test" displayed in my app, at $4010C8, so I made a read buffer of 4 bytes, read 4 bytes, and get the wrong answer every time.
So my problem:
Code: Select all
var
Gamehandle : IHandle;
MyProcess : IProcess;
PID, Address, Dest, Dcount : Integer;
apppath : string;
databuff : pointer;
begin
gamehandle:=process('TestApp.exe').GetHandle(PROCESS_ALL_ACCESS); <-- Get Handle OK
myprocess:=process(gamehandle); <-- Set it into an IProcess
apppath:=process('TestApp.exe').exefile; <--- Get App Path, make sure I access the right process OK
label1.Caption:=apppath;
pid:=myprocess.ID; <---Get Process ID, make sure I'm reading right process OK
label2.Caption:=inttohex(pid,8);
databuff:=myprocess.AllocMem(4);
dest:=$4010C8; <-- Location in my app I want to check
dcount:=4; <-- Buffer to Read 4 Bytes (Integer)
myprocess.ReadMemory(dest,address,dcount); <<Returns 00000000 instead of $74736574 ('test')
label3.Caption:=inttohex(address,8);
myprocess.FreeMem(databuff);
end;