[NTOSKRNL]

- Shutdown the system if we receive a SYS_BUTTON_POWER event
- Register for GUID_DEVICE_LID arrival events so we can receive lid events

svn path=/trunk/; revision=48572
This commit is contained in:
Cameron Gutman 2010-08-20 02:27:05 +00:00
parent ab9dae987d
commit 62f520433c
3 changed files with 21 additions and 1 deletions

View file

@ -6,6 +6,7 @@
* PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
*/
#include "initguid.h"
#include <poclass.h>
//

View file

@ -79,6 +79,15 @@ PopGetSysButtonCompletion(
if (SysButton & SYS_BUTTON_LID) DbgPrint(" LID");
if (SysButton == 0) DbgPrint(" WAKE");
DbgPrint(" )\n");
if (SysButton & SYS_BUTTON_POWER)
{
/* FIXME: Read registry for the action we should perform here */
DPRINT1("Initiating shutdown after power button event\n");
ZwShutdownSystem(ShutdownNoReboot);
}
}
/* Allocate a new workitem to send the next IOCTL_GET_SYS_BUTTON_EVENT */

View file

@ -136,7 +136,7 @@ PoInitSystem(IN ULONG BootPhase)
/* Check if this is phase 1 init */
if (BootPhase == 1)
{
/* Registry power button notification */
/* Register power button notification */
IoRegisterPlugPlayNotification(EventCategoryDeviceInterfaceChange,
PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES,
(PVOID)&GUID_DEVICE_SYS_BUTTON,
@ -145,6 +145,16 @@ PoInitSystem(IN ULONG BootPhase)
PopAddRemoveSysCapsCallback,
NULL,
&NotificationEntry);
/* Register lid notification */
IoRegisterPlugPlayNotification(EventCategoryDeviceInterfaceChange,
PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES,
(PVOID)&GUID_DEVICE_LID,
IopRootDeviceNode->
PhysicalDeviceObject->DriverObject,
PopAddRemoveSysCapsCallback,
NULL,
&NotificationEntry);
return TRUE;
}