mirror of
https://github.com/reactos/reactos.git
synced 2025-01-01 12:04:51 +00:00
[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:
parent
ab9dae987d
commit
62f520433c
3 changed files with 21 additions and 1 deletions
|
@ -6,6 +6,7 @@
|
|||
* PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
|
||||
*/
|
||||
|
||||
#include "initguid.h"
|
||||
#include <poclass.h>
|
||||
|
||||
//
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue