Rebasing Modules

Every executable and DLL module has a preferred base address, which identifies the ideal memory address where the module should get mapped into a process’ address space. When you build an executable module, the linker sets the module’s preferred base address to 0x00400000. For a DLL module, the linker sets a preferred base address of 0x10000000. Using the Microsoft Visual Studio DumpBin utility (with the /headers switch), you can see an image’s preferred base address. Here is an example of using DumpBin to dump its own header information:

C:\>DUMPBIN /headers dumpbin.exe Microsoft (R) COFF/PE Dumper Version 8.00.50727.42 Copyright (C) Microsoft Corporation. All rights reserved. Dump of file dumpbin.exe PE signature found File Type: ...

Get Windows® via C/C++, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.