Programming Windows Security

    the code

 

 

code snippets from the book

You can download the project that I used to compile and test the code snippets in the book from here (updated 27 Oct 2000): snippets.zip.
The only reason I'm providing these files is so that you can use them to cut and paste the sample code, but I will not support you running the tests as they assume a certain environment (the most obvious problem is that, the domain and account names that I've used won't match yours, but there are other configuration issues such as required privileges and logon rights). I could have spent the time to make these tests completely self contained (by configuring domain accounts, groups, privileges, logon rights, etc.), but instead I decided to ship the book :-)

With that caveat out of the way, there are lots of files in the above ZIP file that have to do with building my test harnesses (I include them only for completeness so that you can verify that the samples at least compile). The source files you want are named after the chapters of the book (feel free to discard the other stuff if you don't want to compile them).

external code samples

Here are the code samples that are currently available (you'll note that these are also listed on my security samples page - as I developed the samples I made them freely available while the book was being written):
  • Token Dump Component
    This simple component is incredibly useful for dumping the security context you're running under in any scenario. You make a call to it and it dumps a pretty-printed HTML string describing the contents of the thread and process token currently in place. You can use this to debug security related problems (it's always important to ascertain your security context when you are having trouble). You can also use this to spelunk around in IIS with the various IIS authentication options. The source code for this component will help you understand how to scrape out the contents of a token.

    Programming Windows Security: the book
    Programming Windows Security: the bugs
    Programming Windows Security: the short course
    Keith's home page
    DevelopMentor's home page