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 


Reading memory: Float

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

Joined: 22 Mar 2011
Posts: 2
Location: Hungary

PostPosted: Tue Mar 22, 2011 9:20 am    Post subject: Reading memory: Float Reply with quote

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
View user's profile Send private message Send e-mail MSN Messenger
Dark Byte
Site Admin
Reputation: 471

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

PostPosted: Tue Mar 22, 2011 10:18 am    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
R3B0RN
How do I cheat?
Reputation: 0

Joined: 22 Mar 2011
Posts: 2
Location: Hungary

PostPosted: Tue Mar 22, 2011 10:43 am    Post subject: Reply with quote

Thanks mate, worked fine (:
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking 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