Bewerken

Delen via


WmiFireEvent function (wmilib.h)

The WmiFireEvent routine sends an event to WMI for delivery to data consumers that have requested notification of the event.

Syntax

NTSTATUS WmiFireEvent(
  [in]           PDEVICE_OBJECT DeviceObject,
  [in]           LPCGUID        Guid,
  [in]           ULONG          InstanceIndex,
  [in]           ULONG          EventDataSize,
  [in, optional] PVOID          EventData
);

Parameters

[in] DeviceObject

A pointer to the driver's DEVICE_OBJECT.

[in] Guid

A pointer to the GUID that represents the event block.

[in] InstanceIndex

If the event block has multiple instances, specifies the index of the instance.

[in] EventDataSize

Specifies the number of bytes of data at EventData. If no data is generated for an event, EventData must be zero.

[in, optional] EventData

A pointer to a driver-allocated nonpaged buffer containing data generated by the driver for the event. If no data is generated for an event, EventData must be NULL. WMI frees the buffer without further intervention by the driver.

Return value

WmiFireEvent propagates the status returned by IoWmiWriteEvent, or returns STATUS_INSUFFICIENT_RESOURCES if it could not allocate memory for the event.

Remarks

A driver calls WmiFireEvent to send an event to WMI for delivery to all data consumers that have requested notification of the event. All pointers passed to WmiFireEvent must point to nonpagable memory, such as nonpaged pool.

The driver sends an event only if it has been previously enabled by the driver's DpWmiFunctionControl routine, which WMI calls to process an IRP_MN_ENABLE_EVENT request.

The driver writes any data associated with the event to the buffer at EventData. WMI fills in a WNODE_SINGLE_INSTANCE structure with the data and calls IoWmiWriteEvent to deliver the event.

For more information about event tracing, see WMI Event Tracing.

Requirements

Requirement Value
Minimum supported client Available starting with Windows 2000.
Target Platform Universal
Header wmilib.h (include Wmilib.h)
Library Wmilib.lib
IRQL <= DISPATCH_LEVEL

See also

DpWmiFunctionControl

IRP_MN_ENABLE_EVENTS

WmiSystemControl