How MS-DOS TRUENAME Resolves Physical Drive Paths
The TRUENAME command in MS-DOS 6.22 is an undocumented
utility that bypasses filesystem abstractions to reveal the actual,
fully canonicalized path of a file, directory, or drive. While tools
like SUBST, JOIN, and network redirectors
create logical aliases, TRUENAME traverses internal MS-DOS
data structures to pinpoint the exact physical drive hardware or network
share backing a given path. This article breaks down the internal
mechanics, kernel interrupts, and data tables that MS-DOS 6.22 uses to
trace these logical mappings back to their physical origins.
The Underlying System Call: INT 21h, Function 60h
When a user executes TRUENAME in the MS-DOS 6.22 shell
(COMMAND.COM), the interpreter does not perform string
parsing or path traversal itself. Instead, it delegates the entire
resolution process to the MS-DOS kernel via an undocumented system call:
Interrupt 21h, Service 60h (often documented in
reverse-engineering references as "Canonicalize File Name" or "Qualify
Path").
To execute this service:
- The calling program loads the source path string into
DS:SI. - The program allocates a 128-byte destination buffer and points
ES:DIto it. - The program sets register
AHto60hand executesINT 21h.
The kernel processes the input string, unwinds any layers of
virtualization, normalizes the syntax, and returns an absolute canonical
path in the buffer at ES:DI.
The Role of the Current Directory Structure (CDS)
The core mechanism the kernel uses to trace a logical drive letter to a physical disk is the Current Directory Structure (CDS) array.
In MS-DOS 6.22, the kernel maintains an internal table of CDS
entries—one entry for every available drive letter from A:
up to the value defined by LASTDRIVE in
CONFIG.SYS. Each CDS entry contains critical metadata about
the drive:
- The current path text: A string defining the active directory on that drive.
- Flags word: Bitmask values that specify whether the
drive is physical, local, a
SUBSTalias, aJOINed path, or a remote network drive. - Pointer to the DPB: For local, non-redirected physical media, the entry holds a memory pointer to the Drive Parameter Block (DPB).
- Redirection offset: For
SUBSTdrives, this integer indicates where the original physical path ends and the simulated root begins.
Resolution of Drive Aliases
When resolving pathways, Interrupt 21h Function 60h uses the CDS to handle virtual mappings:
Resolving SUBST Drives
The SUBST command maps an arbitrary directory on a real
drive to a new logical drive letter (e.g.,
SUBST X: C:\GAMES). When SUBST creates this
mapping, it sets a bit flag in the CDS entry for drive X:
and populates its base path buffer with C:\GAMES.
When TRUENAME X:\DOOM is invoked:
- Function 60h inspects the CDS entry for drive
X:. - It detects the
SUBSTbit flag in the entry’s attribute word. - The kernel retrieves the stored root path
(
C:\GAMES). - It concatenates the relative path argument (
\DOOM) onto the true root path, returningC:\GAMES\DOOM.
Resolving JOIN Drives
The JOIN command binds an entire physical drive to a
subdirectory on another drive (e.g.,
JOIN D: C:\DRIVE_D).
- The kernel flags the guest drive's CDS entry as joined and notes the hosting directory path.
- When a path targeting
C:\DRIVE_D\FILESis passed toTRUENAME, Function 60h scans the CDS array to see if any directory component of the path matches an activeJOINmount point. - If a match is found, the kernel substitutes the physical drive
letter (
D:\FILES), unwinding the folder abstraction.
Network Redirection and UNC Paths
For systems running networking extensions—such as the Microsoft Network Client for MS-DOS or LAN Manager—network drives mapped to logical drive letters are marked in the CDS with a "network/remote" attribute bit.
When Function 60h encounters a remote drive letter, it bypasses the local Drive Parameter Block and invokes the DOS Redirector interface (Interrupt 2Fh, Function 1123h). The network redirector inspects the connection table, retrieves the Universal Naming Convention (UNC) share definition, and substitutes the logical drive letter with the full network path format:
\\SERVER\SHARE\DIRECTORY\FILE.EXT
Path Normalization and Hardware Canonicalization
Beyond resolving aliases created by SUBST,
JOIN, or network redirectors, the resolution process
handles local filesystem artifacts:
- Relative Syntax Traversal: It strips out single-dot
(
.) current directory references and evaluates double-dot (..) parent directory steps against the real filesystem tree. - Drive Parameter Block (DPB) Mapping: Once all
aliases are stripped, the kernel references the local drive's DPB to
confirm the drive represents an actual physical unit (such as BIOS INT
13h drive
80hfor the primary hard disk). - Reserved Device Qualification: If passed a
character device name like
CON,PRN, orNUL, the kernel normalizes the path relative to the root of the active drive (for example, convertingNULtoC:\NUL), identifying it as an internal hardware handle rather than a storage file.