shevchenic Posted December 20, 2005 Posted December 20, 2005 Hi,Now I need reboot function in my application.I have try to use ExitWindowsEx( , ) and "rundll32 shell32,exitwindows", but it doesn' t work.How can I do? I write my application in vc++.thx.
Daemonforce Posted December 20, 2005 Posted December 20, 2005 From what I've noticed, WinPE can only shutdown if you kill the shell or initiate a crash command. Does your build include reset.exe/shutdown.exe?
mats Posted December 20, 2005 Posted December 20, 2005 A dirty way is to call shutdown.exe or just run pskill and kill the whatever shell process you got
choctastic Posted December 23, 2005 Posted December 23, 2005 I managed to get WinPE to reboot by calling NtShutdownSystem, exported from NTDLL.DLLsomething like this: typedef enum _SHUTDOWN_ACTION { ShutdownNoReboot, ShutdownReboot, ShutdownPowerOff } SHUTDOWN_ACTION; typedef DWORD (WINAPI* lpNtShutdownSystem)(SHUTDOWN_ACTION Action); HMODULE hNTDLL = LoadLibrary("NTDLL.DLL"); if (hNTDLL) { lpNtShutdownSystem NtShutdownSystem = (lpNtShutdownSystem)GetProcAddress(hNTDLL, "NtShutdownSystem"); if (NtShutdownSystem) { if (msg.wParam & EWX_SHUTDOWN) NtShutdownSystem((msg.wParam & EWX_POWEROFF) ? ShutdownPowerOff : ShutdownNoReboot); if (msg.wParam & EWX_REBOOT) NtShutdownSystem(ShutdownReboot); } } FreeLibrary(hNTDLL);
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now