Tell reboot from shutdown on Windows Server 2008

一世执手 提交于 2019-12-13 04:31:23

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!