| View previous topic :: View next topic |
| Author |
Message |
rooski Master Cheater
Reputation: 0
Joined: 31 Oct 2007 Posts: 340 Location: Siberia
|
Posted: Sat Feb 13, 2010 1:28 am Post subject: getModuleHandle() |
|
|
is there a similar function but for a standalone .exe (or any other that will return the base address ), as far as i know i can only use this function if im injecting a DLL .
thanks.
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25831 Location: The netherlands
|
Posted: Sat Feb 13, 2010 2:29 am Post subject: |
|
|
look up the apis : createtoolhelp32snapshot , module32first and module32next
or EnumProcessModules(Ex) combined with GetModuleFileNameEx
_________________
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 |
|
 |
Jani Grandmaster Cheater
Reputation: 2
Joined: 29 Dec 2006 Posts: 804
|
Posted: Sat Feb 13, 2010 4:55 am Post subject: Re: getModuleHandle() |
|
|
| rooski wrote: | | as far as i know i can only use this function if im injecting a DLL. | GetModuleHandle(NULL); will return a handle to the file used to create the calling process (.exe file).
|
|
| Back to top |
|
 |
rooski Master Cheater
Reputation: 0
Joined: 31 Oct 2007 Posts: 340 Location: Siberia
|
Posted: Sat Feb 13, 2010 1:33 pm Post subject: |
|
|
@jani
i still dont understand how that will help me , im trying to write a trainer that uses read/write process memory , so my app is in no way hooking / creating a thread in the target process.
all i need is the base address , there has to be a simpler way to get it
thanks for helping out a newbie .
|
|
| Back to top |
|
 |
smartz993 I post too much
Reputation: 2
Joined: 20 Jun 2006 Posts: 2013 Location: USA
|
Posted: Sat Feb 13, 2010 1:56 pm Post subject: |
|
|
| rooski wrote: | @jani
i still dont understand how that will help me , im trying to write a trainer that uses read/write process memory , so my app is in no way hooking / creating a thread in the target process.
all i need is the base address , there has to be a simpler way to get it
thanks for helping out a newbie . |
Dark Byte already posted the necessary APIs.
Look into those APIs, and this structure:
http://msdn.microsoft.com/en-us/library/ms684225%28VS.85%29.aspx
|
|
| Back to top |
|
 |
igoticecream Grandmaster Cheater Supreme
Reputation: 0
Joined: 23 Apr 2006 Posts: 1807 Location: 0x00400000
|
Posted: Sat Feb 13, 2010 4:01 pm Post subject: |
|
|
well, if your desire is use Read/WriteProcessMemory, you need the process handle, this can be found calling OpenProcess and of course you need the process ID, that can be found by window name (GetWindowThreadProcessId) or by process name (CreateToolhelp32Snapshot)
So:
CreateToolhelp32Snapshot/GetWindowThreadProcessId -> OpenProcess -> Read/WriteProcessMemory
hope this will be useful for you
_________________
+~ |
|
| Back to top |
|
 |
rooski Master Cheater
Reputation: 0
Joined: 31 Oct 2007 Posts: 340 Location: Siberia
|
Posted: Sun Feb 14, 2010 2:15 am Post subject: |
|
|
ok so far with this code
| Code: |
void read();
{
DWORD pid = 0;
HANDLE hProcess = 0;
HWND hProc;
HANDLE hModuleSnap = INVALID_HANDLE_VALUE;
hProc = FindWindow(NULL, L"world of warcraft retail");
if(hProc)
{
GetWindowThreadProcessId(hProc, &pid);
}
hProcess = OpenProcess(PROCESS_VM_READ, 0, pid);
MODULEENTRY32 me32;
hModuleSnap = CreateToolhelp32Snapshot( TH32CS_SNAPMODULE, pid );
if( hModuleSnap == INVALID_HANDLE_VALUE )
{
cout<<"CreateToolhelp32Snapshot (of modules)";
}
me32.dwSize = sizeof( MODULEENTRY32 );
if( !Module32First( hModuleSnap, &me32 ) )
{
cout<<"Module32First";
CloseHandle( hModuleSnap );
}
do
{
cout <<"\n\n MODULE NAME: "<< me32.szModule ;
cout << "\n executable = "<< me32.szExePath;
cout << "\n process ID = "<< me32.th32ProcessID ;
cout << "\n ref count (g) = "<< me32.GlblcntUsage ;
cout << "\n ref count (p) = "<< me32.ProccntUsage ;
cout << "\n base address = "<< (DWORD) me32.modBaseAddr ;
cout << "\n base size = "<< me32.modBaseSize ;
} while( Module32Next( hModuleSnap, &me32 ) );
CloseHandle( hModuleSnap );
}
|
i get this , which isnt what i was hoping for , any ideas?
| Description: |
|
| Filesize: |
65.54 KB |
| Viewed: |
15972 Time(s) |

