Hello!
I have developed a service that is running under the administrator account.
One of the operations the service does is to shutdown the system everynight.
I use the WinApi
ExitWindowsEx(EWX_POWEROFF, 0);
Before I call this function I open the process token, adjust the token
privileges with SeShutdownPrivilege and blah, blah, blah. The service works
fine and shutdowns the system fine but ONLY if there is a user logged on the
system at this time. If there are no user logged, the function is executed
and returns a nonzero value (shutdown OK) but the system actually does not
shutdown. Asking the newsgroups I was told to go to the registry key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
and set ShutdownWithoutLogon to 1, but the problem persists.
Any idea what is going on here?