Since the Trustworthy Computing initative Microsoft developers have been writing code following the guidance and coding practises documented in "Writing Secure Code". The book is now in it's second edition which includes practical advise following experience by our developers. The results of the initative have been dramatic in terms of the reduction in the number of software vulnerabilities and their criticality.
For more information please refer to the following:
[Writing Secure Code] http://www.microsoft.com/mspress/books/5957.asp
[Protect Your PC] http://www.microsoft.com/protect