[NTOSKRNL]
[reactos.git] / reactos / ntoskrnl / ex / shutdown.c
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * FILE: ntoskrnl/ex/shutdown.c
5 * PURPOSE: Power managment
6 *
7 * PROGRAMMERS: David Welch (welch@cwcom.net)
8 */
9
10 /* INCLUDES *****************************************************************/
11
12 #include <ntoskrnl.h>
13 #include <debug.h>
14
15 /* FUNCTIONS *****************************************************************/
16
17 /*
18 * @implemented
19 */
20 NTSTATUS
21 NTAPI
22 NtShutdownSystem(IN SHUTDOWN_ACTION Action)
23 {
24 POWER_ACTION PowerAction;
25
26 /* Convert to power action */
27 if (Action == ShutdownNoReboot)
28 {
29 PowerAction = PowerActionShutdown;
30 }
31 else if (Action == ShutdownReboot)
32 {
33 PowerAction = PowerActionShutdownReset;
34 }
35 else if (Action == ShutdownPowerOff)
36 {
37 PowerAction = PowerActionShutdownOff;
38 }
39 else
40 {
41 return STATUS_INVALID_PARAMETER;
42 }
43
44 /* Now call the power manager */
45 DPRINT1("Setting state to: %lx\n", PowerAction);
46 return NtSetSystemPowerState(PowerAction,
47 PowerSystemSleeping3,
48 POWER_ACTION_OVERRIDE_APPS |
49 POWER_ACTION_DISABLE_WAKES |
50 POWER_ACTION_CRITICAL);
51 }
52
53 /* EOF */