Valhalla Legends Archive

Programming => General Programming => Topic started by: warz on November 13, 2006, 04:31 AM

Title: Loading a library at desired base address
Post by: warz on November 13, 2006, 04:31 AM
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.
Title: Re: Loading a library at desired base address
Post by: Skywing on November 14, 2006, 12:03 PM
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.
Title: Re: Loading a library at desired base address
Post by: MyndFyre on November 14, 2006, 11:37 PM
Quote from: Skywing on November 14, 2006, 12:03 PM
On Windows Vista or downlevel systems with a third-party ASLR implementation, this behavior may be different.
Specifically, in executables with relocation information, Windows Vista will load libraries into randomized addresses.