71 SysButton = *(
PULONG)
Irp->AssociatedIrp.SystemBuffer;
73 DPRINT1(
"A device reported the event 0x%x (", SysButton);
77 if (SysButton == 0)
DbgPrint(
" WAKE");
83 DPRINT1(
"Initiating shutdown after power button event\n");
91 if (!SysButtonContext->WorkItem)
93 DPRINT(
"IoAllocateWorkItem() failed\n");
124 &SysButtonContext->
Event,
138 DPRINT1(
"IoBuildDeviceIoControlRequest() failed\n");
164 DPRINT(
"PopAddRemoveSysCapsCallback(%p %p)\n",
203 DPRINT1(
"ZwOpenFile() failed with status 0x%08lx\n",
Status);
214 DPRINT1(
"ObReferenceObjectByHandle() failed with status 0x%08lx\n",
Status);
234 DPRINT1(
"IoBuildDeviceIoControlRequest() failed\n");
241 DPRINT(
"IOCTL_GET_SYS_BUTTON_CAPS pending\n");
247 DPRINT1(
"Sending IOCTL_GET_SYS_BUTTON_CAPS failed with status 0x%08x\n",
Status);
252 DPRINT(
"Device capabilities: 0x%x\n", Caps);
255 DPRINT(
"POWER button present\n");
261 DPRINT(
"SLEEP button present\n");
274 if (!SysButtonContext)
276 DPRINT1(
"ExAllocatePoolWithTag() failed\n");
286 DPRINT1(
"IoAllocateWorkItem() failed\n");
301 DPRINT1(
"Removal of a power capable device not implemented\n");
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
#define STATUS_NOT_IMPLEMENTED
#define NT_SUCCESS(StatCode)
const GUID GUID_DEVICE_INTERFACE_ARRIVAL
const GUID GUID_DEVICE_INTERFACE_REMOVAL
#define ExAllocatePoolWithTag(hernya, size, tag)
#define KeRaiseIrql(irql, oldIrql)
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
#define RtlCompareMemory(s1, s2, l)
#define KeInitializeEvent(pEvt, foo, foo2)
#define KeLowerIrql(oldIrql)
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE FileHandle
NTSTATUS(NTAPI * PKWIN32_POWEREVENT_CALLOUT)(_In_ struct _WIN32_POWEREVENT_PARAMETERS *Parameters)
#define OBJ_KERNEL_HANDLE
POBJECT_TYPE IoFileObjectType
VOID NTAPI IoQueueWorkItem(IN PIO_WORKITEM IoWorkItem, IN PIO_WORKITEM_ROUTINE WorkerRoutine, IN WORK_QUEUE_TYPE QueueType, IN PVOID Context)
VOID NTAPI IoFreeWorkItem(IN PIO_WORKITEM IoWorkItem)
PIO_WORKITEM NTAPI IoAllocateWorkItem(IN PDEVICE_OBJECT DeviceObject)
#define IoSetCompletionRoutine(_Irp, _CompletionRoutine, _Context, _InvokeOnSuccess, _InvokeOnError, _InvokeOnCancel)
#define ExFreePoolWithTag(_P, _T)
static OUT PIO_STATUS_BLOCK IoStatusBlock
#define InitializeObjectAttributes(p, n, a, r, s)
NTSYSAPI NTSTATUS NTAPI ZwShutdownSystem(_In_ SHUTDOWN_ACTION Action)
NTSYSAPI NTSTATUS NTAPI ZwOpenFile(_Out_ PHANDLE FileHandle, _In_ ACCESS_MASK DesiredAccess, _In_ POBJECT_ATTRIBUTES ObjectAttributes, _Out_ PIO_STATUS_BLOCK IoStatusBlock, _In_ ULONG ShareAccess, _In_ ULONG OpenOptions)
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
VOID NTAPI ExNotifyCallback(IN PCALLBACK_OBJECT CallbackObject, IN PVOID Argument1, IN PVOID Argument2)
PDEVICE_OBJECT NTAPI IoGetRelatedDeviceObject(IN PFILE_OBJECT FileObject)
PIRP NTAPI IoBuildDeviceIoControlRequest(IN ULONG IoControlCode, IN PDEVICE_OBJECT DeviceObject, IN PVOID InputBuffer, IN ULONG InputBufferLength, IN PVOID OutputBuffer, IN ULONG OutputBufferLength, IN BOOLEAN InternalDeviceIoControl, IN PKEVENT Event, IN PIO_STATUS_BLOCK IoStatusBlock)
struct _SYS_BUTTON_CONTEXT SYS_BUTTON_CONTEXT
struct _SYS_BUTTON_CONTEXT * PSYS_BUTTON_CONTEXT
static VOID NTAPI PopGetSysButton(IN PDEVICE_OBJECT DeviceObject, IN PVOID Context)
PCALLBACK_OBJECT SetSystemTimeCallback
NTSTATUS NTAPI PopAddRemoveSysCapsCallback(IN PVOID NotificationStructure, IN PVOID Context)
static NTSTATUS NTAPI PopGetSysButtonCompletion(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context)
PKWIN32_POWEREVENT_CALLOUT PopEventCallout
VOID NTAPI PoNotifySystemTimeSet(VOID)
#define STATUS_REVISION_MISMATCH
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
enum _POP_POLICY_DEVICE_TYPE POP_POLICY_DEVICE_TYPE
SYSTEM_POWER_CAPABILITIES PopCapabilities
#define IOCTL_GET_SYS_BUTTON_CAPS
#define IOCTL_GET_SYS_BUTTON_EVENT
BOOLEAN PowerButtonPresent
BOOLEAN SystemBatteriesPresent
BOOLEAN SleepButtonPresent
IO_STATUS_BLOCK IoStatusBlock
PDEVICE_OBJECT DeviceObject
#define STATUS_INVALID_PARAMETER
#define STATUS_INSUFFICIENT_RESOURCES
_In_ PWDFDEVICE_INIT _In_ PFN_WDF_DEVICE_SHUTDOWN_NOTIFICATION Notification
_In_ PDEVICE_OBJECT DeviceObject
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
_In_ PVOID NotificationStructure
struct _DEVICE_INTERFACE_CHANGE_NOTIFICATION * PDEVICE_INTERFACE_CHANGE_NOTIFICATION
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
#define ObDereferenceObject