Handling WMI Requests
All drivers must set a dispatch table entry point for a DispatchSystemControl routine to handle WMI requests. If a driver registers as a WMI data provider, it must handle all WMI requests. Otherwise, the driver must forward all WMI requests to the next lower driver.
All WMI IRPs have the major code IRP_MJ_SYSTEM_CONTROL and a one of the following minor codes:
IRP_MN_ENABLE_COLLECTION, IRP_MN_DISABLE_COLLECTION—Requests the driver to start accumulating data for a block that the driver registered as expensive to collect, or to stop accumulating data for such a block.
IRP_MN_ENABLE_EVENTS, IRP_MN_DISABLE_EVENTS—Requests the driver to start sending notification of a given event if the event occurs while it is enabled, or to stop sending notification of such an event.
IRP_MN_EXECUTE_METHOD—Requests the driver to execute a method associated with a data block.
The WMI kernel-mode component sends WMI IRPs any time following a driver's successful registration as a WMI data provider, typically when a user-mode data consumer has requested WMI information for a driver's device. If a driver registers as a WMI data provider by calling IoWMIRegistrationControl, it must handle each subsequent WMI request in one of the following ways:
Call the kernel-mode WMI library routine WmiSystemControl. A driver can call WmiSystemControl to handle requests concerning only blocks that do not use dynamic instance names, and that base static instance names on a single base name string or the device instance ID of a PDO. For more information, see Calling WmiSystemControl to Handle WMI IRPs.
In its DispatchSystemControl routine, process and complete any such request tagged with the pointer to its device object that the driver passed in its call to IoWMIRegistrationControl, and forward other IRP_MJ_SYSTEM_CONTROL requests to the next lower driver. For more information, see Processing WMI IRPs in a DispatchSystemControl Routine.
For a list of the WMI minor IRPs, see WMI Minor IRPs.