DOS Fn 36H: Get Disk Free Space
Compatibility: 2.0+
Expects: AH 36H
DL drive number (0=default, 1=A, etc.)
──────────────────────────────────────────────────────────────────
Returns: AX ffffH if DL was an invalid drive number
else sectors per cluster if no error
BX available clusters (allocation units)
CX bytes per sector (usually 512)
DX total clusters on the disk
──────────────────────────────────────────────────────────────────
Info: Returns information useful for calculating total and available
disk space.
If AX returns ffffH, you sent a bad drive number in DL.
Otherwise, free space in bytes = (AX * CX * BX)
total space in bytes = (AX * CX * DX)
When sectors are 512 bytes, the calculation for Ks is simpler:
free space in K-bytes = (AX * BX) / 2
total space in K-bytes = (AX * DX) / 2
Notes: ■ A common error in the use of this fn is to disregard arithmetic
overflow on the multiplications. The product of three 16-bit
values can be very large indeed.
Versions: DOS 6.0
■ This call is intercepted by the resident portion of Undelete
(when Delete Sentry is active). The free-space value is
increased to reflect the disk space that will be made available
if Undelete needs to physically delete files in the \SENTRY
directory.
Once per day, this call may take several seconds before
returning -- when it triggers Undelete's daily purge.
■ In DoubleSpace compressed volumes, the available and free space
values are estimates, based on the average compression ratio
obtained for data currently on the drive.
See Also: Fn 32H (get disk info)
Fn 1bH (get FAT info)
DOS Functions
-♦-