如何在c中重启? WinSDK有什么规定吗?我的程序(进程)必须这样做什么样的权限?
解决方法
有
ExitWindowsEx Function可以做到这一点.您需要传递EWX_REBOOT(0x00000002)标志来重新启动系统.
这里的重要提示(从MSDN引用):
The ExitWindowsEx function returns as soon as it has initiated the shutdown process. The shutdown or logoff then proceeds asynchronously. The function is designed to stop all processes in the caller’s logon session. Therefore,if you are not the interactive user,the function can succeed without actually shutting down the computer. If you are not the interactive user,use the InitiateSystemShutdown or InitiateSystemShutdownEx function.
您可以根据您的情况选择适当的功能.