Getting the Server's Certificate Chain from WinINET

Over the last few years, a number of folks have lamented that there's no good way to get the server's complete certificate chain from a WinINET HTTP response. That has changed with the release of the new WinINET shipping in Windows 7 / IE8. 

INTERNET_OPTION_SERVER_CERT_CHAIN_CONTEXT is a new flag you can pass to InternetQueryOption to grab the server’s certificate chain. Microsoft's Jeff Sanders wrote a post with more information and sample code showing how to use this new flag.  Thanks, Jeff!