Windows Mobile Tip: Peeking inside CAB files

CAB files are the standard installation mechanism for Windows CE powered devices. Have you wondered what files have been installed by a given piece of software? Or what registry settings may have been overwritten during installation? If so, then this tip is for you.

CAB File Formats
A Microsoft CAB file is similar in nature to a common ZIP, or TAR file. They are a form of archive which contain one or more files. The individual files within a CAB file may have been compressed to reduce the overall size of the archive.

This archive file format has been re-purposed for application installation on Windows CE devices, by specifying a file with a special name that outlines the tasks required to install a given software package. This list of tasks will typically include decompressing and copying various files onto the PDA, but may also contain instructions to configure registry settings, or install shortcuts into the start menu etc.

Over the years the precise format of these files has changed. For a while the Windows Mobile Pocket PC and Smartphone platforms had incompatible CAB file formats. This has been resolved since the Windows Mobile 5.0 release which brought about a “unified” CAB file format for both platforms.

The older style CAB files had the list of setup instructions listed in a binary formatted file. The only information I am aware of on the structure of these CAB files is some reverse engineered documentation produced by the developers of the cabextract project.

The newer style CAB files have the list of setup instructions listed in an XML file called _setup.xml. It is this particular format that I will discuss here.

Extracting the contents of CAB files
On a desktop PC there are a number of ways you can extract the individual files within a CAB file. These include:

  • expand.exe – the Microsoft File Expansion Utility is a command line application present on all Windows machines. Specifying the name of a CAB file will cause the CAB file to be extracted into the current directory.
  • explorer.exe – by default most recent versions of Windows have an explorer shell extension which enables users to browse the contents of a CAB file by simply double clicking on it (as seen in the screenshot).
  • Winzip – many third party archive utilities will associate themselves with CAB files and enable you to extract their contents.

If you extract the _setup.xml file you can confirm that it’s main element is <wap-provisioningdoc>. This is a WAP provisioning document, as documented in MSDN in the Configuration Service Provider section.

The particular subset of this file format used by typical CAB files is fairly straight forward to follow, even without referring to the documentation. The _setup.xml file will enable you to determine the proper file names for the other files within a CAB file, and more importantly where they are installed to. One thing to be aware of is the use of macro Strings such as %CE2% to cope with internationalisation within file paths.

Possible uses of this tip
During development of an application, using this tip can be handy to verify that your CAB files are installing the desired files and settings. It is also useful when you have a CAB file which you have lost the original source code to, to determine what changes are made to the device.

The information would also be of use if you are developing an application to merge individual CAB files into one combined CAB file, such as the application discussed by Chris Tacke on his blog.

Random CAB fact of the day
Did you know that CAB files transfered via ActiveSync may be altered during the transfer process? If you have a CAB file which has been authenticode signed with a certificate, ActiveSync may strip off the certificate during the transfer process if it determines the connected device does not support signed cab files. This is something to be aware of, if you notice your CAB files won’t install if you download them across the network, but will if manually transfered via ActiveSync.

11 Responses to “Windows Mobile Tip: Peeking inside CAB files”

  1. Matteoathen says:

    Hi Christ,

    Currently, I created a CAB file which has a project output from an EXE file. This EXE file acts as an “SMS listener” and it needs to be run in order for the application to function.

    Now the problem is that, when I install the CAB file, the EXE file does not run automatically during the installation. As a result, I am unable to get the functionality works.

    Hope you can help me in this. Many thanks in advance.


  2. Hi Matteoathen,

    To my knowledge there is no easy way to automatically launch an executable after the initial CAB installation process.

    If you are comfortable developing native C code, you could write a “setup.dll”. A CAB file can be configured to run code within a special DLL during the installation process. You could write your setup.dll to launch your executable.

    However by the sounds of it, you may need to re-think your design a little bit. For example how will your “SMS listener” application be launched if the user soft-resets their PDA, or if it crashes?

    If you are comfortable developing unmanaged code, you may like to investigate reworking your “SMS listener” application into a service dll. The operating system would then provide a standardised way to communicate with your listener, and to automatically start it when the device boots etc.

    Alternativly if your SMS listener is simply responding to incomming SMS messages, have you investigated using the Application Launcher functionality to have the OS automatically run your listener application whenever an SMS is received? See the following MSDN Forums posting for further details on this approach.

  3. Matteoathen says:

    Hi Christ,

    First of all, thanks for the reply.

    The method of my “SMS listener” actually using the same method as you suggested, ie.MessageInterceptor class and EnableApplicationLauncher method.

    This application works under such a condition where the the Pocket PC is assumed being not resetted or crashed.

    Thanks for your kind attention.


  4. G.Ann says:


    Just finished some CAB development of my own and so I remember off-hand that there is a flag that can be set to have a file executed after extraction.

    Don’t know how you’re creating your cab files, Matteoathen, but according to the docs distributed with the Cab SDK, you can set 0×40 as a CFFile attribute for that effect. – If you’re hand-crafting your cabs, that is.


  5. Hi Ann,

    Do you have any more details (URLs for documentation etc) for how to execute a file after it is extracted? This would be a handy trick to know, and something that I wasn’t aware of.

    When you refer to the Cab SDK are you talking about the CAB file documentation for desktop PCs?

    The CAB file format used on desktop PCs has a whole range of flags etc not supported by the simpler Windows CE CAB file format. I couldn’t find a reference to a 0×40 flag in the documentation set I was looking at.

    I would be interested because I have a situation at present where such a flag would be quite handy…

  6. G.Ann says:


    You can get the SDK here: & check Cabfmt.doc. The CFFile section of the doc discusses an “attribs” structure member. Note that I didn’t need this feature myself, so I haven’t actually tried it. Just going off what the docs say.

    Good luck!

  7. I think that documentation is desktop specific. Although the Windows CE platform shares the same CAB archive format (i.e. a way of compressing more than one file into a single file) that is about the extent of the similarities.

    The structure of the files held within CAB files used to install applications is rather different between desktop and PDA. I don’t believe there is a PDA equivalent of the CFFile flag discussed.

  8. AD says:

    Thanx a lot dude.

    However I got very upset when you mentioned WINZIP because I am adopting a power user philosophy that goes like:

    “If there is a FreeWare or an OpenSource alternative there is no need to use Commercial Software.”

    Therefore allow me to present you with these two appies:

    7-Zip 4.60 Beta – 902KB (Open Source)

    IZArc 3.8.1550
    Ivan Zahariev – 3.55MB (Freeware)

    I hope you like them.


  9. Lak says:

    Hi, I have a little problem about cab file.

    Is any tool exist for unpack cab file on desktop?
    p.s : I do not mean the uncompress.

    Thanks a lot.

  10. Namrata says:


    Thanks for the great post.. one slight detail though.. I tried to merge the _settings of 2 cabs and copied relevant files.. Sadly though, just one of them is deployed.. I have a sneaky suspicion the SMARTD~1 is to blame.. any thoughts on how to work around this?


  11. Hi Namrata,

    In theory your process should work. I haven’t done exactly the same thing but have worked on a couple of projects which extract and re-package the contents of CAB files. The process is also similar to that used by Chris Tacke in the blog post I referenced within the article (,guid,073453a8-3fb1-4527-8599-f980f46ea6d4.aspx).

    My guess is possibly that something was missing from your merged _setup.xml which caused some of the files to fail to be extracted. How did you go about merging the two _setup.xml files into one? If you just copied one of them this would explain why the files and registry settings from the other application did not copy across.

    Please feel free to contact me via if you would like to discuss this further.

Leave a Reply