 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
blqxxxxxxx Cheater
Reputation: 0
Joined: 25 Aug 2009 Posts: 37
|
Posted: Thu Apr 01, 2010 11:16 am Post subject: Readprocessmemory? |
|
|
I want to read one address but it shows me a wrong value.
I use this | Code: | var
hProcess,HandleWindow: THandle;
Struct: TProcessEntry32;
ProcessID,temp:cardinal;
buf:pchar;
begin
HandleWindow :=FindWindow(nil,'The window title ;)');
GetWindowThreadProcessId(HandleWindow,@ProcessID);
hProcess := OpenProcess(PROCESS_ALL_ACCESS,FALSE,ProcessID);
getmem(buf,4);
readprocessmemory(hProcess,ptr($00A56AA8),buf,4,temp);
showmessage(string(buf));
freemem(buf);
if hProcess <> 0 then
CloseHandle(hProcess);
end; |
and use this | Code: | | showmessage(inttostr(integer(buf))); | to show me a real value. The message shows wrong value Can someone help me?
Kind regards Megaz0r
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 475
Joined: 09 May 2003 Posts: 25974 Location: The netherlands
|
Posted: Thu Apr 01, 2010 2:38 pm Post subject: |
|
|
buf is a pointer to a block of 4 bytes, so try dereferencing it first:
showmessage(inttostr(integer(buf^)));
alternatively:
| Code: |
var
myinteger: integer;
...
readprocessmemory(hProcess,ptr($00A56AA8),@myinteger,4,temp);
showmessage(inttostr(myinteger));
|
_________________
Tools give you results. Knowledge gives you control.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
iPromise Grandmaster Cheater
Reputation: -1
Joined: 27 Jun 2009 Posts: 529 Location: Canada
|
Posted: Thu Apr 01, 2010 5:02 pm Post subject: |
|
|
Problem HERE:
| Code: |
hProcess,HandleWindow: THandle;
|
Change that to:
| Code: |
hProcess : THandle;
HandleWindow : HWND;
|
Another one:
| Code: | readprocessmemory(hProcess,ptr($00A56AA8),buf,4,temp);
|
To:
| Code: | | readprocessmemory(hProcess,ptr($00A56AA8),[b]@[/b]buf, 4,temp); |
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 475
Joined: 09 May 2003 Posts: 25974 Location: The netherlands
|
Posted: Thu Apr 01, 2010 7:55 pm Post subject: |
|
|
| Code: |
hProcess,HandleWindow: THandle;
|
is ok, HWND is just another name for System.THandle
| Code: |
readprocessmemory(hProcess,ptr($00A56AA8),@buf, 4,temp);
|
that is bad, and you should never do that
Using pchar to allocate a 4 byte block and then store 4 bytes in that block isn't useful, but overwriting the pointer with data is worse
freemem(buf); will then cause massive damage
_________________
Tools give you results. Knowledge gives you control.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
blqxxxxxxx Cheater
Reputation: 0
Joined: 25 Aug 2009 Posts: 37
|
Posted: Fri Apr 02, 2010 2:53 am Post subject: |
|
|
10q DarkByte and iPromise. NOW IT WORKS
|
|
| Back to top |
|
 |
|
|
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
|
|