title: How does Windows close a program when shutting down the computer?
body: <p>My application throws some strange errors if you shut down the computer while my application is running.  </p>
  
  <p>Sometimes the message is <strong><em>(address) memory can not be "read"</em></strong>, sometimes <strong><em>can not be "write"</em></strong>.</p>
  
  <p>Shutting down the application in the normal way doesn't generate such messages.</p>
  
  <p>How can I simulate the "windows shutdown" so that I can debug my application?  How can I find out what the application is trying to do that it cannot?</p>