Windows CE installation cabinet (.CAB) file format

Table of Contents

About the format

The Windows CE installation cabinet format was designed by Microsoft make it easy to create packaged software for the Windows CE platform. After generating all his executable programs, data files, help files and so on, a developer can then write an "installation script" which lists the name of the software package, where each file should be installed on the target device's filesystem, registry entries to make on the target system's Windows Registry, and so on. A tool called "CabWiz" takes the installation script and produces a single CAB file with a special control file stored in it. On the target Windows CE device, a program called WCELOAD.EXE will read cabinet files, install them, register them as installed packages, set their registry entries, and so on.

The Cabinet format was previously developed by Microsoft for creating a simple archive format for packaged software, from entire operating systems down to ActiveX Web plugins. They also intended to displace Sun's JAR format for packaging Java software, but this did not succeed.

Overall cabinet file format

Firstly, the overall file format of a Windows CE installation cabinet is the standard Microsoft Cabinet file format. This was originally documented in the Microsoft document CABFMT.DOC as part of the Microsoft Cabinet SDK (CAB-SDK.EXE), it is now documented in the Windows Installer documentation. The format can also be gleaned from open source tools and libraries such as cabextract and libmspack. Windows CE installation cabinets typically use no compression (the NONE compression method in the cabinet specification), sometimes MSZIP compression.

Cabinet file contents

The filenames of the files in the cabinet use the MS-DOS "8.3" convention, where the first eight characters in the filename come from the "true filename", and are followed by a period and three numeric digits. The digits form a decimal number from 000 to 999. The name part before the period is currently always 8 characters (shorter names are padded on the left with "0"), but this shouldn't be relied upon. Only the numeric extension should be used to identify the file. There should not be more than one file in the cabinet with the same numeric extension. As an example:

Name in cab fileOriginal filename
BLKJAC~4.000--- (installation data)
BLACKJ~1.999Blackjack Setup.dll
SELFRE~1.006SelfRegister.dll
0Blkjack.005Blkjack.exe
00Sample.004Sample.BJL
WINGAM~1.003Win Game.wav
LOSEGA~1.002Lose Game.wav
BLACKJ~1.001Blackjack Help.htp

The order of these files within the cab file is important. The first file in the cabinet should be the ".000" file. It should then be followed by all other files in descending numerical order of their extensions.

These original filenames are not recoverable, they are not stored anywhere. The only names available are the target filenames given in the FILES section of the .000 file.

All installation data is contained in the .000 file. If a .999 file exists, it is an "application specific Setup.DLL"; a Microsoft standard Dynamic Link Library that will be loaded and executed after installation by the installation program. All other files are files for installation on the Windows CE device, and the three digits should be resolved into an integer "file number".

Format of the .000 file

All multi-byte integers are little-endian. Values given in this document are in decimal, unless otherwise specified. The overall file format of the .000 file is as follows:

Only the fixed size header has a fixed file offset, all other strings and sections may be at any file offset, in any order. They are typically in the order given above. Each file offset is given in the fixed size header.

The fixed size header

The .000 file begins at file offset 0 with a fixed size header of exactly 100 bytes. The format of this header is as follows:

OffsetSize in bytesDescription
04An ASCII signature, "MSCE". This is 0x4543534D as a little-endian integer.
44Unknown purpose, usually 0.
84The overall length of this .000 header file, in bytes.
124Unknown purpose, usually 0.
164Unknown purpose, usually 1.
204Target architecture for this cabinet: see Appendix A.
244Minimal version of WinCE (major version number) required to install this cabinet, or 0 to indicate no restriction.
284Minimal version of WinCE (minor version number) required to install this cabinet, or 0 to indicate no restriction.
324Maximal version of WinCE (major version number) required to install this cabinet, or 0 to indicate no restriction.
364Maximal version of WinCE (minor version number) required to install this cabinet, or 0 to indicate no restriction.
404Minmal version of WinCE (build number) required to install this cabinet, or 0 to indicate no restriction.
444Maximal version of WinCE (build number) required to install this cabinet, or 0 to indicate no restriction.
482The number of entries in the STRINGS section.
502The number of entries in the DIRS section.
522The number of entries in the FILES section.
542The number of entries in the REGHIVES section.
562The number of entries in the REGKEYS section.
582The number of entries in the LINKS section.
604The file offset of the STRINGS section in bytes.
644The file offset of the DIRS section in bytes.
684The file offset of the FILES section in bytes.
724The file offset of the REGHIVES section in bytes.
764The file offset of the REGKEYS section in bytes.
804The file offset of the LINKS section, in bytes.
842The file offset of the APPNAME string in bytes.
862The length of the APPNAME string in bytes, including null terminating byte.
882The file offset of the PROVIDER string in bytes.
902The length of the PROVIDER string in bytes, including null terminating byte.
922The file offset of the UNSUPPORTED multi string in bytes.
942The length of the UNSUPPORTED multi string in bytes, including null terminating byte.
962Unknown purpose, usually 0.
982Unknown purpose, usually 0.

