Cabinet (file format)

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
Cabinet
Cab file format icon.png
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

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.

Design[edit]

A CAB archive can contain up to 65535 folders (distinct to standard operating system directories), each of which can contain up to 65535 files. 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.[1] 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
      • Records/Student_01.tsv
      • Records/Photos/Student_01.jpg
    • Second folder
      • Records/Student_02.tsv
      • 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[2]) as well as lcab[3] and cabextract[4] (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.[5]

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.

Implementations[edit]

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]

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[citation needed]. However, fewer programs can create CAB archives. For a full list, see Comparison of file archivers § archive formats.

Uses[edit]

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[by whom?] 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.

Windows uses the cabinet 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.[10][11] Deletion of the files without following a specific procedure[11] can cause the deleted files to be regenerated at an increased pace.

Related formats[edit]

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.

See also[edit]

References[edit]

  1. ^ Microsoft Cabinet Format
  2. ^ "Microsoft Cabinet Software Development Kit". Support. Microsoft. Retrieved 27 March 2013.
  3. ^ "lcab". Freecode. Dice. Retrieved 27 March 2013.
  4. ^ "cabextract".
  5. ^ "[Undocumented] [Bugs] Expand.exe (more about it) (Page 1) / Windows CMD Shell / SS64 Forum". ss64.org. Retrieved 21 April 2018.
  6. ^ "[MS-MCI]: Microsoft ZIP (MSZIP) Compression and Decompression Data Structure". docs.microsoft.com.
  7. ^ expand - Windows CMD - SS64.com
  8. ^ How to extract CAB File using command line tools in Windows 10
  9. ^ Extrac32 - Uncompress files - Windows CMD - SS64.com
  10. ^ "Clean Up Component-Based Servicing logs". Microsoft TechNet. 7 July 2017.
  11. ^ a b Leonhard, Woody (25 August 2016). "Windows 7 log file compression bug can fill up your hard drive". Computerworld. Retrieved 8 January 2019.
  12. ^ "twogood/unshield". GitHub. Retrieved 21 April 2018.
  13. ^ a b "kyz/libmspack: doc/magic". GitHub.
  14. ^ "Windows CE installation cabinet (.CAB) file format". cabextract.

External links[edit]