Protecting Your Code with Visual C++ Defenses

Protecting Your Code with Visual C++ Defenses by Michael Howard

Executive summary:

Always compile with:
/NXCompat
/SafeSEH
/DynamicBase

In the header(PCH) always define:
#define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 1

In the code call :
SetProcessDEPPolicy(PROCESS_DEP_ENABLE);

Note that some of these feature are available from Vista SP1.