Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Pointer reading in Delphi

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
boredtc
How do I cheat?
Reputation: 0

Joined: 04 Dec 2010
Posts: 7

PostPosted: Sat Aug 06, 2011 9:04 am    Post subject: Pointer reading in Delphi Reply with quote

Hi all,

I´m working on a new Delphi project in pointer reading.
But my code always returns a zero value as Result.
Maybe i´m missing something...
I´ve tried it on several games.
Any help would be appriciated.

my code;

Code:
var
Form1: TForm1;
BytesRead : Cardinal;
myVar : Cardinal;
EndVar : Cardinal; //it could be anything byte, cardinal etc..
myHandle : Integer;
PID : integer;
Result : Integer;
implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
myHandle := FindWindow(nil, 'GameName');
if myHandle = 0 then
begin
MessageDlg ('The game is not loaded in memory, try again...', mtwarning,[mbOK],0);
end;

PID := GetWindowThreadProcessId(myHandle, @PID);
myHandle := OpenProcess (PROCESS_ALL_ACCESS, False, PID);
If PID <> 0 Then
ReadProcessMemory(myHandle, Ptr($3D7C4C4), @myVar, SizeOf(myVar), BytesRead);
ReadProcessMemory(myHandle, Ptr(myVar + $3B8), @myVar, SizeOf(myVar), BytesRead);
ReadProcessMemory(myHandle, Ptr(myVar + $120), @myVar, SizeOf(myVar), BytesRead);
ReadProcessMemory(myHandle, Ptr(myVar + $7C), @myVar, SizeOf(myVar), BytesRead);
ReadProcessMemory(myHandle, Ptr(myVar + $14), @myVar, SizeOf(myVar), BytesRead);
ReadProcessMemory(myHandle, Ptr(myVar + $268), @myVar, SizeOf(myVar), BytesRead);
ReadProcessMemory(myHandle, Ptr(myVar), @EndVar, SizeOf(EndVar), BytesRead);
Result := EndVar;

end;

end.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

Joined: 09 May 2003
Posts: 25857
Location: The netherlands

PostPosted: Sat Aug 06, 2011 9:35 am    Post subject: Reply with quote

check if the handle is 0 or not

also, are you sure that the last offset is 0?

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
boredtc
How do I cheat?
Reputation: 0

Joined: 04 Dec 2010
Posts: 7

PostPosted: Sun Aug 07, 2011 5:06 am    Post subject: Reply with quote

Hey,

Thanx for the reply.
Strangely I got it to work by removing the last ReadProcessMemory + offset and adding the final offstet manually.

Verry weird as the actions are identical
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites