Cabinet (or CAB) is an for Microsoft Windows that supports lossless data compression and embedded digital certificates used for maintaining archive integrity. Cabinet files have .cab s and are recognized by their first four bytes (also called their ) MSCF. Cabinet files were known originally as Diamond files.
A CAB archive can contain up to 65,535 folders (distinct to standard operating system directories), each of which can contain up to 65,535 files for a maximum of 4,294,836,225. Internally, each folder is treated as a single compressed block, which provides more efficient compression than individually compressing each file.
Every entry in a folder has to be a file. Due to this structure, it is not possible to store empty folders in CAB archives.
The following shows an example a CAB file structure, demonstrating the relationship between folders and files:
CAB file
First folder
Second folder
How paths should be handled is not specified in the CAB file format, leaving it to the software implementation:
Some affix file paths to filenames only, as if all files in a CAB archive are in a single folder. IExpress works this way, as does Microsoft Windows Explorer, which can open CAB archives as a folder.
Some can store the paths, and upon extraction, create folders as necessary. and (tools from Microsoft Cabinet SDK) as well as and (third-party open-source tools) work this way.
only since version 6 (which is included from Windows Vista to above) can extract files to their paths. The previous versions don't do it.
The CAB file format may employ the following compression algorithms:
DEFLATE: invented by Phil Katz, the author of the (specifically, the MSZIP encapsulation)
Quantum compression: licensed from David Stafford, the author of the Quantum archiver (not available in all versions of makecab.exe/diamond.exe)
LZX: invented by Jonathan Forbes and Tomi Poutanen, given to Microsoft when Forbes joined the company
NULL: stored
A CAB archive can reserve empty spaces in the archive as well as for each file in the archive, for some application-specific uses like digital signatures or arbitrary data.