 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
R3B0RN How do I cheat?
Reputation: 0
Joined: 22 Mar 2011 Posts: 2 Location: Hungary
|
Posted: Tue Mar 22, 2011 9:20 am Post subject: Reading memory: Float |
|
|
Hey,
Currently I am trying to read memory from Call of Duty 4, but it is a float. With the fllowing code, i can get any integer's value:
| Code: | procedure Tform7.Button1Click(Sender: TObject);
var
hProcess,HandleWindow: THandle;
Struct: TProcessEntry32;
ProcessID,temp:cardinal;
buf:pchar;
Address: Integer;
begin
Address := $0CBAB8BC;
HandleWindow := FindWindow(nil, 'Call of Duty 4');
if HandleWindow <> 0 then
begin
GetWindowThreadProcessId(HandleWindow, @ProcessID);
hProcess := OpenProcess(PROCESS_ALL_ACCESS, FALSE, ProcessID);
getmem(buf, SizeOf(Address));
readprocessmemory(hProcess, ptr(Address), buf, SizeOf(Address), temp);
Label7.Caption := inttostr(Ord(string(buf)[1]));
freemem(buf);
if hProcess <> 0 then
CloseHandle(hProcess);
end
else
showmessage('So bad.. Call of Duty 4 is not running =(');
end; |
Maybe it is not the best solution for doing it, but it works. Sadly not with Floats =/
Any help and suggestion appreciated (:
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25834 Location: The netherlands
|
Posted: Tue Mar 22, 2011 10:18 am Post subject: |
|
|
change the type of buf from pchar to single
remove the getmem and freemem lines
change
| Code: |
readprocessmemory(hProcess, ptr(Address), buf, SizeOf(Address), temp);
|
to
| Code: |
readprocessmemory(hProcess, ptr(Address), @buf, SizeOf(buf), temp);
|
and change
| Code: |
Label7.Caption := inttostr(Ord(string(buf)[1]));
|
to
| Code: |
Label7.Caption := floattostr(buf);
|
_________________
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 |
|
 |
R3B0RN How do I cheat?
Reputation: 0
Joined: 22 Mar 2011 Posts: 2 Location: Hungary
|
Posted: Tue Mar 22, 2011 10:43 am Post subject: |
|
|
| Thanks mate, worked fine (:
|
|
| 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
|
|