Use the System Registry Provider as a Property Provider

You can use the System Registry Provider as either an instance or a property provider.

If you choose to access the property provider interfaces, you must mark your WMI classes to indicate your intention.

To use the system registry provider as a property provider

  • Define your WMI class with the DynProps, Provider, and PropertyContext standard qualifiers.

    The DynProps qualifier identifies a class as having properties that are maintained by the property provider identified by the Provider qualifier. The PropertyContext qualifier specifies the name of the registry value to be stored by the property. The format of the PropertyContext qualifier is the same as the format of the ClassContext qualifier with additional valuename and expression values.

    MACHINE_NAME | Subtree\\KeyPath [|valuename [expression]]
    

    Both valuename and expression are optional. The valuename setting is only used if the registry value has a name. The expression is also optional and is used for resource descriptor data. For more information, see Describing a Resource for the Registry.

    The following code example shows how the class uses the System Registry provider as a property provider to maintain its nonkey properties.

    [DYNPROPS]
    class PropReg {
    
        [KEY]  STRING  MyKey;
        STRING Logging;
        STRING Events;
        uint32 Resource1;
    };
    
    [DYNPROPS]
    instance of PropReg
    {
      MyKey = "a";
    
      [PropertyContext("local|hkey_local_Machine\\software\\microsoft\\
       wbem\\cimom|Logging"), Dynamic, Provider("RegPropProv")]  Logging;
    
      [PropertyContext("local|hkey_local_Machine\\software\\microsoft\\
       wbem\\cimom|EnableEvents"), Dynamic, Provider("RegPropProv")]
       Events;
    
      [PropertyContext("local|hkey_local_Machine\\hardware\\
       ResourceMap\\Hardware Abstraction Layer\\PC Compatible Eisa/isa 
       hal|.raw(\"Internal\")(0)(0)(\"interrupt.vector\")"), Dynamic, 
       Provider("RegPropProv")]  Resource1;
    };