The IOCTL_PMI_REGISTER_EVENT_NOTIFY request registers the IOCTL initiator to be notified about a power meter event. When the event occurs, the Power Meter Interface (PMI) completes the IOCTL request and returns information about the event.
The AssociatedIrp.SystemBuffer member of the I/O request packet (IRP) points to an initiator-allocated input buffer that contains a PMI_EVENT structure.
Input Buffer Length
The Parameters.DeviceIoControl.InputBufferLength member of the IRP's current I/O stack location (IO_STACK_LOCATION) is set to the size in bytes of the input buffer that is pointed to by the AssociatedIrp.SystemBuffer member. This size must be greater than or equal to sizeof(PMI_EVENT) or the request will fail with an error status of STATUS_BUFFER_TOO_SMALL.
Output Buffer Length
The Information member is set to the size, in bytes, of a PMI_EVENT structure.
The Status member is set to one of the following values:
PMI creates an event notification queue for each initiator that opens the device instance for a power meter by using the CreateFile function. A separate queue is created for each caller's connection to a device instance. The following points apply to the event notification queue:
When PMI creates the event notification queue, the queue is empty. After the queue is created, PMI sends events to the caller after the caller has registered for event notification by using the IOCTL_PMI_REGISTER_EVENT_NOTIFY request.
If the event notification queue is empty when the caller registers, the IOCTL_PMI_REGISTER_EVENT_NOTIFY request remains pending until either an event occurs or the device instance connection is broken through the CloseFile function.
After the event notification queue is created, the queue will contain unsent events for the caller. This prevents callers from missing events during the interval between when the driver processes one event and the caller registers for another. If there are events in the caller's queue, they are sent immediately after the caller registers by using an IOCTL_PMI_REGISTER_EVENT_NOTIFY request.
For more information about the CreateFile and CloseFile functions, refer to the Windows SDK documentation.
|Windows version||Available in Windows 7, Windows Server 2008 R2, and later versions of the Windows operating systems.|
|Header||pmi.h (include Pmi.h)|