I have an application running under Windows 7 Embedded, and it needs to communicate with an external resource whenever the system shuts down or reboots. My logic is different depending on whether the system is shut down permanently or shutting down as part of a reboot.
From what I see, there are several comments suggesting that it is not possible to pinpoint shutdown vs. reboot, but I need a bit more evidence (or an MSDN document would be nice).
This post provides a somewhat hacky solution to distinguish between the two, but for the most part is not reliable: Report a reboot after Windows Server 2008 shuts down .
In this post: Is there a way in C # to detect shutdown / exit of Windows and cancel this action (after user request) ... one of the commentators suggest that it is impossible to detect the difference between rebooting and shutting down altogether.
Does anyone have a more authoritative answer to this problem?
source share