Jump to content

How to reboot Win PE in my Application ( vc )


shevchenic

Recommended Posts


I managed to get WinPE to reboot by calling NtShutdownSystem, exported from NTDLL.DLL

something 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);

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...