2008-03-09 14:11:42 +00:00
|
|
|
/*
|
1998-10-05 04:00:59 +00:00
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS kernel
|
2012-09-28 23:32:59 +00:00
|
|
|
* FILE: ntoskrnl/ex/shutdown.c
|
1999-02-01 20:58:37 +00:00
|
|
|
* PURPOSE: Power managment
|
2005-05-09 01:38:29 +00:00
|
|
|
*
|
2005-01-26 13:58:37 +00:00
|
|
|
* PROGRAMMERS: David Welch (welch@cwcom.net)
|
1998-10-05 04:00:59 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* INCLUDES *****************************************************************/
|
|
|
|
|
2004-08-15 16:39:12 +00:00
|
|
|
#include <ntoskrnl.h>
|
2014-11-02 11:30:14 +00:00
|
|
|
|
|
|
|
#define NDEBUG
|
2008-08-30 16:31:06 +00:00
|
|
|
#include <debug.h>
|
1998-10-05 04:00:59 +00:00
|
|
|
|
2018-03-31 20:12:44 +00:00
|
|
|
/* PRIVATE FUNCTIONS *********************************************************/
|
|
|
|
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
ExShutdownSystem(VOID)
|
|
|
|
{
|
|
|
|
/* Dereference the hard-error port and process objects */
|
|
|
|
if (ExpDefaultErrorPort)
|
|
|
|
{
|
|
|
|
ObDereferenceObject(ExpDefaultErrorPort);
|
|
|
|
ExpDefaultErrorPort = NULL;
|
|
|
|
}
|
|
|
|
if (ExpDefaultErrorPortProcess)
|
|
|
|
{
|
|
|
|
ObDereferenceObject(ExpDefaultErrorPortProcess);
|
|
|
|
ExpDefaultErrorPortProcess = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-10-05 04:00:59 +00:00
|
|
|
/* FUNCTIONS *****************************************************************/
|
|
|
|
|
2004-08-07 19:13:27 +00:00
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
2010-03-08 20:47:10 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
2000-12-23 02:37:41 +00:00
|
|
|
NtShutdownSystem(IN SHUTDOWN_ACTION Action)
|
1998-10-05 04:00:59 +00:00
|
|
|
{
|
2010-03-08 20:47:10 +00:00
|
|
|
POWER_ACTION PowerAction;
|
2014-11-02 11:30:14 +00:00
|
|
|
|
2010-03-08 20:47:10 +00:00
|
|
|
/* Convert to power action */
|
|
|
|
if (Action == ShutdownNoReboot)
|
|
|
|
{
|
|
|
|
PowerAction = PowerActionShutdown;
|
|
|
|
}
|
|
|
|
else if (Action == ShutdownReboot)
|
|
|
|
{
|
|
|
|
PowerAction = PowerActionShutdownReset;
|
|
|
|
}
|
|
|
|
else if (Action == ShutdownPowerOff)
|
|
|
|
{
|
|
|
|
PowerAction = PowerActionShutdownOff;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return STATUS_INVALID_PARAMETER;
|
|
|
|
}
|
2014-11-02 11:30:14 +00:00
|
|
|
|
2010-03-08 20:47:10 +00:00
|
|
|
/* Now call the power manager */
|
2014-11-02 11:30:14 +00:00
|
|
|
DPRINT("Setting state to: %lx\n", PowerAction);
|
2010-03-08 20:47:10 +00:00
|
|
|
return NtSetSystemPowerState(PowerAction,
|
|
|
|
PowerSystemSleeping3,
|
|
|
|
POWER_ACTION_OVERRIDE_APPS |
|
|
|
|
POWER_ACTION_DISABLE_WAKES |
|
|
|
|
POWER_ACTION_CRITICAL);
|
1998-10-05 04:00:59 +00:00
|
|
|
}
|
1999-10-11 20:50:33 +00:00
|
|
|
|
|
|
|
/* EOF */
|