>I could have sworn I saw a KB article around here on how to force an NT system to shut down and restart.
>
>I have an application that runs 24x7, and I'm experiencing odd troubles with it. I suspect a memory leak, and I just want to have the app shut down and restart WinNT every morning at 3:00 or something.
>
>Other apps will be running, but I suspect they will respond to the Windows shutdown message.
>
Hi Michael,
I don't know if this'll do it on NT, but try the following:
#DEFINE EWX_REBOOT 2
DECLARE SHORT ExitWindowsEx IN Win32API;
SHORT uFlags, INTEGER dwReserved
= ExitWindowsEx(EWX_REBOOT, 0)
According to the documentation on NT, "The calling process must have the SE_SHUTDOWN_NAME privilege....To shut down or restart the system, the calling process must use the AdjustTokenPrivileges function to enable the SE_SHUTDOWN_NAME privilege."
hth,
George
Ubi caritas et amor, deus ibi est