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 


C++ Reading an adress
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
A_jj74
Cheater
Reputation: 0

Joined: 14 Nov 2009
Posts: 41

PostPosted: Sun Nov 15, 2009 6:42 am    Post subject: C++ Reading an adress Reply with quote

Well as the Title says, how would I go on about reading an address?
Back to top
View user's profile Send private message
Jani
Grandmaster Cheater
Reputation: 2

Joined: 29 Dec 2006
Posts: 804

PostPosted: Sun Nov 15, 2009 6:55 am    Post subject: Reply with quote

Code:
int *ptr = 0x400000;
int value = *ptr;
Back to top
View user's profile Send private message
A_jj74
Cheater
Reputation: 0

Joined: 14 Nov 2009
Posts: 41

PostPosted: Sun Nov 15, 2009 7:00 am    Post subject: Reply with quote

Thanks for the Reply, is it really that simple? Don't you have to get the Process or something like that?
Back to top
View user's profile Send private message
Jani
Grandmaster Cheater
Reputation: 2

Joined: 29 Dec 2006
Posts: 804

PostPosted: Sun Nov 15, 2009 9:55 am    Post subject: Reply with quote

Yeah, pointers are easy. You just point and read the value at the address.
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: Sun Nov 15, 2009 10:17 am    Post subject: Reply with quote

ReadProcessMemory
Back to top
View user's profile Send private message MSN Messenger
A_jj74
Cheater
Reputation: 0

Joined: 14 Nov 2009
Posts: 41

PostPosted: Sun Nov 15, 2009 10:19 am    Post subject: Reply with quote

Ok thanks.
Back to top
View user's profile Send private message
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Sun Nov 15, 2009 10:40 am    Post subject: Reply with quote

C/C++ has a direct access to the memory
that's why you don't have to use readprocessmemory
unless you want to read other process's memory
Back to top
View user's profile Send private message
bulhufas
How do I cheat?
Reputation: 0

Joined: 06 Nov 2009
Posts: 9

PostPosted: Sun Nov 15, 2009 5:14 pm    Post subject: Reply with quote

ReadProcessMemory to read other process' memory.
Jany's code to read your process' memory.

You can also inject a DLL to use Jany's code in any process.
Back to top
View user's profile Send private message
A_jj74
Cheater
Reputation: 0

Joined: 14 Nov 2009
Posts: 41

PostPosted: Mon Nov 16, 2009 1:56 am    Post subject: Reply with quote

_DoR wrote:
C/C++ has a direct access to the memory
that's why you don't have to use readprocessmemory
unless you want to read other process's memory


Yes, I want to read another Process's memory Very Happy, thank you that cleared some things up.

bulhufas wrote:
ReadProcessMemory to read other process' memory.
Jany's code to read your process' memory.

You can also inject a DLL to use Jany's code in any process.

I'm not good at DLL's so I wont attempt DLL injection, thanks for your reply.
Back to top
View user's profile Send private message
bulhufas
How do I cheat?
Reputation: 0

Joined: 06 Nov 2009
Posts: 9

PostPosted: Mon Nov 16, 2009 9:55 am    Post subject: Reply with quote

ReadProcessMemory and WriteProcessMemory are hooked by game security systems, so if you're asking because of game cheats, you should use DLL Injection.
Back to top
View user's profile Send private message
iPromise
Grandmaster Cheater
Reputation: -1

Joined: 27 Jun 2009
Posts: 529
Location: Canada

PostPosted: Wed Nov 18, 2009 8:54 pm    Post subject: Solution Reply with quote

First you want to do a VirtualProtect hookhop because it locally hooked on most anti-hacking systems.

Like so:

Code:

DWORD VirtualAddress = (DWORD)GetProcAddress(GetModuleHandleA("kernel32.dll"), "VirtualProtect") + 5;

