问题
As per MSDN, it is not possible to determine, whether reboot or shutdown occurred using WM_ENDSESSION Message.
I've found the only way to do this, but it's quite ugly and works only for Windows 2000 Server, not for 2008 Server.
The reason I'm asking is that I'm in process of porting Linux daemon to Windows as System Service. This daemon acts differently on reboot and system shutdown events.
I am also using python with pywin32 in project if it somehow helps to answer.
回答1:
You need to investigate using HookAPI (SetWindowsHookEx?) to capture all ExitWindowsEx calls before they happen.
Links that may help: http://pastebin.com/raw.php?i=KMKiMfBD http://www.codeproject.com/KB/system/Paladin.aspx
来源:https://stackoverflow.com/questions/4079311/tell-reboot-from-shutdown-on-windows-server-2008