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 */
BOOLEAN Arrival;
ULONG Caps;
NTSTATUS Status;
+ UNICODE_STRING DeviceName;
+ UNICODE_STRING DeviceNamePrefix = RTL_CONSTANT_STRING(L"\\??\\");
DPRINT("PopAddRemoveSysCapsCallback(%p %p)\n",
NotificationStructure, Context);
{
DPRINT("Arrival of %wZ\n", Notification->SymbolicLinkName);
+ DeviceName.Length = 0;
+ DeviceName.MaximumLength = Notification->SymbolicLinkName->MaximumLength + DeviceNamePrefix.MaximumLength;
+ DeviceName.Buffer = ExAllocatePool(PagedPool, DeviceName.MaximumLength);
+ if (!DeviceName.Buffer) return STATUS_INSUFFICIENT_RESOURCES;
+
+ RtlCopyUnicodeString(&DeviceName, &DeviceNamePrefix);
+ RtlAppendUnicodeStringToString(&DeviceName, Notification->SymbolicLinkName);
+
+ DPRINT("Opening handle to %wZ\n", &DeviceName);
+
/* Open the device */
InitializeObjectAttributes(
&ObjectAttributes,
- Notification->SymbolicLinkName,
+ &DeviceName,
OBJ_KERNEL_HANDLE,
NULL,
NULL);