2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * FILE: ntoskrnl/ex/shutdown.c
5 * PURPOSE: Power managment
7 * PROGRAMMERS: David Welch (welch@cwcom.net)
10 /* INCLUDES *****************************************************************/
17 /* PRIVATE FUNCTIONS *********************************************************/
21 ExShutdownSystem(VOID
)
23 /* Dereference the hard-error port and process objects */
24 if (ExpDefaultErrorPort
)
26 ObDereferenceObject(ExpDefaultErrorPort
);
27 ExpDefaultErrorPort
= NULL
;
29 if (ExpDefaultErrorPortProcess
)
31 ObDereferenceObject(ExpDefaultErrorPortProcess
);
32 ExpDefaultErrorPortProcess
= NULL
;
36 /* FUNCTIONS *****************************************************************/
43 NtShutdownSystem(IN SHUTDOWN_ACTION Action
)
45 POWER_ACTION PowerAction
;
47 /* Convert to power action */
48 if (Action
== ShutdownNoReboot
)
50 PowerAction
= PowerActionShutdown
;
52 else if (Action
== ShutdownReboot
)
54 PowerAction
= PowerActionShutdownReset
;
56 else if (Action
== ShutdownPowerOff
)
58 PowerAction
= PowerActionShutdownOff
;
62 return STATUS_INVALID_PARAMETER
;
65 /* Now call the power manager */
66 DPRINT("Setting state to: %lx\n", PowerAction
);
67 return NtSetSystemPowerState(PowerAction
,
69 POWER_ACTION_OVERRIDE_APPS
|
70 POWER_ACTION_DISABLE_WAKES
|
71 POWER_ACTION_CRITICAL
);