Defining Classes for the Registry Provider

[This is preliminary documentation and subject to change.]

Management applications using the Registry Provider define classes with properties that represent registry data for particular keys and store the classes in the CIMOM repository. The classes are defined with several standard qualifiers. The particular qualifiers and their placement depends on whether the Registry Provider is used as an instance provider or a property provider.

The Dynamic qualifier can be attached to either a class or an instance and marks the class or instance as being 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 is responsible for managing the dynamic class or instance.

The ClassContext qualifier is attached to a class and 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. For example, the following ClassContext qualifier contains the path to a particular machine's transport devices:

Machine_Name | HKEY_LOCAL_MACHINE\\SOFTWARE\\MICROSOFT\\WBEM
\\CIMOM\\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 Registry Provider. Note that registry paths are case insensitive, as are qualifier names.

[dynamic, provider("RegProv"), ClassContext("localhkey_local_machine\\software\\microsoft\\WBEM\\
cimom\\transports")]

class RegistryTransports
{
  //properties of the class
};

Management applications can use the Registry Provider to retrieve and modify registry data for a particular key. To use the Registry Provider as a property provider, applications define classes that are marked with the DynProps, Provider, and PropertyText 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. Expression is also optional and is used for resource descriptor data.

The following class uses the Registry Provider as a property provider to maintain its non-key properties:

[DYNPROPS]
class PropReg {

    [read, write, KEY] 
         STRING  MyKey;
    [read, write] 
         STRING Logging;
    [read, write]
         STRING Events;
         uint32 Resource1;
         uint32 Resource2;
};

[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;

  [PropertyContext("local|hkey_local_Machine\\hardware\\
   ResourceMap\\Hardware Abstraction Layer\\PC Compatible Eisa/isa
   hal|.raw(\"Internal\",0,0,\"interrupt.vector\")"), Dynamic, 
   Provider("RegPropProv")]
   Resource2;
};