EXE or DLL Image base address

If you load the binary into your own process you can use GetModuleHandle. It returns a HMODULE, but that is the same as HINSTANCE and the base address.

If you want to know what base address the binary prefers you should read the PE header. See here and look for the ImageBase field in IMAGE_OPTIONAL_HEADER.

Edit: GetModuleHandle(NULL) will return the base address (altough the specified type is HMODULE) for the current process.

Leave a Comment