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 


How to find memory address on C++?

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

Joined: 25 Jul 2010
Posts: 5
Location: Under_water

PostPosted: Sun Jul 25, 2010 2:42 pm    Post subject: How to find memory address on C++? Reply with quote

anyone can help me? how to find memory address on memory, example i want to find an integer and it has 4 value on xx.exe on process and i want to change it to 5 with creating a pointer on my app... i try it with CE and its work, and then i try to read and understanding the source, and i never understand coz to many code i dont understand, help me please !!! i just a newbie..... Confused Confused Confused Confused

sorry if my english is not well Laughing Laughing
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: Tue Jul 27, 2010 3:49 pm    Post subject: Reply with quote

First things first, you should learn a language suitable for you before jumping straight into game hacking with it. You will only confuse yourself more if you jump into things too fast.

If you are familiar with a language already though, you can read/write information to another process using the following API:
- ReadProcessMemory
- WriteProcessMemory

These two API will require some more API for you to obtain access to a process and so on.

You can also create a DLL that will be injected into the process, which you will then have direct access to the processes memory, which does not require you to use API then to alter and read the processes memory.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
kangkung_sawah
How do I cheat?
Reputation: 0

Joined: 25 Jul 2010
Posts: 5
Location: Under_water

PostPosted: Wed Jul 28, 2010 12:07 pm    Post subject: Reply with quote

i'm learning about Threading and Process in C++ now, but i need more tutorial and guide to understanding them, can you show me some link about that? and i know there are a lot of source code, and i try to read and comprehending of it, but i hardly to do that.. Sad Sad Sad
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: Sat Jul 31, 2010 12:17 am    Post subject: Reply with quote

http://msdn.microsoft.com/en-us/library/ms684254%28VS.85%29.aspx

Will go a bit more indepth about threads and such. Also read the pages regarding the API mentioned in those articles. There are tons of links and information on the net, just use Google to find them. Use search patters if you need to for example:

C++ threading +tutorial +information

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
kangkung_sawah
How do I cheat?
Reputation: 0

Joined: 25 Jul 2010
Posts: 5
Location: Under_water

PostPosted: Sat Jul 31, 2010 12:57 pm    Post subject: Reply with quote

thank you very much for all the information, now I can slightly understand about all that, and now, i can set a token privilege of my app and creating some thread... but dont have a way to suspending some process, any ideas?

Very Happy Very Happy Very Happy
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: Sun Aug 01, 2010 1:16 pm    Post subject: Reply with quote

kangkung_sawah wrote:
thank you very much for all the information, now I can slightly understand about all that, and now, i can set a token privilege of my app and creating some thread... but dont have a way to suspending some process, any ideas?

Very Happy Very Happy Very Happy


You need to obtain the handle of the main thread of the process and suspend it. You can obtain that using:
- CreateToolhelp32Snapshot
- Thread32First
- Thread32Next

And suspend it with:
- SuspendThread
- ResumeThread

There are other ways to do this as well, but this is the simplest of them.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
kangkung_sawah
How do I cheat?
Reputation: 0

Joined: 25 Jul 2010
Posts: 5
Location: Under_water

PostPosted: Thu Aug 05, 2010 1:52 pm    Post subject: Reply with quote

wow...thanks a lot guys,, now i can suspend a thread and some process by calling a SuspendProcess function on ntdll.dll,,, but i would like to ask how to keep smaller size of compiled and linked file by static linked to MFC ?? any idea?? i dont wanna 1,6mb for one form only... Sad Sad
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: Thu Aug 05, 2010 8:39 pm    Post subject: Reply with quote

kangkung_sawah wrote:
but i would like to ask how to keep smaller size of compiled and linked file by static linked to MFC ?? any idea?? i dont wanna 1,6mb for one form only... Sad Sad


There are some compiler/linker tricks you can do to help reduce the size, but to be honest you will, in the long run, run into issues using them in most cases with larger scale projects.

If you want a smaller file size, use dynamic linking instead. Keep in mind though, when you dynamically link, users will need the runtime you used to develop your software in. If you are using Visual Studio 2003/2005/2008/2010, you can simply give people download links for any of the runtime redistributable packages from MSDN.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
kangkung_sawah
How do I cheat?
Reputation: 0

Joined: 25 Jul 2010
Posts: 5
Location: Under_water

PostPosted: Thu Aug 12, 2010 3:49 am    Post subject: Reply with quote

so... how to find some value in memory? i cant use WriteProcessMemory if i dont know where is to be written? please tell me how,,,
Back to top
View user's profile Send private message
iPromise
Grandmaster Cheater
Reputation: -1

Joined: 27 Jun 2009
Posts: 529
Location: Canada

PostPosted: Mon Aug 16, 2010 4:17 am    Post subject: Reply with quote

If your aiming for your memory scanner to most likely be detected by any anti-hacking software that the game uses, you can just make a application use these api's:


- OpenHandle
- VirtualQueryEx
- ReadProcessMemory


and


- WriteProcessMemory


If you also want to tamper with memory.

If you want your memory scanner to be undetected, you can always inject your dynamic link library (dll) into your target, then use:


- VirtualQuery
- memcpy


To enumerate through the memory regions and find readable memory, then just copy the memory in the region and compare each value it has stored to what your looking for, and if you find matches write it to a temporary buffer, then after the scan is finished move the content of the buffer to something like a listbox if you want.

If you want to determine a static address from a dynamic address, your going to need to use this api:


- GetModuleHandleEx


With the GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS flag.
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming 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