BOOL WINAPI VirtualProtectX(LPVOID lpAddress, SIZE_T dwSize, DWORD flNewProtect, PDWORD lpflOldProtect)
{
   _asm {
      mov edi,edi
      push ebp
      mov esp, ebp
      jmp [VirtualAddress]
   }
}


Now do this:

Code:

DWORD Protection;
VirtualProtectX((LPVOID) 0xAddress, 4, PAGE_EXECUTE_READWRITE, &Protection);

// if your editing a 4 byte address
*(DWORD*) 0xAddress = 100;


Thats it, it works like that. Dont listen to anybody that tells you to just derefence the address then typecast it, it wont work. You need to give read/write protection to the address.
Back to top
View user's profile Send private message MSN Messenger
A_jj74
Cheater
Reputation: 0

Joined: 14 Nov 2009
Posts: 41

PostPosted: Thu Nov 19, 2009 1:12 am    Post subject: Reply with quote

Thanks a lot everyone, I really appreciate it!
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Thu Nov 19, 2009 1:59 pm    Post subject: Re: Solution Reply with quote

iPromise wrote:
First you want to do a VirtualProtect hookhop because it locally hooked on most anti-hacking systems.

Like so:

Code:

DWORD VirtualAddress = (DWORD)GetProcAddress(GetModuleHandleA("kernel32.dll"), "VirtualProtect") + 5;

BOOL WINAPI VirtualProtectX(LPVOID lpAddress, SIZE_T dwSize, DWORD flNewProtect, PDWORD lpflOldProtect)
{
   _asm {
      mov edi,edi
      push ebp
      mov esp, ebp
      jmp [VirtualAddress]
   }
}


Now do this:

Code:

DWORD Protection;
VirtualProtectX((LPVOID) 0xAddress, 4, PAGE_EXECUTE_READWRITE, &Protection);

// if your editing a 4 byte address
*(DWORD*) 0xAddress = 100;


Thats it, it works like that. Dont listen to anybody that tells you to just derefence the address then typecast it, it wont work. You need to give read/write protection to the address.

Why would he want to read from an address which is unreadable in normal circumstances ? It's not really likely to store a variable, is it ? You make no sense
Back to top
View user's profile Send private message
iPromise
Grandmaster Cheater
Reputation: -1

Joined: 27 Jun 2009
Posts: 529
Location: Canada

PostPosted: Thu Nov 19, 2009 6:50 pm    Post subject: Reply with quote

Your confused, what i'm doing is for example, if I want to edit the address 0x00400000, and lets stay its a 16-bit address, and I wanted its value to be one.

Code:

DWORD Protect;
VirtualProtectX((LPVOID) 0x00400000, 4, PAGE_EXECUTE_READWRITE, &Protect);

// To protect the address in order for us to edit it now..

*(WORD*) 0x00400000 = 1;

// What i'm doing is dereferencing the address with the * and typecasting it to a WORD (which is 16-bits) then making it equal to the value 1. This works 100% when I tried it.
Back to top
View user's profile Send private message MSN Messenger
A_jj74
Cheater
Reputation: 0

Joined: 14 Nov 2009
Posts: 41

PostPosted: Fri Nov 20, 2009 1:03 pm    Post subject: Reply with quote

iPromise wrote:
Your confused, what i'm doing is for example, if I want to edit the address 0x00400000, and lets stay its a 16-bit address, and I wanted its value to be one.

Code:

DWORD Protect;
VirtualProtectX((LPVOID) 0x00400000, 4, PAGE_EXECUTE_READWRITE, &Protect);

// To protect the address in order for us to edit it now..

*(WORD*) 0x00400000 = 1;

// What i'm doing is dereferencing the address with the * and typecasting it to a WORD (which is 16-bits) then making it equal to the value 1. This works 100% when I tried it.

Well I don't need to write to an Address, I just need to read from it Very Happy.
(As the Title of the Thread/Topic says)
Anyways thank you for your Post.
I'll need this some time Razz.
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 1, 2  Next
Page 1 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