Creating an Application Installation Package with Microsoft Windows CE 3.0
Summary: Application Installation (AppInstall) is used to install a Windows CE-based application onto a Windows CE-based device. This paper discusses AppInstall and is specifically targeted to creating a setup program that supports multiple devices. (11 printed pages)
The Application Installation (AppInstall) mechanism of Microsoft® Windows® CE 3.0 is used to install Windows CE–based applications on a Windows CE–based device. AppInstall supports multiple installation methods, such as desktop to device, Web to device, storage card to device, and device to device.
AppInstall has three components:
- CAB Wizard (CabWiz) is the desktop tool that packages application binaries into a single Windows CE .cab file, which is the file format for distributing multiple files. CabWiz is used by the application developer and is part of the Windows CE software development kit (SDK).
- Application Manager (CeAppMgr) is the desktop Windows CE Services component that provides a desktop-to-device application management tool. Application Manager is responsible for adding and removing applications on the Windows CE-based device, and for deleting the application files from the desktop computer. Application Manager is used by both the application developer and the end user. It is included with every installation of Windows CE Services.
- WCELoad is the Windows CE tool for the end user that unpacks a Windows CE .cab file to install an application on a device, and it is included with most Windows CE-based devices.
The Application Installation documentation is part of the Windows CE SDK Programmer's Guide. This documentation includes samples of the input file to CabWiz (the CabWiz .inf file) and the input file to CeAppMgr (the CeAppMgr .ini file).
The CabWiz .inf file is a modified version of the Microsoft Win32® application programming interface .inf file format. For more information on the Win32 .inf file format, see the Win32 Platform SDK.
This paper assumes knowledge of the Windows CE CabWiz .inf file format and describes how to create a setup program that supports multiple devices.
The CabWiz .inf file is the setup script file that specifies the files to copy and the registry settings to make. The following table shows the sections of an .inf file.
|Version||Yes||The application's creator and version.|
|CEStrings||Yes||String substitutions for application and directory names.|
|Strings||No||String definitions for one or more strings.|
|CEDevice||Yes||The device platform for which the application is targeted.|
|DefaultInstall||Yes||The default installation of the application.|
|SourceDisksNames||Yes||The name and path of the disk on which the application resides.|
|SourceDisksFiles||Yes||The name and path of the files in which the application resides.|
|DestinationDirs||Yes||The names and paths of the destination directories for the application on the target device.|
|CopyFiles||Yes||Default files to copy to the target device.|
|AddReg||Yes||Keys and values that the .cab file will add to the registry on the device.|
|CEShortCuts||No||Shortcuts that the installation application creates on the device.|
CabWiz uses the application developer's .inf file and the application binaries to create one or more .cab files.
If the application is device-independent—for example, a set of help files—then a single .cab file that is device-independent can be created. If the application contains device-specific files—for example, .exe or .dll files—then multiple .cab files can be created with a single CabWiz .inf setup file. Each .cab file supports a specific device. The method to create multiple platform-specific .cab files from a single CabWiz .inf file is to use platform labels and the CEDevice key in the CabWiz .inf file.
The platform labels tell CabWiz how many .cab files to generate, where to get the CPU-specific binary files, and the platform information to incorporate into the .cab file. The Application Manager uses this information to determine the appropriate .cab file to install on the end user's device.
Platform labels are unique labels that are appended to specific sections in the CabWiz .inf file; for example, HPC_SH3, PPC_MIPS, PPC3_CEF, or HPCPRO_ARM. The CEDevice section differentiates the platforms, which allows for device-specific information; the processor types; the device types; Handheld PC, Palm-size PC, or Pocket PC support; and the Windows CE version support. These platform labels also need to be specified in the command-line parameters when invoking CabWiz.
The following code example from a CabWiz .inf file supports multiple platforms. This example only displays the CEDevice and SourceDisksNames sections.
; Required "CEDevice[.label]" section ; Specifies the various types of CAB files that will be generated ; ; Pocket PC using CEF files [CEDevice.PPC3_CEF] ; a processor type of zero means this CAB can install on all ; processor types - this is required when using CEF ProcessorType = 0 ; CEF is only supported on Pocket PC devices. To identify a Pocket PC device, the UnsupportedPlatforms ; list must not include "Palm PC", and the min/max CE-OS version information must be provided UnsupportedPlatforms = "HPC","Jupiter" VersionMin = 3.0 ; CE-OS version for Pocket PC is 3.0 VersionMax = 100.0 ; support future devices - set an arbitrary high value [CEDevice.HPC_SH3] ; H/PC on SH3 ProcessorType = 10003 ; SH3 cpu numeric value UnsupportedPlatforms = "Palm PC","Jupiter" ; exclude PsPC and H/PC Pro devices [CEDevice.HPC_MIPS] ; H/PC on MIPS ProcessorType = 4000 ; MIPS cpu numeric value UnsupportedPlatforms = "Palm PC","Jupiter" [CEDevice.HPCPro_ARM] ; H/PC Pro on ARM ProcessorType = 2577 ; StrongARM cpu numeric value UnsupportedPlatforms = "Palm PC","HPC" [CEDevice.HPCPro_SH3] ; H/PC Pro on SH3 ProcessorType = 10003 UnsupportedPlatforms = "Palm PC","HPC" [CEDevice.HPCPro_MIPS] ; H/PC Pro on MIPS ProcessorType = 4000 UnsupportedPlatforms = "Palm PC","HPC" [CEDevice.PPC_SH3] ; Palm-size PC on SH3 ProcessorType = 10003 UnsupportedPlatforms = "HPC","Jupiter" [CEDevice.PPC_MIPS] ; Palm-size PC on MIPS ProcessorType = 4000 UnsupportedPlatforms = "HPC","Jupiter" ; ; Required "SourceDisksNames[.label]" section ; Specifies the source directories of the binary files ; ; Format: = ,,, ; will be used to specify the source files belonging to this directory ; is unused ; is the relative or absolute directory of the source files ; [SourceDisksNames] ; CPU-independent files 1 = ,"Common files",,Platform ; files are in .\Platform directory [SourceDisksNames.PPC3_CEF] ; PocketPC using CEF 2 = ,"CEF files",,Cpu\CE_3.0\CEF ; CEF-compiled files 3 = ,"PPC3 files",,Platform\PPC3 ; Pocket PC -specific files [SourceDisksNames.HPC_SH3] ; H/PC on SH3 2 = ,"SH3 files",,Cpu\CE_2.0\SH3 ; SH3-specific files are in .\Cpu\SH3 3 = ,"H/PC files",,Platform\HPC ; H/PC-specific files are in .\Platform\HPC [SourceDisksNames.HPC_MIPS] ; H/PC on MIPS 2 = ,"MIPS files",,Cpu\CE_2.0\MIPS 3 = ,"H/PC files",,Platform\HPC [SourceDisksNames.HPCPro_ARM] ; H/PC Pro on ARM 2 = ,"ARM files",,Cpu\CE_2.1\ARM 3 = ,"H/PC Pro files",,Platform\HPCPro [SourceDisksNames.HPCPro_SH3] ; H/PC Pro on SH3 2 = ,"SH3 files",,Cpu\CE_2.1\SH3 3 = ,"H/PC Pro files",,Platform\HPCPro [SourceDisksNames.HPCPro_MIPS] ; H/PC Pro on MIPS 2 = ,"MIPS files",,Cpu\CE_2.1\MIPS 3 = ,"H/PC Pro files",,Platform\HPCPro [SourceDisksNames.PPC_SH3] ; Palm-size PC on SH3 2 = ,"SH3 files",,Cpu\CE_2.1\SH3 3 = ,"PsPC files",,Platform\PPC [SourceDisksNames.PPC_MIPS] ; Palm-size PC on MIPS 2 = ,"MIPS files",,Cpu\CE_2.1\MIPS 3 = ,"PsPC files",,Platform\PPC
In the CEDevice section, the preceding example creates the following .cab files:
- PPC3_CEF.cab, for the Pocket PC
- HPC_SH3.cab, for the Handheld PC using the SH3 processor
- HPC_MIPS.cab, for the Handheld PC using the MIPS processor
- HPCPro_ARM.cab, for the Handheld PC running Pro Edition software using the ARM processor
- HPCPro_SH3.cab, for the Handheld PC running Pro Edition software using the SH3 processor
- HPCPro_MIPS.cab, for the Handheld PC running Pro Edition software using the MIPS processor
- PPC_SH3.cab, for the Palm-size PC using the SH3 processor
- PPC_MIPS.cab, for the Palm-size PC using the MIPS processor
In the SourceDisksNames and SourceDisksFiles sections, the source directory for device-independent common files (such as readme or help files) is in the \common directory and is referenced with a file identifier of 1. The source directories for the device-specific files—the .exe and .dll files—are located in the various platform-specific directories (for example, \hpc\sh3) and are referenced with a directory identifier of 2.
CabWiz must be invoked with the appropriate platform labels, for example, Cabwiz.exe "<INF_path>\MyApp.INF" /cpu HPC_SH3 PPC_MIPS HPCPRO_ARM PPC3_CEF.
CabWiz creates four device-specific .cab files:
With a single CabWiz .inf file, the application developer can create multiple device-specific .cab files. These .cab files can be directly downloaded to the device. For example, an end user can use Pocket Internet Explorer on a Windows CE-based device to download the appropriate .cab file and run the file on the device to install the application.
To support a desktop installation, the application developer can use the Application Manager to automatically download the appropriate .cab file to the end user's device. The application developer can write a single desktop setup program that registers the application with AppManager by specifying all the .cab files in the CeAppMgr .ini file.
The following code example shows the CeAppMgr .ini file MyApp.ini:
[CEAppManager] Version = 1.0 ; this is the CeAppMgr .ini version, not the app version Component = MyApplication [MyApplication] Description = Sample Windows CE application ; Required list of installed CAB files, relative to the current CEAppMgr INI file. ; Note that there are no extra spaces separating the CAB files. ; CabFiles = MyApp.PPC3_CEF.cab,MyApp.HPC_SH3.cab,MyApp.HPC_MIPS.cab,MyApp.HPCPro_ARM.cab, MyApp.HPCPro_SH3.cab,MyApp.HPCPro_MIPS.cab,MyApp.PPC_SH3.cab,MyApp.PPC_MIPS.cab
Invoking CeAppMgr with the .ini file registers the application and its associated .cab files. The end user can download the application on the next connection using the following code.
The Pocket PC, running Windows CE 3.0, is now available. In addition, backward compatibility is provided for two types of Palm-size PCs: the black-and-white version running Windows CE version 2.1 and the color version running Windows CE version 2.11. All three of these devices use "Palm PC" in the code as the device type name.
For the Pocket PC, you can install applications from:
- The Web, by using Pocket Internet Explorer
- A Compact Flash card, by using AutoRun and the Pocket PC Explorer
- Another Windows CE-based device, by using infrared and the Pocket PC Explorer
- A desktop PC, by using the Application Manager
You can install applications from all of these sources because all of the setup information for the application is part of the .cab file. The installation program on the device installs from a Windows CE-based .cab file, regardless of how that .cab file was transmitted to the device.
Note The installation program on the device dynamically deletes the .cab file during installation. To prevent the installation program from deleting the .cab file, make the .cab file read-only.
The Pocket PC contains an AutoRun feature that allows you to run an executable upon the insertion and removal of a Compact Flash card. You can use AutoRun to install one or more Windows CE-based .cab files when the user inserts a Compact Flash card in the device. Because the AutoRun executable is copied to the Windows directory on the device, AutoRun needs to do the following:
- Verify that the applications are not already installed on the device.
- Find the Compact Flash card name.
- Find the CPU-specific or CEF .cab file.
- Run the .cab file by using the ShellExecuteEx function or the CreateProcess function.
The Windows Platform SDK for Pocket PC provides a sample AutoRun executable.
For the Palm-size PCs, the application developer needs to write two CabWiz .inf files with different application names and create two CeAppMgr .ini files, which will appear as separate applications in the CeAppMgr user interface. However, a single desktop setup program can be used to install the two sets of applications.
The following code, MyApp_BW.inf, is for the black-and-white Palm-size PC:
[CEStrings] AppName = "My Sample App (b&w)" ; other values omitted... ; ; Black-and-white Palm-size PC on the 2.1 version of Windows CE ; [CEDevice.PPC_BW_SH3] ; targeted to Palm-size PC black-and-white devices with the ; SH3 processor ProcessorType = 10003 UnsupportedPlatforms = HPC,Jupiter VersionMin = 2.1 ; Windows CE version for black-and-white Palm-size PC is 2.1 VersionMax = 2.1 [CEDevice.PPC_BW_MIPS] ; targeted to black-and-white Palm-size PC devices with ; the MIPS processor ProcessorType = 4000 UnsupportedPlatforms = HPC,Jupiter VersionMin = 2.1 ; Windows CE version for black-and-white Palm-size PC is 2.1 VersionMax = 2.1
The following code, MyApp_CLR.inf, is for the color Palm-size PC:
[CEStrings] AppName = "My Sample App (color)" ; other values omitted... ; ; Color Palm-size PC on the 2.11 version of the Windows CE ; [CEDevice.PPC_CLR_SH3] ; targeted to Palm-size PC color devices with the SH3 processor ProcessorType = 10003 UnsupportedPlatforms = HPC,Jupiter VersionMin = 2.11 ; Windows CE OS version for Palm-size PC color devices is 2.11 VersionMax = 2.11 [CEDevice.PPC_CLR_MIPS] ; targeted to Palm-size PC color devices with the MIPS processor ProcessorType = 4000 UnsupportedPlatforms = HPC,Jupiter VersionMin = 2.11 ; Windows CE OS version for Palm-size PC color devices is 2.11 VersionMax = 2.11
CabWiz needs to be invoked with the appropriate platform labels, for example:
Cabwiz.exe "\MyApp_BW.INF" /cpu PPC_BW_SH3 PPC_BW_MIPS.
This creates two .cab files:
Invoking CabWiz with the appropriate platform labels for the other .inf file (Cabwiz.exe "<INF_path>\MyApp_CLR.INF" /cpu PPC_CLR_SH3 PPC_CLR_MIPS) creates two .cab files:
Each set of files requires its own CeAppMgr .ini file, as follows:
MyApp_BW.ini: [CEAppManager] Version = 1.0 Component = MyApplication [MyApplication] Description = Sample Windows CE application (black and white) CabFiles = MyApp_BW.PPC_BW_SH3.cab,MyApp_BW.PPC_BW_MIPS.cab MyApp_CLR.ini: [CEAppManager] Version = 1.0 Component = MyApplication [MyApplication] Description = Sample Windows CE application (color) CabFiles = MyApp_CLR.PPC_CLR_SH3.cab,MyApp_CLR.PPC_CLR_MIPS.cab
The application developer can then write a single desktop setup program to register both the black-and-white and color versions with a single CeAppMgr call, as shown here:
\CEAppMgr.exe "\MyApp_BW.ini" "\MyApp_CLR.ini"
The following processors are currently available in Windows CE devices:
|Processor Name||Processor Type Value|
Note The MIPS R3900 binaries are binary-compatible with all MIPS R3XXX and R4XXX processors. Use the R3900 binaries to ensure that files will run on all MIPS processors.
The StrongARM SA1100 binaries are binary-compatible with the ARM720 processor. Use the SA1100 binaries to ensure that files will run on both processors.
Note Only the Pocket PC supports CEF (Common Executable Format) binaries.
The following platform names and Windows CE version numbers are currently used in Windows CE–based devices.
|Device Name||Device Platform Name||Windows CE version number|
|H/PC 1.0||Unsupported. Use v1 PPCLoad|
|H/PC 3.0||HPC||Pro 2.11|
|Palm-size PC 1.0—Black & White||Palm PC||2.1|
|Palm-size PC 2.0—Color||Palm PC||2.11|
|Pocket PC||Palm PC||3.0|