views:

14

answers:

2

I am trying to add ASLR to a project using a vsprops file. I have verified the file is being used by the project as there are other settings in the file that are being applied, and intentionally corrupting the file produces an error when opening the project under MSVC. When I set ASLR to yes I can see RandomizedBaseAddress="2" under <Tool Name=VCLinkerTool.

but... It has no effect. I can also put RandomizedBaseAddress="xxxxx" and it doesn't care. It's as if that setting for the linker isn't being picked up. I also tried GenerateDebugInformation="True" which is another setting I've seen other vsprops files use, and that's ignored too. It's as if the linker is ignoring the vsprops file or these settings in it.

What gives? Has anyone seen this before?

A: 

What makes you think its not working? The image might load at the same address purely because the systems decides to load it there, not becauses its requesting to be put there, the second load should however be at a different address, so long as the second load isn't done after a reboot. Also ASLR is only for vista and up, windows xp won't try randomize it at all, it'll just load it at the first available slot

Necrolis
One hint was the fact I could specify `RandomizedBaseAddress="xxxxx"` in the vsprops file and it gave me no error.
fbrereto
Simplest way to check is to run dumpbin /headers and see if the headers include the "Dynamic Base" DLL characteristic.
EricLaw -MSFT-
@fbrereto: thats not proof at all, it could treat all non zero values as true, as it is the only options I see in MSVC is one to mark the image as uncompatible with ASLR. The only good ways to test is checking the headers or better, using a debugger/GetModuleHandle to check the actual loading addresses(ASLR can actually still kick in if the image has a fixed base and not marked as uncompatible)
Necrolis
A: 

The project file explicitly specified "default" for those parameters, thus overriding the vsprops file. Explicitly setting those items to "inherit from parent or project defaults" fixed the problem. Thanks for all the responses.

fbrereto