16.8.1.3 HardwareDatabase and the System DeviceMap
Higher-level NT drivers also can use the pointer at DriverObject->HardwareDatabase, which identifies the key \Registry\Machine\Hardware as shown in Figure 16.6, to get information from or to set information in a driver-created subkey under \Registry\Machine\Hardware\DeviceMap.
All driver-created subkeys of DeviceMap are volatile: that is, they are recreated every time the system boots. Any NT driver can supply driver-determined value entries in its DeviceMap subkey. Thus, an NT driver can set up a subkey under the DeviceMap containing any information that the driver writer chooses.
Usually, such a subkey supplies information to be consumed by a higher-level driver or that is useful to a system administrator or end user. For example, the NT video port driver sets up aliases between its device objects’ names and the type of video adapter each represents. Such an alias might appear in the registry as something like the following:
\Device\Video0:REG_SZ:\REGISTRY\Machine\System\ControlSet001
\Services\Vga\Device0
The system serial driver supplies a mapping between the generic NT names of its device objects and the corresponding Win32 names for serial ports. Such a mapping might appear in the registry as the following value entry:
Serial0:REG_SZ:COM1
While the NT I/O Manager’s generic naming scheme for device objects, as mentioned in Section 16.8.1.1, is designed to create a set of unique names for every device object that can be the target of an I/O request in any particular machine, end users and/or user-mode applications running within a protected subsystem generally use subsystem-specific device names to request I/O operations. For more information about setting up symbolic links between device object names and user-mode names for the same devices, see Section 16.9.1.
NT device drivers can get information from and must set information in the registry along the HardwareDatabase registry path. Device drivers get hardware configuration information, collected by the ARC or NtDetect component, under the key \Registry\Machine\Hardware\Description. They must set configuration information about the hardware resources claimed for their device(s) under the key \Registry\Machine\Hardware\ResourceMap, as explained in Sections 16.8.2 and 16.8.3, respectively.