The APPNAME string

This is a null-terminated ASCII string that gives the name of the packaged application.

The PROVIDER string

This is a null-terminated ASCII string that gives the name of the author or publisher of the packaged application.

The UNSUPPORTED multi string

If this string has more than zero bytes length according to the fixed size header, then this is a sequence of consecutive null terminated ASCII strings. The sequence always terminates with an empty string. Each string is the ASCII name of a Windows CE platform where this software is not supported and will not run. Platforms seen in this sequence include "PALM PC", "HPC", "JORDAN", "PALM PC2" and "POCKETPC".

The STRINGS section

The STRINGS section is a number of common ASCII strings that may be used in the installation data. In other sections, strings from the STRINGS section are referred to by their string ID. The total number of entries in this section is given in the fixed size header. There is no padding between string entries. The format of each STRING entry is as follows:

As an example, the hexadecimal byte stream 04 00 09 00 53 6F 66 74 77 61 72 65 00 decodes to "ID=4 (04 00), length=9 (09 00), string=Software". The hexadecimal byte stream 05 00 0A 00 4D 69 63 72 6F 73 6F 66 74 00 decodes to "ID=5 (05 00), length=10 (0A 00), string=Microsoft".

The DIRS section

The DIRS section is a list of directory paths used in the installation. In other sections, paths from the DIRS section are referred to by their directory ID. The total number of entries in this section is given in the fixed size header. There is no padding between directory entries. The format of each directory entry is as follows:

For example, the hexidecimal byte stream 01 00 0A 00 01 00 02 00 03 00 04 00 00 translates "dir ID=1 (01 00), length=10 (0A 00), specification={1, 2, 3, 4}". Assuming string ID 1 is "foo", string ID 2 is "bar", string ID 3 is "baz" and string ID 4 is "quux", the specification translates from {1, 2, 3, 4} to "foo\bar\baz\quux".

The directory specification may begin with a path member of the form "%CEn%", where n is a decimal integer from 1 to 17. This is an abbreviation for one of the CE standard directories, as listed in Appendix B.

The FILES section

The FILES section is a list of files to be installed on the target device. All files in the list should be installed. In other sections, files from the FILES section are referred to by their file ID. The total number of entries in this section is given in the fixed size header. There is no padding between file entries. The format of each file entry is as follows:

The REGHIVES section

The REGHIVES section is a list of hives in the Windows Registry. These hives are then used in the REGKEYS section for actual registry entries. In other sections, hives from the REGHIVES section are referred to by their hive ID. The total number of entries in this section is given in the fixed size header. There is no padding between hive entries. The format of each hive entry is as follows:

The REGKEYS section

The REGKEYS is a list of registry entries -- key / data pairs -- to be added to the Windows Registry upon installation. All entries in the list should be added. The total number of entries in this section is given in the fixed size header. There is no padding between entries. The format of each entry is as follows:

The LINKS section

The LINKS section is a list of symbolic links to be made in the standard installation directories, to link to installed directories or files. The total number of links in this section is given in the fixed size header. There is no padding between links. Each link has the following format:

Appendix A: a list of processor architectures

ValueDescription
0No specific architecture
103SHx SH3
104SHx SH4
386Intel 386
486Intel 486
586Intel Pentium
601PowerPC 601
603PowerPC 603
604PowerPC 604
620PowerPC 620
821Motorola 821
1824ARM 720
2080ARM 820
2336ARM 920
2577StrongARM
4000MIPS R4000
10003Hitachi SH3
10004Hitachi SH3E
10005Hitachi SH4
21064Alpha 21064
70001ARM 7TDMI

Appendix B: a list of %CEn% shortcuts

First, for a Handheld PC:

ValueStandard directory
%CE1%\Program Files
%CE2%\Windows
%CE3%\Windows\Desktop
%CE4%\Windows\StartUp
%CE5%\My Documents
%CE6%\Program Files\Accessories
%CE7%\Program Files\Communications
%CE8%\Program Files\Games
%CE9%\Program Files\Pocket Outlook
%CE10%\Program Files\Office
%CE11%\Windows\Programs
%CE12%\Windows\Programs\Accessories
%CE13%\Windows\Programs\Communications
%CE14%\Windows\Programs\Games
%CE15%\Windows\Fonts
%CE16%\Windows\Recent
%CE17%\Windows\Favorites

For a Pocket PC version 1.0 or 2.0, as per Handheld PCs, except

ValueStandard directory
%CE3%undefined
%CE9%undefined
%CE10%undefined
%CE11%\Windows\Start Menu\Programs
%CE12%\Windows\Start Menu\Accessories
%CE13%\Windows\Start Menu\Communications
%CE14%\Windows\Start Menu\Games
%CE16%undefined
%CE17%\Windows\Start Menu

For a Pocket PC version 3.0, as for 1.0 or 2.0, except

ValueStandard directory
%CE6%undefined
%CE7%undefined
%CE8%undefined
%CE12%undefined
%CE13%undefined
%CE16%undefined