Search code examples
windowswinapiboot

Identify a reboot


Is there any "Boot session ID" or (reliable) "Boot timestamp"? For an installation I need to detect that a scheduled reboot took place indeed.

I guess I could do a dummy MoveFileEx() with MOVEFILE_DELAY_UNTIL_REBOOT, but i did hope for something easier.

(We have to install a 3rd party package that sometimes behaves erratically after an repair/update. In that state, accessing the device may even lock up the system)

(Windows XP, Vista, 7)


Solution

  • Apparently Windows has the equivalent of "uptime". Here's more info: http://support.microsoft.com/kb/555737

    As I understand it, this should tell you how long ago the system was booted. Will that information solve your problem?