I have an application running on Windows 7 Embedded, and it needs to communicate to an external resource whenever the system is shutting down OR rebooting. My logic is different depending on whether or not the system is shutting down permanently vs. shutting down as part of a reboot.
From what I see, there's a few comments suggesting that it is not possible to accurately determine shutdown vs. reboot, but I need a little more evidence (or MSDN doc would be nice).
This post gives a somewhat hackish solution to distinguishing between the two, but for the most part is not reliable: Tell reboot from shutdown on Windows Server 2008.
On this post: Is there a way in c# to detect a Windows shutdown/logoff and cancel that action (after asking the user) ...one of the commenters suggests that it is NOT possible to detect the difference between reboot and shutdown, at all.
Does anyone have a more authoritative answer to this problem?