Valhalla Legends Forums Archive | General Programming | Loading a library at desired base address

AuthorMessageTime
warz
Is it possible to specify the base address of a library that you're about to load with LoadLibrary? I have been looking at ReBaseImage64, but am not sure if this is the best way to go about doing so.

My call to ReBaseImage64 returns success, and the returned NewImageBase says it's what I told it to be, but my debugger says it's not loaded at that base address.
November 13, 2006, 10:31 AM
Skywing
Not with LoadLibrary.  LoadLibrary will try the preferred address burned into the image header first, and then the first available slot large enough for the image given alignment and allocation granularity constraints.

On Windows Vista or downlevel systems with a third-party ASLR implementation, this behavior may be different.
November 14, 2006, 6:03 PM
Myndfyr
[quote author=Skywing link=topic=16024.msg161216#msg161216 date=1163527404]
On Windows Vista or downlevel systems with a third-party ASLR implementation, this behavior may be different.
[/quote]
Specifically, in executables with relocation information, Windows Vista will load libraries into randomized addresses.
November 15, 2006, 5:37 AM

Search