title: How can I enable DEP/NX and ASLR on a Delphi 2006 or earlier executable?
body: <p><a href="http://blogs.embarcadero.com/michaeldevery/2007/04/05/33777" rel="nofollow noreferrer">Delphi 2007 (and newer) supports</a> enabling DEP and ASLR via any of these three techniques:</p>
  
  <ul>
  <li>add the command-line switch <code>–dynamicbase</code> when compiling with dcc32</li>
  <li>add the preprocessor command <code>{$DYNAMICBASE ON}</code> to the source code</li>
  <li>manually OR in the bit in the header, with <code>{$SETPEOPTFLAGS $40}</code> in the source code </li>
  </ul>
  
  <p>I'd like to be able to do the same thing with Delphi 2006 and C++ Builder 2006 (aka BDS 2006). Does anyone know how to do this?</p>