linhan
October 14th, 2005, 12:06
I have Enumulate all the running process,
How can I get the baseaddress of the running
process?
How can I get the baseaddress of the running
process?
View Full Version : How to get the baseaddress of the running process?
[Originally Posted by blabberer]base adrress ?? imagebase of the process ?? GetModuleHandle() returns the imagebase hope thats what you are looking for ?? |
[Originally Posted by LLXX]Of all the 32-bit PEs I have seen, the base address is 400000. Safe assumption to make. Of course, you can always open the file on the disk and read the PE header... |
Of all the 32-bit PEs I have seen, the base address is 400000 |
[Originally Posted by naides]Question: What would be the USE of an exe that load with a base address different from 40000000? What happens when you load two exe files (not simultanously, one loads the other) in the same memory context? do they share the base address or one of them gets relocated. |
[Originally Posted by blabberer]they ? who ? ![]() |
[Originally Posted by naides]What happens when you load two exe files (not simultanously, one loads the other) in the same memory context? |
HMODULE x = NULL;
HMODULE y = NULL;
x = LoadLibrary("notepad.exe";
printf("Only notepad.exe in memory:\n";
printf("Base address of notepad.exe: 0x%08X\n\n", x);
FreeLibrary(x);
y = LoadLibrary("explorer.exe";
printf("Only explorer.exe in memory:\n";
printf("Base address of explorer.exe: 0x%08X\n\n", y);
FreeLibrary(y);
x = LoadLibrary("notepad.exe";
y = LoadLibrary("explorer.exe";
printf("notepad.exe AND explorer.exe in memory:\n";
printf("Base address of notepad.exe: 0x%08X\n", x);
printf("Base address of explorer.exe: 0x%08X\n", y);
FreeLibrary(y);
FreeLibrary(x);
Only notepad.exe in memory:
Base address of notepad.exe: 0x01000000
Only explorer.exe in memory:
Base address of explorer.exe: 0x01000000
notepad.exe AND explorer.exe in memory:
Base address of notepad.exe: 0x01000000
Base address of explorer.exe: 0x00430000
possibly tries to convey above |