QUERY_INFORMATION_DISK: Get Disk Attributes

The SMB_COM_QUERY_INFORMATION_DISK command is used to determine the capacity and remaining free space on the drive hosting the directory structure indicated by Tid in the SMB header.

Client Request
==================================
Description
=================================
UCHAR WordCount; Count of parameter words = 0
USHORT ByteCount; Count of data bytes = 0

Server Response
==================================
Description
=================================
UCHAR WordCount; Count of parameter words = 5
USHORT TotalUnits; Total allocation units per server
USHORT BlocksPerUnit; Blocks per allocation unit
USHORT BlockSize; Block size (in bytes)
USHORT FreeUnits; Number of free units
USHORT Reserved; Reserved (client should ignore)
USHORT ByteCount; Count of data bytes = 0

The blocking/allocation units used in this response may be independent of the actual physical or logical blocking/allocation algorithm(s) used internally by the server. However, they must accurately reflect the amount of space on the server.

This SMB only returns 16 bits of information for each field, which may not be large enough for some disk systems. In particular TotalUnits is commonly > 64K. Fortunately, it turns out the all the client cares about is the total disk size, in bytes, and the free space, in bytes. So, it is reasonable for a server to adjust the relative values of BlocksPerUnit and BlockSize to accommodate. If after all adjustment, the numbers are still too high, the largest possible values for TotalUnit or FreeUnits (i.e. 0xFFFF) should be returned.