Setting Properties and Registry Values
Collapse the table of content
Expand the table of content

Setting Properties and Registry Values

The Setting Properties and Registry Values topic describes how a Port Class audio driver can set properties and registry values for a PnP device interface.

The port class audio driver, Portcls must perform the following steps to properly register the device interface and set required values.

1. Register the device interface

Before calling PcRegisterSubdevice for the sub-device, the driver can directly call IoRegisterDeviceInterface to register the KSCATEGORY_AUDIO interface. This gives the driver a chance to set interface properties and registry values on the device interfaces before PcRegisterSubdevice registers and enables the interfaces.

The audio driver sets the parameters for IoRegisterDeviceInterface as follows.

  • The PhysicalDeviceObject parameter is the PDEVICE_OBJECT that the audio driver can retrieve from the PcGetPhysicalDeviceObject function.

  • The InterfaceClassGuid is set to the interface’s class GUID.

  • The ReferenceString is the same as the Name parameter that the audio driver passes to PcRegisterSubdevice.

After the preceding tasks are completed successfully, IoRegisterDeviceInterface returns a SymbolicLinkName for the registered interface.

2. Set registry values

The audio driver calls IoOpenDeviceInterfaceRegistryKey to obtain a handle to the device interface registry key. The audio driver sets the parameters to IoOpenDeviceInterfaceRegistryKey as follows.

The SymbolicLinkName is the string returned from IoRegisterDeviceInterface in the previous step.

The DesiredAccess is set to KEY_WRITE (or other values if needed by the driver).

After the preceding steps are completed successfully, DeviceInterfaceKey returns the opened registry key handle. The audio driver:

  • Calls ZwSetValueKey to set registry values

  • Closes the registry key handle by calling ZwClose

Note  If the driver needs to set values in a registry subkey, then the driver calls ZwCreateKey to create the subkey. When preparing to call ZwCreateKey, the driver:
  • Calls InitializeObjectAttributes, and sets the ObjectName to the subkey path

  • Sets Attributes to OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE

  • Sets RootDirectory to the handle returned by IoOpenDeviceInterfaceRegistryKey

  • Calls ZwClose to close any handle created by calling ZwCreateKey

 

3. Set properties

The audio driver calls IoSetDeviceInterfacePropertyData to set properties. The audio driver sets the parameters to IoSetDeviceInterfacePropertyData as follows: The SymbolicLinkName is the string returned from IoRegisterDeviceInterface. The remaining parameters depend on the specific property being set.

Related topics

Related Design Guidelines

 

 

Send comments about this topic to Microsoft

Show:
© 2016 Microsoft