[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
14 #define NDEBUG
15 #include <debug.h>
16
17 /* FUNCTIONS *****************************************************************/
18
19 /*
20 * @implemented
21 */
22 NTSTATUS
23 NTAPI
24 NtShutdownSystem(IN SHUTDOWN_ACTION Action)
25 {
26 POWER_ACTION PowerAction;
27
28 /* Convert to power action */
29 if (Action == ShutdownNoReboot)
30 {
31 PowerAction = PowerActionShutdown;
32 }
33 else if (Action == ShutdownReboot)
34 {
35 PowerAction = PowerActionShutdownReset;
36 }
37 else if (Action == ShutdownPowerOff)
38 {
39 PowerAction = PowerActionShutdownOff;
40 }
41 else
42 {
43 return STATUS_INVALID_PARAMETER;
44 }
45
46 /* Now call the power manager */
47 DPRINT("Setting state to: %lx\n", PowerAction);
48 return NtSetSystemPowerState(PowerAction,
49 PowerSystemSleeping3,
50 POWER_ACTION_OVERRIDE_APPS |
51 POWER_ACTION_DISABLE_WAKES |
52 POWER_ACTION_CRITICAL);
53 }
54
55 /* EOF */