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 


[Delphi] ReadProcessMemory help.

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
*CandyShop*
Grandmaster Cheater
Reputation: 0

Joined: 03 Apr 2007
Posts: 865
Location: Israel

PostPosted: Mon Dec 17, 2007 7:49 am    Post subject: [Delphi] ReadProcessMemory help. Reply with quote

I read about it on MSDN but I don't get how its working.
Can anyone give an example how do I read the address's value and then print it (ShowMessage..)?

THANKS! Very Happy
Back to top
View user's profile Send private message
HolyBlah
Master Cheater
Reputation: 2

Joined: 24 Aug 2007
Posts: 446

PostPosted: Mon Dec 17, 2007 10:17 am    Post subject: Reply with quote

Code:
var
  hProcess,HandleWindow: THandle;
  Struct: TProcessEntry32;
  ProcessID,temp:cardinal;
  buf:pchar;
begin
  HandleWindow :=FindWindow(nil,'Untitled - Notepad');
  GetWindowThreadProcessId(HandleWindow,@ProcessID);
  hProcess := OpenProcess(PROCESS_ALL_ACCESS,FALSE,ProcessID);
  getmem(buf,4);
  readprocessmemory(hProcess,ptr($00830022),buf,4,temp);
  showmessage(string(buf));
  freemem(buf);
  if hProcess <> 0 then
    CloseHandle(hProcess);
end;
Back to top
View user's profile Send private message
*CandyShop*
Grandmaster Cheater
Reputation: 0

Joined: 03 Apr 2007
Posts: 865
Location: Israel

PostPosted: Mon Dec 17, 2007 11:19 am    Post subject: Reply with quote

HolyBlah wrote:
Code:
var
  hProcess,HandleWindow: THandle;
  Struct: TProcessEntry32;
  ProcessID,temp:cardinal;
  buf:pchar;
begin
  HandleWindow :=FindWindow(nil,'Untitled - Notepad');
  GetWindowThreadProcessId(HandleWindow,@ProcessID);
  hProcess := OpenProcess(PROCESS_ALL_ACCESS,FALSE,ProcessID);
  getmem(buf,4);
  readprocessmemory(hProcess,ptr($00830022),buf,4,temp);
  showmessage(string(buf));
  freemem(buf);
  if hProcess <> 0 then
    CloseHandle(hProcess);
end;

Not working.
I think that the reading is working but when you did showmessage it show this message:

Is that a value Shocked
nvm.
My friend figure it out. (<33 mOnSoOn)
Back to top
View user's profile Send private message
HolyBlah
Master Cheater
Reputation: 2

Joined: 24 Aug 2007
Posts: 446

PostPosted: Tue Dec 18, 2007 6:40 am    Post subject: Reply with quote

*CandyShop* wrote:

Not working.
I think that the reading is working but when you did showmessage it show this message:

Is that a value Shocked
nvm.
My friend figure it out. (<33 mOnSoOn)

Try use this code:
Code:

showmessage(inttostr(integer(buf)));
Back to top
View user's profile Send private message
Noz3001
I'm a spammer
Reputation: 26

Joined: 29 May 2006
Posts: 6220
Location: /dev/null

PostPosted: Tue Dec 18, 2007 7:42 am    Post subject: Reply with quote

HolyBlah wrote:
Code:
var
  hProcess,HandleWindow: THandle;
  Struct: TProcessEntry32;
  ProcessID,temp:cardinal;
  buf:pchar;
begin
  HandleWindow :=FindWindow(nil,'Untitled - Notepad');
  GetWindowThreadProcessId(HandleWindow,@ProcessID);
  hProcess := OpenProcess(PROCESS_ALL_ACCESS,FALSE,ProcessID);
  getmem(buf,4);
  readprocessmemory(hProcess,ptr($00830022),buf,4,temp);
  showmessage(string(buf));
  freemem(buf);
  if hProcess <> 0 then
    CloseHandle(hProcess);
end;


Use the class, not the window title...
Back to top
View user's profile Send private message MSN Messenger
Reak
I post too much
Reputation: 0

Joined: 15 May 2007
Posts: 3496

PostPosted: Tue Dec 18, 2007 8:02 am    Post subject: Reply with quote

Which is 'notepad' btw.
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