Author: cgutman Date: Fri Aug 20 02:27:05 2010 New Revision: 48572
URL: http://svn.reactos.org/svn/reactos?rev=48572&view=rev Log: [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
Modified: trunk/reactos/ntoskrnl/include/internal/po.h trunk/reactos/ntoskrnl/po/events.c trunk/reactos/ntoskrnl/po/power.c
Modified: trunk/reactos/ntoskrnl/include/internal/po.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/p... ============================================================================== --- trunk/reactos/ntoskrnl/include/internal/po.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/include/internal/po.h [iso-8859-1] Fri Aug 20 02:27:05 2010 @@ -6,6 +6,7 @@ * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org) */
+#include "initguid.h" #include <poclass.h>
//
Modified: trunk/reactos/ntoskrnl/po/events.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/po/events.c?rev=48... ============================================================================== --- trunk/reactos/ntoskrnl/po/events.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/po/events.c [iso-8859-1] Fri Aug 20 02:27:05 2010 @@ -79,6 +79,15 @@ 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 */
Modified: trunk/reactos/ntoskrnl/po/power.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/po/power.c?rev=485... ============================================================================== --- trunk/reactos/ntoskrnl/po/power.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/po/power.c [iso-8859-1] Fri Aug 20 02:27:05 2010 @@ -136,10 +136,20 @@ /* 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, + IopRootDeviceNode-> + PhysicalDeviceObject->DriverObject, + PopAddRemoveSysCapsCallback, + NULL, + &NotificationEntry); + + /* Register lid notification */ + IoRegisterPlugPlayNotification(EventCategoryDeviceInterfaceChange, + PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES, + (PVOID)&GUID_DEVICE_LID, IopRootDeviceNode-> PhysicalDeviceObject->DriverObject, PopAddRemoveSysCapsCallback,