How can I get the Windows last reboot reason

后端 未结 2 1513
轮回少年
轮回少年 2020-12-04 11:13

I\'d like to know what is the Windows API function (if any exists) that provides information about the last Windows reboot source. There are three main possible causes:

2条回答
  •  伪装坚强ぢ
    2020-12-04 11:56

    Take a look at the Event Log API. Case a) (bluescreen, user cut the power cord or system hang) causes a note ('system did not shutdown correctly' or something like that) to be left in the 'System' event log the next time the system is rebooted properly. You should be able to access it programmatically using the above API (honestly, I've never used it but it should work).

提交回复
热议问题