How can I reboot in c++? Is there any provision in WinSDK? What kind of rights should my program(process) have to do so?
getRuntime(). exec(new String[] { "su", "-c", "reboot" }); proc = Runtime. getRuntime(). exec(new String[]{"/system/bin/su","-c","reboot now"}); proc.
Use Your Phone's Power Button Almost all brands and models of Android smartphones have a power button. Press and hold the Power button for 5-10 seconds to reveal the power menu. Afterward, select Restart to shut down the device and power it back on.
Rebooting is the same as restarting, and close enough to powering off and then turning off your device. The purpose is to close and reopen the operating system. Resetting, on the other hand, means taking the device back to the state in which it left the factory. Resetting wipes all your personal data.
Before calling the ExitWindowsEx function you need to enable the SE_SHUTDOWN_NAME privilege:
There is the ExitWindowsEx Function that can do this. You need to pass the EWX_REBOOT (0x00000002) flag to restart the system.
Important note here (quote from 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.
You can choose between the appropriate function depending on your situation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With