Cabinet (file format)

Cabinet (or CAB) 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.

Cabinet
Filename extension
.cab
Internet media type
application/vnd.ms-cab-compressed
Uniform Type Identifier (UTI)public.archive.cab
UTI conformationpublic.data
public.archive
Magic numberMSCF
Developed byMicrosoft
Type of formatArchive file format

The CAB file format may employ the following compression algorithms:

  • DEFLATE – invented by Phil Katz, the author of the ZIP file format (specifically, the MSZIP encapsulation)[1]
  • Quantum compression – licensed from David Stafford, the author of the Quantum archiver
  • 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. A variety of Microsoft installation technologies use the CAB format - these include Windows Installer, Setup API, Device Installer and AdvPack (used by Internet Explorer to install ActiveX components). 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, (not to be confused with file system 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.[2] 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:

CAB file
1st CAB-folder
Path: Records/Student_01.tsv
Path: Records/Photos/Student_01.jpg
2nd CAB-folder
Path: Records/Student_02.tsv
Path: Records/Photos/Student_02.jpg

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. CABARC.EXE and EXTRACT.EXE (tools from Microsoft Cabinet SDK[3]) as well as lcab[4] and cabextract[5] (third-party open-source tools) work this way.
  • EXPAND.EXE, 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.[6]

Software

Microsoft Windows

makecab, expand, extract, extrac32
Developer(s)Microsoft
Operating systemMicrosoft Windows
TypeCommand
LicenseProprietary commercial software

Microsoft Windows supports creating CAB archive files using the makecab command-line utility. It supports extracting the contents of a CAB archive files using File Explorer, Setup API, and using the command-line commands expand.exe,[7] extract.exe and extrac32.exe.[8][9]

makecab

The makecab command is used to create CAB archives:[10]

  • Compress a single file into a CAB archive
makecab.exe <input_file>[ <output_file>]
  • Read the diamond directive file (with .ddf filename extension) and create a CAB archive containing multiple files in a flat or hierarchical structure like a file system.
makecab.exe /F <diamond_directive_file>[ <output_file>]

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.[7]

  • Display only the list of files in the archive:
C:\> expand -d archive.cab

extract

The extract command is also used to uncompress one or more compressed .CAB cabinet files. It is an external command available for Windows 95, Windows 98, Windows ME and Windows NT.[11]

  • This command extracts only a particular file (e.g. file.txt) from the archive archive.cab to the output folder:
C:\> extract C:\cabs\archive.cab file.txt /L C:\output\

extrac32

The extrac32 command is another alternative used to uncompress one or more compressed .CAB cabinet files. It is part of Internet Explorer.[9]

  • Extracting all file from the archive archive.cab to the output folder:
C:\> extrac32.exe archive.cab /L C:\output\

Third-party support

Other well-known software with CAB archive support includes WinZip, WinRAR or 7-Zip. The aforementioned cabextract is a common tool for GNU/Linux systems . However, fewer programs can create CAB archives. For a full list, see Comparison of file archivers § archive formats.

The .cab filename extension is also used by other installer programs (e.g. InstallShield) for their own proprietary archiving formats. InstallShield uses zlib for compression (see Deflate), 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.[12] This format has a different magic number of ISC(.[13]

Windows CE installer uses a variant of Microsoft CAB format with a MSCE\0\0\0 magic.[13] The compression is typically NONE, but MSZIP can also be found.[14]

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.

Windows (at least versions 7, 8, and 2008 R2 (on windows 10 at that location no cab are found)) uses the .cab format to archive its Component-Based Servicing (CBS) 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.[15][16] Deletion of the files without following a specific procedure[16] can cause the deleted files to be regenerated at an increased pace.

gollark: Orbital asking lasers.
gollark: Too bad, orbital asking lasers *have* been activated.
gollark: If people *actually* didn't mention anything unless someone explicitly asked for it, conversations would basically just be about one topic, and very boring and brief.
gollark: I didn't ask whether you asked. "Who asked" embodies an entirely unreasonable standard which nobody applies except to make some sort of ridiculous point - which is good, since if it *were* something people genuinely stuck to, it would kill off all conversation ever.
gollark: You do realise that most home internet connections - including mine - are on dynamic IPs?

See also

References

This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.