title: Can we get the source of a reboot in Windows using the Win32 API
body: <p>I have handled <code>WM_QUERYENDSESSION</code> in an MFC application to handle reboot requests, to block reboots during certain conditions.</p>
  
  <p>Is it possible to get the source of the reboot from an MFC application?</p>
  
  <p>I need to find the source of the reboot request, i.e whether the user requested the reboot using Windows options, or if any application triggered the reboot, or if a crash/blue screen caused the reboot.</p>
  
  <p>I would appreciate any help.</p>