Defining a Registry Class With Qualifiers

The classes used to hold registry data are defined with several standard qualifiers.

The following is a list of the standard qualifiers:

  • Dynamic and Provider

    You can attach the Dynamic qualifier to either a class or an instance. The Dynamic qualifier marks the class or instance as managed dynamically by a provider. When Dynamic appears on a class or instance, the Provider qualifier must also appear. The Provider qualifier identifies the particular provider that must manage the dynamic class or instance.

  • ClassContext

    The ClassContext qualifier is attached to a class. It specifies the path to the registry key that contains the information the class represents.

    The ClassContext qualifier has the following format.

    MACHINE_NAME|Subtree\\KeyPath
    

    The value for KeyPath can be long if it includes keys with subkeys.

    The following example shows the ClassContext qualifier that contains the path to a particular computer transport device.

    Machine_Name|HKEY_LOCAL_MACHINE\\SOFTWARE\\MICROSOFT\\WBEM\\TRANSPORTS
    

The following template for a class definition illustrates the use of the Dynamic, Provider, and ClassContext qualifiers. The provider named by the Provider qualifier is the instance System Registry provider. Be aware that registry paths are case-insensitive, as are qualifier names.


[dynamic, provider("RegProv"), 
    ClassContext("local|hkey_local_machine\\software\\microsoft
    \\WBEM\\transports\\Network Transport Modules")]

class RegTrans
{
  [key] string  TransportsGUID;
  [PropertyContext("Name")] string Name;
  [PropertyContext("Independent")] uint32 Enabled;
};

Management applications can also use the System Registry provider to retrieve and modify registry data for a particular key.

 

 

Show: