WMI Registration Flags

A driver indicates whether a block uses static or dynamic instance names and specifies other characteristics of the block by setting flags in the WMIGUIDREGINFO or WMIREGGUID structure that it passes to WMI to register the block.

A driver indicates that a block uses static instance names by setting one of the following flags:

  • WMIREG_FLAG_INSTANCE_LIST indicates that the driver provides all instance names in a static list.

    A driver can set this flag only if it registers blocks by handling the IRP_MN_REGINFO or IRP_MN_REGINFO_EX requests, not by calling WmiSystemControl. The driver writes the instance name strings at the byte offset indicated by InstanceNameList in the block's WMIREGGUID structure.

  • WMIREG_FLAG_INSTANCE_BASENAME instructs WMI to generate static instance names from a driver-defined base name string.

    A driver that handles an IRP_MN_REGINFO or IRP_MN_REGINFO_EX request writes the base name string at the offset indicated by BaseNameOffset in the block's WMIREGGUID structure.

    A driver that calls WmiSystemControl specifies the base name string in the InstanceName parameter of its DpWmiQueryReginfo routine.

  • WMIREG_FLAG_INSTANCE_PDO instructs WMI to generate static instance names from the device instance ID of the driver's PDO.

    A driver that handles an IRP_MN_REGINFO or IRP_MN_REGINFO_EX request writes a pointer to the PDO at the Pdo member of the block's WMIREGGUID structure. If the request is IRP_MN_REGINFO_EX, the driver must increase the reference count on each PDO passed by calling the ObReferenceObject routine. (The system will dereference each PDO later.)

    A driver that calls WmiSystemControl writes a pointer to the PDO in the Pdo parameter of its DpWmiQueryReginfo routine.

To indicate that a block uses dynamic instance names, the driver must not set any of the following flags: WMIREG_FLAG_INSTANCE_LIST, WMIREG_FLAG_INSTANCE_PDO, or WMIREG_FLAG_INSTANCE_BASENAME.

A driver indicates that a data block is expensive to collect by setting WMIREG_FLAG_EXPENSIVE. This instructs WMI to send an IRP_MN_ENABLE_COLLECTION request the first time a WMI client opens the data block and an IRP_MN_DISABLE_COLLECTION request when the last WMI client closes the block. The driver need not collect data for such a block until it receives an IRP_MN_ENABLE_COLLECTION request.

A driver indicates an event block by setting WMIREG_FLAG_EVENT_ONLY_GUID. This indicates that the block can be enabled or disabled as an event only, and cannot be queried or set.

A driver instructs WMI to remove a previously registered block by setting WMIREG_FLAG_REMOVE_GUID. This flag is valid only in response to a request to update registration information (IRP_MN_REGINFO or IRP_MN_REGINFO_EX with WMIUPDATE). For more information, see Updating WMI Registration Information.