|
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25831 Location: The netherlands
|
Posted: Sun Feb 14, 2010 4:35 am Post subject: |
|
|
why isn't it what you are hoping for ?
base address looks exactly like the thing you want
_________________
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 |
|
 |
Anden100 Grandmaster Cheater
Reputation: 0
Joined: 20 Apr 2007 Posts: 668
|
Posted: Sun Feb 14, 2010 4:41 am Post subject: |
|
|
| Dark Byte wrote: | why isn't it what you are hoping for ?
base address looks exactly like the thing you want |
Now i don't know anything, but isn't 0x1260000 a bit weird for the first module?
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25831 Location: The netherlands
|
Posted: Sun Feb 14, 2010 5:02 am Post subject: |
|
|
not really, you can make the entry point almost any value you want, as long as it ends with 4 0's
also, it could be the console buffer is full and the first entries have been deleted (so won't even show when scrolling up)
_________________
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 |
|
 |
Anden100 Grandmaster Cheater
Reputation: 0
Joined: 20 Apr 2007 Posts: 668
|
Posted: Sun Feb 14, 2010 5:35 am Post subject: |
|
|
| Dark Byte wrote: | not really, you can make the entry point almost any value you want, as long as it ends with 4 0's
also, it could be the console buffer is full and the first entries have been deleted (so won't even show when scrolling up) |
I know it can be any address ending with 4 0's, but 1260000? never saw one that high. I like the second one with the console buffer better , it sure is WoW, a lot of Modules!
|
|
| Back to top |
|
 |
Jani Grandmaster Cheater
Reputation: 2
Joined: 29 Dec 2006 Posts: 804
|
Posted: Sun Feb 14, 2010 10:41 am Post subject: |
|
|
| rooski wrote: | | i still dont understand how that will help me , im trying to write a trainer that uses read/write process memory , so my app is in no way hooking / creating a thread in the target process. | Ah, sorry, I understood that you thought that you can't call GetModuleHandle from an exe and that you'd need a DLL for it. Well, you got the answer.
|
|
| Back to top |
|
 |
rooski Master Cheater
Reputation: 0
Joined: 31 Oct 2007 Posts: 340 Location: Siberia
|
Posted: Sun Feb 14, 2010 1:39 pm Post subject: |
|
|
this is kind of newbish of me , but how do i get a usable hex address from that dword one?
and how do i know which module is wow.exe since .szModule is supposed to give me the name but doesnt?
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25831 Location: The netherlands
|
Posted: Sun Feb 14, 2010 1:52 pm Post subject: |
|
|
a dword is a hex, it's just a way of displaying it on the screen, you don't need to convert it
szModule is an array (char array)
arrays are usually pointers, so look at the memory that array points to (or just use one of the string routines to make it easier.)
_________________
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 |
|
 |
rooski Master Cheater
Reputation: 0
Joined: 31 Oct 2007 Posts: 340 Location: Siberia
|
Posted: Sun Feb 14, 2010 2:16 pm Post subject: |
|
|
alright , that makes sense , and thank you all so much for the help.
EDIT_________________
for some reason when ever i run my program the process id and base address for the modules change , and what string routines can i use to get the name of the modules?
edit2________
printf() instead of cout , and i had to enable debug privileges to get it working .
|
|
| Back to top |
|
 |
|