Storing Hardware Configuration Parameters

Kernel-mode drivers generally require hardware configuration parameters, such a device’s interrupt number and DMA channel, that must be supplied by a system administrator. The user-mode driver obtains values for these parameters by displaying a dialog box in response to a DRV_CONFIGURE message. The user-mode driver stores the parameter values in the Windows NT Registry, where they are accessible to the kernel-mode driver.

Because kernel-mode drivers are treated as services under Windows NT, their parameters are stored under the registry’s \Services key. The path to the \Services key is HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services.

Under \Services, there is a subkey for each installed kernel-mode driver. For multimedia drivers, the registry structure is as follows:

    HKEY_LOCAL_MACHINE
        SYSTEM
            CurrentControlSet
                Services
                    DriverName
                            Type
                            Group
                            ErrorControl
                            Start
                            Tag
                         Parameters
                            Device0
                                    Interrupt
                                    Port
                                    DMA Channel
                                    (Etc.)
                            Device1
                                    Interrupt
                                    Port
                                    DMA Channel
                                    (Etc.)

The Service Control Manager creates and maintains DriverName, along with the Type, Group, ErrorControl, Start, and Tag subkeys. User-mode multimedia drivers provide the Parameters and underlying subkeys, as necessary. Use the Interrupt, Port, and DMA Channel value names to store interrupt levels, port addresses, and DMA channels.

Drivers can create and modify registry key values by calling Win32 functions, or by using functions provided in the driver support libraries. The support libraries are described in the chapters discussing the various driver types. The chapters are listed in Types of Multimedia Devices.