Using the WMI Library to Register Blocks

A driver can use the WMI Library to handle IRP_MN_REGINFO and IRP_MN_REGINFO_EX requests if it is registering blocks that do not use dynamic instance names, or that use static instance names based on a PDO or driver-defined base name string. In this case, the driver:

  1. Calls WmiSystemControl with a pointer to the driver's device object, a pointer to a WMILIB_CONTEXT structure, and a pointer to the IRP

    The WMILIB_CONTEXT structure indicates the number of blocks to register (GuidCount) and points to a list of WMIGUIDREGINFO structures (GuidList) that specify the GUID, the number of instances, and registration flags that pertain to the corresponding block. It also defines entry points for the driver's required and optional DpWmiXxx callback routines.

  2. When WMI calls the driver's DpWmiQueryReginfo routine, the driver specifies the driver's registry path, its MOF resource name, registration flags that pertain to all of its blocks, and information that WMI uses to name instances of the driver's data blocks, which could be either a pointer to the physical device object passed to the driver's AddDevice routine or a string on which to base static instance names.

A driver must initialize entry points for its DpWmiXxx callback routines in the WMILIB_CONTEXT structure before calling WmiSystemControl, but can postpone initialization of GuidCount and GuidList in the WMILIB_CONTEXT structure until WMI calls the driver's DpWmiQueryReginfo routine.