How do Windows NT-based operating systems address devices?
I'm confused with notation like
multi(0)disk(0)rdisk(0)partition(1)\...
and
\Device\HardDisk1\DR1 \Device\Video0
I see these addresses only in the context of Windows NT-based operating systems such as Windows XP and Windows 7. What do these addresses mean and how are they used to refer to devices such as hard disks, graphics adapters, human interface devices (keyboards, mice, etc.), network adapters, and other hardware?
Contrary to popular belief, the Windows kernel does have a rooted file ("file") system. In *nix, the root is /
, and in Windows it's \
. The Win32 subsystem doesn't expose it, though. You can explore it with WinObj.
Some (possibly familiar) NT device names (M
and N
are just integers):
-
\Device\HarddiskM\DRN
: Disks -
\Device\HarddiskVolumeN
: Partitions -
\Device\CdRomN
: Optical disc drives -
\Device\KeyboardClassN
: Keyboards -
\Device\MountPointManager
: Not a device, but keeps track of storage devices -
\Device\Null
: Eats up data and outputs nulls (zeroes)
\Device\HardDisk1\DR1
is the true name of the disk to Windows, and multi(0)disk(0)rdisk(0)partition(1)
is legacy -- it has nothing to do with how Windows refers to devices, but how the boot loader refers to the disk. How it works, I have no idea (this page explains parts of it), but it's not really something Windows concerns itself with after it starts booting.
Newer versions of Windows use the Boot Configuration Data (BCD), which is a file named BCD
whose format is like that of the registry, instead of Boot.ini
. It generally uses unique identifiers (GUIDs) to refer to volumes instead of drive letters or file system paths, and it's what newer versions of Windows use.
The first line, which has been rendered obsolete by the BCD (Boot Configuration Data store) in Windows Vista, Windows 7, and Server 2008, is from a boot.ini file for Windows XP or Server 2003, and is located in the root directory of the system drive. That tells Windows where to go (what disk and partition) to find the system files it needs to boot.
Look here for a detailed explanation of "multi" and "rdisk". The rest means that look at disk 0 (they start at 0 and move up from there, and you can see their numbers in the disk manager), partition 1 (unlike the disks, these start being numbered at 1 and go up).
http://support.microsoft.com/kb/102873
As far as the enumeration of devices goes, it is a very complicated programming subject, which is explained here if you want your head to explode. The format you gave is how the device is addressed as a hardware ID in the registry.
As a practical matter you can look at this registry key
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum
to match any error you may get to a "hardware ID" value in one of the sub keys to determine exactly what device the error may refer to.