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 


Read 4byte address?
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
ups2000ups
I post too much
Reputation: 0

Joined: 31 Jul 2006
Posts: 2471

PostPosted: Mon Nov 05, 2007 1:51 am    Post subject: Reply with quote

How do i get the value from a pointer?
_________________
dont complain about my english...
1*1 = 2?
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Mon Nov 05, 2007 7:08 am    Post subject: Reply with quote

ups2000ups wrote:
How do i get the value from a pointer?


The same way you would read from any other address.

A pointer just points to another location of memory. Read the pointer first, and then use the returned value as part of your next read.

Pointer = NewAddressLoc
NewAddressLoc+Offset = Address to read for the value you want.

This is taken from my memory engine I wrote in C++
Code:
BOOL cMemory::ReadPtr(BYTE *pBaseAddress, DWORD iPtrOffset, DWORD* pStorage)
{
   BOOL   bRead      = FALSE;
   DWORD   dwPointer   = NULL;
   DWORD   dwValue      = NULL;

   bRead = ReadProcessMemory( m_hProc, pBaseAddress, &dwPointer, sizeof(DWORD), NULL );
   if( !bRead )
      return FALSE;

   if( IsBadReadPtr( &dwPointer, 4 ) )
      return FALSE;

   bRead = ReadProcessMemory( m_hProc, (LPCVOID)(DWORD_PTR)(dwPointer+iPtrOffset), &dwValue, sizeof(DWORD), NULL );
   if( !bRead )
      return FALSE;

   *pStorage = dwValue;
   return bRead;
}


You should be able to get the jist of what it's doing and convert it to other languages if needed.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
ups2000ups
I post too much
Reputation: 0

Joined: 31 Jul 2006
Posts: 2471

PostPosted: Mon Nov 05, 2007 8:52 am    Post subject: Reply with quote

well whats wrong with this script then?

Code:

procedure TForm1.Timer6Timer(Sender: TObject);
var address:dword;
    value3: dword;
    x:dword;
    newvalue:string;
begin
      readprocessmemory(processhandle,pointeR($ca337c+$3b8),@value3,4,x);
      newvalue:=intTostr(Value3);
      edit3.Text:=newvalue;
end;

_________________
dont complain about my english...
1*1 = 2?
Back to top
View user's profile Send private message
HolyBlah
Master Cheater
Reputation: 2

Joined: 24 Aug 2007
Posts: 446

PostPosted: Mon Nov 05, 2007 9:29 am    Post subject: Reply with quote

read pointer method is:
-Getting 4 bytes of an address .
-Add the offset.
-Read the result.
Code:

procedure TForm1.Timer6Timer(Sender: TObject);
var address:dword;
    value3: dword;
    x:dword;
    newvalue:string;
begin
      readprocessmemory(processhandle,pointeR($ca337c),@value3,4,x);
      readprocessmemory(processhandle,pointeR($value3+$3b8),@x,4,x);

      newvalue:=intTostr(x);
      edit3.Text:=newvalue;
end;
Back to top
View user's profile Send private message
ups2000ups
I post too much
Reputation: 0

Joined: 31 Jul 2006
Posts: 2471

PostPosted: Mon Nov 05, 2007 10:06 am    Post subject: Reply with quote

HolyBlah wrote:
read pointer method is:
-Getting 4 bytes of an address .
-Add the offset.
-Read the result.
Code:

procedure TForm1.Timer6Timer(Sender: TObject);
var address:dword;
    value3: dword;
    x:dword;
    newvalue:string;
begin
      readprocessmemory(processhandle,pointeR($ca337c),@value3,4,x);
      readprocessmemory(processhandle,pointeR($value3+$3b8),@x,4,x);

      newvalue:=intTostr(x);
      edit3.Text:=newvalue;
end;


first ur code was wrong $value3+$3b8 sould be value3+$3b8 Rolling Eyes

EDIT it works thanks +rep =)
now i just need to fix the bug with change bytes lolz

_________________
dont complain about my english...
1*1 = 2?
Back to top
View user's profile Send private message
HolyBlah
Master Cheater
Reputation: 2

Joined: 24 Aug 2007
Posts: 446

PostPosted: Mon Nov 05, 2007 1:06 pm    Post subject: Re: Read 4byte address? Reply with quote

ups2000ups wrote:
well down here i trying to update the value for a 4byte address

some1 can tell me whats wrong?
when i trying to update the value it update into a "byte" value

im sorry for begging alot right now but i trying to learn (i learn best when i work with it)

Code:

procedure TForm1.Button12Click(Sender: TObject);
var address:dword;
    value3: dword;
    x:dword;
    newvalue:string;
begin
       address:=StrToInt('$'+edit2.text);

  case combobox2.ItemIndex of

    2: //4 byte
    begin
      readprocessmemory(processhandle,pointeR(Address),@value3,4,x);
      newvalue:=intTostr(x);
      edit3.Text:=newvalue;
    end;
  end;
end;

try to take the value from value3 or check if u get the right handle.
here is my code:
Code:
procedure TForm1.Button1Click(Sender: TObject);
var address:dword;
    value: integer;
    NoNeedThisTime:dword;
begin
address:=StrToInt('$00400040');
if readprocessmemory(GetCurrentProcess,pointer(address),@value,4,NoNeedThisTime) then begin
caption:=format('%x',[value]);
end;
Back to top
View user's profile Send private message
ups2000ups
I post too much
Reputation: 0

Joined: 31 Jul 2006
Posts: 2471

PostPosted: Mon Nov 05, 2007 1:29 pm    Post subject: Re: Read 4byte address? Reply with quote

HolyBlah wrote:
ups2000ups wrote:
well down here i trying to update the value for a 4byte address

some1 can tell me whats wrong?
when i trying to update the value it update into a "byte" value

im sorry for begging alot right now but i trying to learn (i learn best when i work with it)

Code:

procedure TForm1.Button12Click(Sender: TObject);
var address:dword;
    value3: dword;
    x:dword;
    newvalue:string;
begin
       address:=StrToInt('$'+edit2.text);

  case combobox2.ItemIndex of

    2: //4 byte
    begin
      readprocessmemory(processhandle,pointeR(Address),@value3,4,x);
      newvalue:=intTostr(x);
      edit3.Text:=newvalue;
    end;
  end;
end;

try to take the value from value3 or check if u get the right handle.
here is my code:
Code:
procedure TForm1.Button1Click(Sender: TObject);
var address:dword;
    value: integer;
    NoNeedThisTime:dword;
begin
address:=StrToInt('$00400040');
if readprocessmemory(GetCurrentProcess,pointer(address),@value,4,NoNeedThisTime) then begin
caption:=format('%x',[value]);
end;


aww man if you could tell me i used the wrong thing it could saved me 2h from searching at google lolz

Thanks again =) but this time i cant rep you

_________________
dont complain about my english...
1*1 = 2?
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
Goto page Previous  1, 2
Page 2 of 2

 
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