Bewerken

Delen via


WdfWmiInstanceFireEvent function (wdfwmi.h)

[Applies to KMDF only]

The WdfWmiInstanceFireEvent method sends a WMI event to WMI clients that have registered to receive event notification.

Syntax

NTSTATUS WdfWmiInstanceFireEvent(
  [in]           WDFWMIINSTANCE WmiInstance,
  [in, optional] ULONG          EventDataSize,
  [in, optional] PVOID          EventData
);

Parameters

[in] WmiInstance

A handle to a WMI instance object that the driver obtained from a previous call to WdfWmiInstanceCreate.

[in, optional] EventDataSize

The size, in bytes, of the event data that EventData points to.

[in, optional] EventData

A pointer to the event data, or NULL if there is no event data.

Return value

WdfWmiInstanceFireEvent returns STATUS_SUCCESS if the operation succeeds. Otherwise, this method might return one of the following values:

Return code Description
STATUS_INSUFFICIENT_RESOURCES
There was insufficient memory.
STATUS_UNSUCCESSFUL
The framework's attempt to communicate with WMI failed.
STATUS_BUFFER_OVERFLOW
The event data buffer was too large.
 

This method also might return other NTSTATUS values.

A bug check occurs if the driver supplies an invalid object handle.

Remarks

Your driver should call WdfWmiInstanceFireEvent only if a WMI client has registered for event notification. The driver can determine if it should call WdfWmiInstanceFireEvent by providing an EvtWmiProviderFunctionControl callback function or calling WdfWmiProviderIsEnabled.

The driver should place its event-specific data, if any, in the buffer that the EventData parameter points to. The framework adds all of the necessary WMI header information.

For more information about the WdfWmiInstanceFireEvent method, see Supporting WMI in Framework-Based Drivers.

Examples

The following code example sends a WMI event to WMI clients.

MY_WMI_EVENT_DATA eventData;
NTSTATUS  status;

status = WdfWmiInstanceFireEvent(
                                 WmiInstance,
                                 sizeof(eventData),
                                 (PVOID)&eventData
                                 );

Requirements

Requirement Value
Target Platform Universal
Minimum KMDF version 1.0
Header wdfwmi.h (include Wdf.h)
Library Wdf01000.sys (see Framework Library Versioning.)
IRQL <= APC_LEVEL
DDI compliance rules DriverCreate(kmdf), KmdfIrql(kmdf), KmdfIrql2(kmdf), KmdfIrqlExplicit(kmdf)

See also

EvtWmiProviderFunctionControl

WdfWmiInstanceCreate

WdfWmiProviderIsEnabled