Cabinet (file format)


Cabinet is an archive-file format for Microsoft Windows that supports lossless data compression and embedded digital certificates used for maintaining archive integrity. Cabinet files have .cab filename extensions and are recognized by their first 4 bytes MSCF. Cabinet files were known originally as Diamond files.
The CAB file format may employ the following compression algorithms:
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. A variety of Microsoft installation technologies use the CAB format - these include Windows Installer, Setup API, Device Installer and AdvPack. CAB files are also often associated with self-extracting programs like IExpress where the executable program extracts the associated CAB file. CAB files are also sometimes embedded into other files. For example, MSI and MSU files usually include one or more embedded CAB files.

File structure

A CAB archive can contain up to 65535 CAB-folders, each can contain up to 65535 files. Internally, each CAB-folder is treated as a single compressed block, which provides more efficient compression than individually compressing each file.
Every entry in a CAB-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 CAB-folders and files:
How paths should be handled is not specified in the CAB file format, leaving it to the software implementation.

Microsoft Windows

supports extracting the contents of a CAB archive files using File Explorer, Setup API, and using the command-line commands expand.exe, extract.exe and extrac32.exe.

expand

The expand command is used to uncompress one or more compressed.CAB cabinet files. It is also known as the Microsoft File Expansion Utility and dates back to MS-DOS 5 in 1990.

C:\> expand -d archive.cab

extrac32

The extrac32 command is also used to uncompress one or more compressed.CAB cabinet files. It is part of Internet Explorer.

C:\> extrac32.exe archive.cab /L "C:\output\"

makecab

The makecab command is used to create CAB archives:
Other well-known software with CAB archive support includes WinZip, WinRAR or 7-Zip. The aforementioned is the tool for GNU/Linux systems. However, fewer programs can create CAB archives. For a full list, see.

Related formats

The .cab filename extension is also used by other installer programs for their own proprietary archiving formats. InstallShield uses zlib for compression, but their headers are not the same as for Microsoft CAB files so they are incompatible and cannot be manipulated or edited with the programs that are made for standard Cabinet format. Specialized third-party utilities, such as Unshield, can extract this specific proprietary format. This format has a different magic number of.
Windows CE installer uses a variant of Microsoft CAB format with a magic. The compression is typically NONE, but MSZIP can also be found.
Microsoft Publisher has a "Pack and Go" feature that bundles a publisher document, together with all external links, into a CAB file with a .PUZ extension. These files are meant to be activated with a companion.EXE file which is distributed along with the .PUZ file. These files may be opened with any CAB file extraction program.

Application in Component-Based Servicing and related bug

Windows uses the .cab format to archive its Component-Based Servicing log, which is kept in the folder C:\Windows\Logs\CBS. A bug in the compression process can cause run-away generation of useless log files both in that folder and in C:\Windows\Temp, which can consume disk storage until completely filling the hard drive. Deletion of the files without following a specific procedure can cause the deleted files to be regenerated at an increased pace.