Registry Key Objects

The PortCls system driver implements the IRegistryKey interface for the benefit of miniport drivers. An IRegistryKey object represents a registry key. Miniport drivers use registry key objects to do the following:

  • Create and delete registry keys

  • Enumerate registry keys

  • Query and set registry keys

When querying a registry key object for information about a registry entry under the specified key, the query can output the information in one of three formats, each of which uses a different key-query structure. The following table shows the KEY_INFORMATION_CLASS enumeration values that indicate which of the three key-query structures is output by the query.

KEY_INFORMATION_CLASS Value Key-Query Structure

KeyBasicInformation

KEY_BASIC_INFORMATION

KeyFullInformation

KEY_FULL_INFORMATION

KeyNodeInformation

KEY_NODE_INFORMATION

To open an existing registry key or create a new registry key, an adapter driver can call the PcNewRegistryKey function, and a miniport driver can call the port driver's IPort::NewRegistryKey method. The two calls are similar, except that the PcNewRegistryKey function requires two additional parameters, DeviceObject and SubDevice. For more information, see PcNewRegistryKey.

When a miniport driver creates a new IRegistryKey object, the object either opens an existing subkey or creates a new registry subkey if none exists. In either case, the registry key object stores the handle to the key. When that object is later released and its reference count decrements to zero, the object automatically closes its handle to the key.

The IRegistryKey interface supports the following methods:

IRegistryKey::DeleteKey

IRegistryKey::EnumerateKey

IRegistryKey::EnumerateValueKey

IRegistryKey::NewSubKey

IRegistryKey::QueryKey

IRegistryKey::QueryRegistryValues

IRegistryKey::QueryValueKey

IRegistryKey::SetValueKey