A few applications on my PC have been doing a detection wether a restart was done by Windows Update or not. This is observable due to them restarting after the automatic Windows Update reboot.
This is very helpful since those applications reload changes, even unsaved changes or restore tabs (in case of a browser). Examples of applications that do this:
- Google Chrome
- Microsoft Visual Studio
- Microsoft Paint
In all cases the applications save the state they were in before the reboot.
(My PC actually woke up from a standby state automatically, and rebooted itself while instaling updates. Too bad it didnt go back to standby after doing this.)
My question is: How do I programmatically detect this kind of reboot? It seems to be reliably detectable before the reboot.
The question How can I get the Windows last reboot reason might seem like a duplicate, but no answer said anything about updates.
I code in C#, so an answer in C# would be helpful, though I can read C and C++ too, for example.