Cabinet (file format)

Archive file format created for Microsoft Windows

This article possibly contains original research. Please improve it by verifying the claims made and adding inline citations. Statements consisting only of original research should be removed. (October 2020) (Learn how and when to remove this message)

|

Cabinet

Filename extension|

.cab

Internet media type|

application/vnd.ms-cab-compressed

Uniform Type Identifier (UTI)| public.archive.cab
UTI conformation| public.data
public.archive
Magic number| `MSCF`
Developed by| Microsoft
Type of format| Archive 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 four bytes (also called their magic number) MSCF. Cabinet files were known originally as Diamond files.

## Design

[edit]

A CAB archive can contain up to 65,535 folders (distinct from 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.[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:

* DEFLATE: invented by Phil Katz, the author of the ZIP file format (specifically, the MSZIP encapsulation)[6]
* Quantum compression: licensed from David Stafford,[7][dead link] the author of the Quantum archiver (not available in all versions of makecab.exe/diamond.exe)[8][9]
* 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.

## Implementations

[edit]

Main article: Comparison of file archivers

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`,[10] `extract.exe` and `extrac32.exe`.[11][12]

Other well-known software with CAB archive support includes WinZip, WinRAR or 7-Zip. The aforementioned `cabextract` is a common tool for Linux systems,[13] but is only capable of extracting archives. The `gcab` tool however can both extract and create CAB archives.[14] 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, Windows Setup (from Windows 95 to Windows Server 2003), Setup API, Device Installer, Theme Pack 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.

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

On Linux systems, CAB archives are used by fwupd to distribute firmware updates from hardware vendors[17] that can be flashed on non-volatile memory.

## 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.[18] This format has a different magic number of ISC(.[19]

Windows CE software is distributed as CAB files where the first file inside, ending with extension ".000", details how it is installed.[20]

Microsoft Installer `.msi` files sometimes contain CAB files, but are themselves in the Compound File Binary Format which has to be decoded first. Software like `lessmsi` can be used to unpack these files.

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]

* List of archive formats

## 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. 13 October 2020.
7. ^ Salomon, D. (David) (2007). Data compression : the complete reference. Library Genesis. London : Springer. p. 187\. ISBN 978-1-84628-602-5.`{{cite book}}`: CS1 maint: publisher location (link)
8. ^ "Quantum compression format". Matthew Russotto. Archived from the original on 11 May 2021. Retrieved 29 March 2022.
9. ^ "Cabinet File Format – Open Specifications Documentation" (PDF). Microsoft Corporation. 4 March 2011. Archived (PDF) from the original on 18 November 2016. Retrieved 15 February 2023.
10. ^ expand – Windows CMD – SS64.com
11. ^ How to extract CAB File using command line tools in Windows 10
12. ^ Extrac32 – Uncompress files – Windows CMD – SS64.com
13. ^ How to extract CAB files in Linux[permanent dead link]
14. ^ gcab project on GNOME
15. ^ "Clean Up Component-Based Servicing logs". Microsoft TechNet. 7 July 2017.
16. ^ a b Leonhard, Woody (25 August 2016). "Windows 7 log file compression bug can fill up your hard drive". Computerworld. Archived from the original on 8 January 2019. Retrieved 8 January 2019.
17. ^ "LVFS: Hardware Vendors". Linux Vendor Firmware Service Project. Retrieved 3 May 2022.
18. ^ "twogood/unshield". GitHub. Retrieved 21 April 2018.
19. ^ "kyz/libmspack: doc/magic". GitHub. 2 January 2022.
20. ^ "Windows CE installation cabinet (.CAB) file format". cabextract.

## External links

[edit]

Wikibooks has a book on the topic of: Guide to Windows Commands

* Microsoft Cabinet SDK – updated versions of these resources are available in the Microsoft Windows SDK
* Cabinet Software Development Kit (CAB SDK) – downloads of all Microsoft CAB SDK versions (free)

* v
* t
* e

Archive formats

Archiving only|

* ar
* cpio
* shar
* tar
* LBR
* WAD
* WARC

Compressing only|

* Brotli
* bzip2
* compress
* gzip
* Zopfli
* LZMA
* LZ4
* lzip
* lzop
* SQ
* xz
* Zstandard

Archiving
and compressing|

* 7z
* ACE
* ARC
* ARJ
* B1
* Cabinet
* cfs
* cpt
* dar
* DGCA
* .dmg
* .egg
* kgb
* LHA
* lrzip
* LZX
* MPQ
* PEA
* RAR
* rzip
* sit
* sitx
* SQX
* UDA
* Xar
* zoo
* ZIP
* ZPAQ

Software packaging
and distributing|

* apk
* App
* APPX
* deb
* HAP
* ipa
* JAR
* WAR
* Jakarta EE RAR
* EAR
* MSI
* MSIX
* Package (macOS)
* RPM
* XAP
* XBAP

Document packaging
and distributing|

* OEB Package Format
* OEBPS Container Format
* Open Packaging Conventions
* PAQ

* Comparison
* List
* Category

* v
* t
* e

Windows command-line programs and shell builtins

Ecosystem|

| Interpreters|

* COMMAND.COM
* Command Prompt
* PowerShell
* Recovery Console

|

Terminals|

* Windows Console
* Windows Terminal

File system navigation|

* cd (chdir)
* dir
* popd
* pushd
* tree

File management|

* attrib
* cacls
* cipher
* compact
* copy
* del (erase)
* deltree
* icacls
* mkdir (md)
* mklink
* move
* openfiles
* recover
* ren (rename)
* replace
* rmdir (rd)
* robocopy
* takeown
* xcopy

Archiving|

* expand
* extrac32
* extract
* makecab
* pax
* tar

Disk management|

* chkdsk
* convert
* defrag
* diskcomp
* diskcopy
* diskpart
* diskraid
* diskshadow
* drvspace
* fdisk
* format
* fsutil
* label
* manage-bde
* MSCDEX
* refsutil
* subst
* scandisk
* sys
* vol
* vssadmin

Processes|

* at
* exit
* kill
* runas
* sc
* schtasks
* shutdown
* start
* taskkill
* tasklist

Registry|

* assoc
* ftype
* reg
* regini
* regsvr32

User environment|

* chcp
* cmdkey
* date
* graftabl
* mode
* path
* set
* setver
* setx
* time
* title
* ver
* where
* whoami

File contents|

* comp
* edit
* edlin
* fc
* find
* findstr
* print
* type

Scripting|

* choice
* clip
* cscript
* doskey
* echo
* for
* forfiles
* goto
* if
* more
* pause
* prompt
* rem
* timeout

Networking|

* arp
* bitsadmin
* curl
* getmac
* hostname
* ipconfig
* nbtstat
* net
* netsh
* netstat
* nslookup
* PathPing
* ping
* rpcping
* route
* scp
* setspn
* sftp
* ssh
* ssh-add
* ssh-agent
* ssh-keygen
* ssh-keyscan
* tracert
* winrm
* winrs

Maintenance and care|

* auditpol
* dism
* dispdiag
* driverquery
* eventcreate
* eventtriggers
* gpresult
* gpupdate
* logman
* mofcomp
* msiexec
* ntbackup
* pentnt
* pnpunattend
* pnputil
* REAgentC
* relog
* sfc
* sxstrace
* systeminfo
* tpmtool
* tpmvscmgr
* tracerpt
* typeperf
* w32tm
* WBAdmin
* wecutil
* wevtutil
* winmgmt
* winsat
* wmic

Boot management|

* bcdedit
* bootcfg
* bootsect
* fixboot
* fixmbr

Software development|

* break
* debug
* exe2bin
* QBasic
* wsl

Miscellaneous|

* cls
* dpath
* help

* List of DOS commands
* Environment variables
* Windows Support Tools

*[v]: View this template
*[t]: Discuss this template
*[e]: Edit this template