2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * FILE: ntoskrnl/ex/power.c
5 * PURPOSE: Power managment
6 * PROGRAMMER: David Welch (welch@cwcom.net)
9 * Added reboot support 30/01/99
12 /* INCLUDES *****************************************************************/
15 #include <internal/debug.h>
17 /* FUNCTIONS *****************************************************************/
20 NtSetSystemPowerState(IN POWER_ACTION SystemAction
,
21 IN SYSTEM_POWER_STATE MinSystemState
,
24 /* Windows 2000 only */
25 return(STATUS_NOT_IMPLEMENTED
);
32 NtShutdownSystem(IN SHUTDOWN_ACTION Action
)
34 static PCH FamousLastWords
[] =
36 "Oh my God, they killed Kenny! Those bastards!\n",
37 "Goodbye, and thanks for all the fish\n",
38 "I think you ought to know I'm feeling very depressed\n",
39 "I'm not getting you down at all am I?\n",
41 "It's the same series of signal over and over again!\n",
42 "Pie Iesu Domine, dona eis requiem\n",
43 "Wandering stars, for whom it is reserved;\n"
44 "the blackness and darkness forever.\n",
45 "Your knees start shakin' and your fingers pop\n"
46 "Like a pinch on the neck from Mr. Spock!\n",
47 "It's worse than that ... He's dead, Jim\n"
51 if (Action
> ShutdownPowerOff
)
52 return STATUS_INVALID_PARAMETER
;
54 ZwQuerySystemTime(&Now
);
55 Now
.u
.LowPart
= Now
.u
.LowPart
>> 8; /* Seems to give a somewhat better "random" number */
57 IoShutdownRegisteredDevices();
59 IoShutdownRegisteredFileSystems();
61 PiShutdownProcessManager();
62 MiShutdownMemoryManager();
64 if (Action
== ShutdownNoReboot
)
66 HalReleaseDisplayOwnership();
67 HalDisplayString(FamousLastWords
[Now
.u
.LowPart
% (sizeof(FamousLastWords
) / sizeof(PCH
))]);
70 HalReturnToFirmware (FIRMWARE_OFF
);
72 PopSetSystemPowerState(PowerSystemShutdown
);
76 Ke386DisableInterrupts();
81 else if (Action
== ShutdownReboot
)
83 HalReturnToFirmware (FIRMWARE_REBOOT
);
87 HalReturnToFirmware (FIRMWARE_HALT
);
90 return STATUS_SUCCESS
;