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 


[Help]How can determine lpBaseAddress

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

Joined: 10 Aug 2014
Posts: 3

PostPosted: Sun Aug 10, 2014 7:44 pm    Post subject: [Help]How can determine lpBaseAddress Reply with quote

Hi EveryOne , Smile


Q1:how can Get the Exe base address?(without using cheat engine)

Q2:is it static or dynamic(lpBaseAddress)?

Q3:how can calculate the Exe base address and add the offsets, to reach to my pointer value?
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 10, 2014 8:42 pm    Post subject: Reply with quote

You can use API to get the base address, or wrappers depending on what language you are using.
If you need to use direct API calls, you can use either:

Toolhlp32:
- CreateToolhelp32Snapshot
- Process32First
- Process32Next
- Module32First
- Module32Next

PSAPI:
- EnumProcesses
- EnumProcessModules / EnumProcessModulesEx

You can also walk the module list manually via the PEB if you understand how to obtain that information and walk it manually etc.

If you are using a language such as VB.NET or C#, you can use the Process class instead which is a wrapper around various API which will give you all this information already:
http://msdn.microsoft.com/en-us/library/system.diagnostics.process(v=vs.110).aspx

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

Joined: 10 Aug 2014
Posts: 3

PostPosted: Mon Aug 11, 2014 11:02 am    Post subject: Reply with quote

Sorry for my late reply atom0s


but why i need ;
- EnumProcessModules / EnumProcessModulesEx


HANDLE hProc = OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION | PROCESS_VM_READ, FALSE, /*NOTEPAD_PID*/);
DWORD lpBaseAddress = 0x????????; /// i need to get it programmatically
int lpBuffer;
BOOL ReadRam = ReadProcessMemory(hProc, (LPVOID*)lpBaseAddress, &lpBuffer, sizeof(lpBuffer), NULL);
if (ReadRam){
printf(("%d\n"), lpBuffer);
}

Sorry, i am a beginner with C++;
thank You atom0s Idea
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 Aug 11, 2014 12:35 pm    Post subject: Reply with quote

You can see Microsofts examples here on the MSDN.

This is an example of iterating the module list of a process with the CreateToolhelp32Snapshot and similar API:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms686849(v=vs.85).aspx

This is an example of iterating the module list of a process with the PSAPI API:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms682621(v=vs.85).aspx

Keep in mind if you need the base address of the process itself, it will be the first module returned from either of these API.

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

Joined: 09 Nov 2005
Posts: 2676

PostPosted: Mon Aug 11, 2014 12:53 pm    Post subject: Re: [Help]How can determine lpBaseAddress Reply with quote

@pointer wrote:
Hi EveryOne , Smile


Q1:how can Get the Exe base address?(without using cheat engine)

Q2:is it static or dynamic(lpBaseAddress)?

Q3:how can calculate the Exe base address and add the offsets, to reach to my pointer value?


1. Using Toolhlp32 or PSAPI like atomos suggested. I prefer Toolhlp32 myself and you can find a lot more example usage in trainers with it (check out spookie's codeshifting tutorial and you can find example trainers in it).

2. If its an exe, its most likely going to be static (40000(cba to type correct zeros) if its 32bit or a big number on 64bit ) but depends on the game really. If its a dll, its going to shift to be loaded at the available address space or be loaded by the application itself at some random address (some games did that though i haven't seen it in a long time). It doesn't matter though because if you're calculating the base address, even if it shifts you get the correct address.

3. Toolhlp32 and search for the exe name instead of a dll. Adding offsets depends on your language of choice.


PS: Worth pointing out is this thread should go into general programming not GD.

_________________
Cheat Requests/Tables- Fearless Cheat Engine
https://fearlessrevolution.com
Back to top
View user's profile Send private message
@pointer
How do I cheat?
Reputation: 0

Joined: 10 Aug 2014
Posts: 3

PostPosted: Mon Aug 11, 2014 2:38 pm    Post subject: Reply with quote

ok, thanks atom0s , STN
i need to review some lessons in c++
return thanks;
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 Discussions 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