开发者

About ImageBase of .EXE in windows

开发者 https://www.devze.com 2023-01-16 21:15 出处:网络
I just learned ImageBase is specified in PE format,and OS will load it to the exact position for .EXE , then 开发者_如何学Pythoncomes the question:

I just learned ImageBase is specified in PE format,and OS will load it to the exact position for .EXE , then 开发者_如何学Pythoncomes the question:

what if two .EXE is requiring the same ImageBase location?


Incase of 2 EXE's, they have Completely Different Address Spaces...Every Executable has its own space. This means, every time you execute an EXE, it is assigned its own independent 4GB (on 32bit systems, although the process can use just part of it, the rest goes the kernel.) worth address space. It's Virtual Address Space. It's different from your Physical Memory.

So there's no conflict.

Technically, a PE can load just about anywhere, but the default ImageBase is 0x400000.

Now, Lets say you have an EXE and it loads a couple of DLL's (which happen to have the same ImageBase)...In this case, The first DLL loads fine, the second one gets relocated (or "rebased"). Each DLL has a .reloc Section which contains data about updating references within the code.


you can use Process Explorer to see the value the ImageBase and Base addresses of any running application (with its DLLs). Based on these values you can see whether rebasing has taken place.

0

精彩评论

暂无评论...
验证码 换一张
取 消