All of the information below is re-produced from the Microsoft online MSDN library and this info together with a wealth of other information can be found at Microsoft. As they keep changing their sites I have not included a link. Just to to Microsoft's support & do a search.

Using the CAB Wizard
The Windows CE operating system uses a .cab file to install an application on a Windows CE–based device. A .cab file is composed of multiple files that have been compressed into one file. Compressing multiple files into one file provides the following benefits:

All of the application's files are present.
You can prevent a partial installation.
You can install your application from several sources, such as a desktop computer or a Web site.
Use the CAB Wizard application (Cabwiz.exe) to generate a .cab file for your application.

To create a device-specific .cab file for an application
Create an .inf file with Windows CE–specific modifications.
Optionally, create a Setup.dll file to provide custom control of the installation process.
Use the CAB Wizard to create the .cab file, using the .inf file, the Setup.dll file, and the device-specific application files as parameters.


Version

The [Version] section is required and specifies the creator of the file and other relevant information.

[Version]

Signature = "signature_name"

Provider = "INF_creator"

CESignature = "$Windows CE$"

signature_name

Must be "$Windows NT$" or "$Windows 95$".

INF_creator

Company name of the application. For example:

Provider = "Microsoft"

The following code example shows a typical [Version] section.

[Version]

Signature = "$Windows NT$"

Provider = "Microsoft"

CESignature = "$Windows CE$"


CEStrings

The [CEStrings] section is required and specifies string substitutions for the application name and the default installation directory.

 

[CEStrings]

AppName = app_name

InstallDir = default_install_dir

app_name

Name of the application. Other instances of %AppName% in the .inf file will be replaced with this string value.

 

default_install_dir

Default installation directory on the device. Other instances of %InstallDir% in the .inf file will be replaced with this string value.

The following code example shows a typical [CEStrings] section.

[CEStrings]

AppName="Game Pack"

InstallDir=%CE1%\%AppName%


DefaultInstall

The [DefaultInstall] section is required and describes the default installation of your application.

[DefaultInstall]

Copyfiles=copyfile_list_section[,copyfile_list_section]

AddReg=add_registry_section[,add_registry_section]

[CEShortcuts=shortcut_list_section[,shortcut_list_section]] ; new key

[CESetupDLL=setup_DLL] ; new key

[CESelfRegister=self_reg_DLL_filename[,self_reg_DLL_filename] ; new key

shortcut_list_section

String that identifies one more section that defines shortcuts to a file, as defined in the [CEShortcuts] section.

setup_DLL

Optimal string that specifies a Setup.dll. It is written by the independent software vendor (ISV) and contains customized functions for operations during installation and removal of the application. The file must be specified in the [SourceDisksFiles] section.

self_reg_DLL_filename

String that identifies files that self-register by exporting the DllRegisterServer and DllUnregisterServer Component Object Model (COM) functions. You must specify the files in the [SourceDiskFiles] section.

During installation, if installation on the device fails to call the file's exported DllRegisterServer function, the file's exported DllUnregisterServer function will not be called during removal.

The following code example shows a typical [DefaultInstall] section.

 

[DefaultInstall]

AddReg = RegSettings.All

CEShortcuts = Shortcuts.All


SourceDiskNames

The [SourceDiskNames] section is required and describes the name and path of the disk on which your application resides.

[SourceDisksNames]

disk_ordinal= ,disk_label,,path

[disk_ordinal= ,disk_label,,path]

The following code example shows a typical [SourceDiskNames] section.

[SourceDisksNames] ; Required section

1 = ,"Common files",,C:\app\common ; Using an absolute path

[SourceDisksNames.SH3]

2 = ,"SH3 files",,sh3 ; Using a relative path

[SourceDisksNames.MIPS]

2 = ,"MIPS files",,mips ; Using a relative path


SourceDiskFiles

The [SourceDiskFiles] section is required and describes the name and path of the files in which your application resides.

[SourceDisksFiles]

filename=disk_number[,subdir]

[filename=disk_number[,subdir]]

The following code example shows a typical [SourceDiskFiles] section.

[SourceDisksFiles] ; Required section

begin.wav = 1

end.wav = 1

sample.hlp = 1

[SourceDisksFiles.SH3]

sample.exe = 2 ; Uses the SourceDisksNames.SH3

; identification of 2.

[SourceDisksFiles.MIPS]

sample.exe = 2 ; Uses the SourceDisksNames.MIPS

; identification of 2.


DestinationDirs

The [DestinationDirs] section is required and describes the names and paths of the destination directories for your application on the target device.

[DestinationDirs]

file_list_section = 0,subdir

[file_list_section = 0,subdir]

[DefaultDestDir=0,subdir]

Note Windows CE does not support directory identifiers.

subdir

String that identifies the destination directory. The following table shows the string substitutions that are supported by Windows CE. These can be used only for the beginning of the path.

String Replacement value
%CE1% \Program Files
%CE2% \Windows
%CE3% \Windows\Desktop
%CE4% \Windows\Startup
%CE5% \My Documents
%CE6% \Program Files\Accessories
%CE7% \Program Files\Communication
%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

The following code example shows a typical [DestinationDirs] section.

[DestinationDirs]

Files.Common = 0,%CE1%\My Subdir ;\Program Files\My Subdir

Files.Shared = 0,%CE2% ;\Windows


CopyFiles

The [Copyfiles] section, under the [DefaultInstall] section, is required and describes the default files to copy to the target device.

[copyfile_list_section]

destination_filename,[source_filename],[,flags]

[destination_filename,[source_filename],[,flags]]

The source_filename parameter is optional if it is the same as destination_filename.

flags

Numeric value that specifies an action to be done while copying files. The following table shows the values that are supported by Windows CE.

Flag Value Description

COPYFLG_WARN_IF_SKIP 0x00000001 Warn a user if an attempt is made to skip a file after an error has occurred.

COPYFLG_NOSKIP 0x00000002 Do not allow a user to skip copying a file.

COPYFLG_NO_OVERWRITE 0x00000010 Do not overwrite an existing file in the destination directory.

COPYFLG_REPLACEONLY 0x00000400 Copy the source file to the destination directory only if the file is already in the destination directory.

CE_COPYFLG_NO_DATE_DIALOG 0x20000000 Do not copy files if the target file is newer.

CE_COPYFLG_NODATECHECK 0x40000000 Ignore date while overwriting the target file.

CE_COPYFLG_SHARED 0x80000000 Create a reference when a shared DLL is counted.

The following example is a typical [CopyFiles] section.

[DefaultInstall.SH3]

CopyFiles = Files.Common, Files.SH3

[DefaultInstall.MIPS]

CopyFiles = Files.Common, Files.MIPS


AddReg

The [AddReg] section, under the [DefaultInstall] section, is required and describes the keys and values that the .cab file adds to the device registry.

[add_registry_section]

registry_root_string , subkey,[value_name], flags, value[,value]

[registry_root_string, subkey,[value_name], flags, value[,value]]

registry_root_strings

String that specifies the registry root location. The following table shows the values that are supported by Windows CE.

Root string Description

HKCR The same as HKEY_CLASSES_ROOT

HKCU The same as HKEY_CURRENT_USER

HKLM The same as HKEY_LOCAL_MACHINE

value_name

Registry value name. If empty, the "(default)" registry value name is used.

flags

Numeric value that specifies information about the registry key. The following table shows the values that are supported by Window CE.

Flag Value Description

FLG_ADDREG_NOCLOBBER 0x00000002 If the registry key exists, do not overwrite it. This flag can be used in combination with any of the other flags in this table.

FLG_ADDREG_TYPE_SZ 0x00000000 The REG_SZ registry data type.

FLG_ADDREG_TYPE_MULTI_SZ 0x00010000 The REG_MULTI_SZ registry data type. The value field that follows can be a list of strings separated by commas.

FLG_ADDREG_TYPE_BINARY 0x00000001 The REG_BINARY registry data type. The value field that follows must be a list of numeric values separated by commas, one byte per field, and must not use the 0x hexadecimal prefix.

FLG_ADDREG_TYPE_DWORD 0x00010001 The REG_DWORD data type. Only the non-compatible format in the Win32 Setup .inf documentation is supported.

The following code example shows a typical [AddReg] section.

AddReg = RegSettings.All

[RegSettings.All]

HKLM,%reg_path%,,0x00000000,alpha ; <default> = "alpha"

HKLM,%reg_path%,test,0x00010001,3 ; Test = 3

HKLM,%reg_path%\new,another,0x00010001,6 ; New\another = 6


CEShortcuts

The [CEShortcuts] section, a Windows CE–specific section under the [DefaultInstall] section, is optional and describes the shortcuts that the installation application creates on the device.

[shortcut_list_section]

shortcut_filename,shortcut_type_flag,target_file/path[,standard_destination_path]

[shortcut_filename,shortcut_type_flag,target_file/path[,standard_destination_path]]

shortcut_filename

String that identifies the shortcut name. It does not require the .lnk extension.

shortcut_type_flag

Numeric value. Zero or empty represents a shortcut to a file; any nonzero numeric value represents a shortcut to a folder.

target_file/path

String value that specifies the destination location. For a file, use the target file name—for example, MyApp.exe—that must be defined in a file copy list. For a path, use a file_list_section name defined in the [DestinationDirs] section—for example, DefaultDestDir—or the %InstallDir% string.

standard_destination_path

Optional string value. A standard %CEx% path or %InstallDir%. If no value is specified, the shortcut_list_section name of the current section or the DefaultDestDir value from the [DestinationDirs] section is used.

The following code example shows a typical [CEShortcuts] section.

CEShortcuts = Shortcuts.All

[Shortcuts.All]

Sample App,0,sample.exe ; Uses the path in DestinationDirs.

Sample App,0,sample.exe,%InstallDir% ; The path is explicitly specified.


Sample .inf File

The following code example shows a typical .inf file.

[Version] ; Required section

Signature = "$Windows NT$"

Provider = "Microsoft"

CESignature = "$Windows CE$"

[CEDevice.SH3]

ProcessorType = 10003 ; SH3 microprocessor

[CEDevice.MIPS]

ProcessorType = 4000 ; MIPS microprocessor

[DefaultInstall] ; Required section

AddReg = RegSettings.All

CEShortcuts = Shortcuts.All

[DefaultInstall.SH3]

CopyFiles = Files.Common, Files.SH3

[DefaultInstall.MIPS]

CopyFiles = Files.Common, Files.MIPS

[SourceDisksNames] ; Required section

1 = ,"Common files",,C:\app\common ; Using an absolute path

[SourceDisksNames.SH3]

2 = ,"SH3 files",,sh3 ; Using a relative path

[SourceDisksNames.MIPS]

2 = ,"MIPS files",,mips ; Using a relative path

[SourceDisksFiles] ; Required section

begin.wav = 1

end.wav = 1

sample.hlp = 1

[SourceDisksFiles.SH3]

sample.exe = 2 ; Uses the SourceDisksNames.SH3

; identification of 2.

[SourceDisksFiles.MIPS]

sample.exe = 2 ; Uses the SourceDisksNames.MIPS

; identification of 2.

[DestinationDirs] ; Required section

Shortcuts.All = 0,%CE3% ; \Windows\Desktop

Files.Common = 0,%CE2% ; \Windows

Files.SH3 = 0,%InstallDir%

Files.MIPS = 0,%InstallDir%

DefaultDestDir = 0,%InstallDir%

[CEStrings] ; Required section

AppName = My Test App

InstallDir = %CE1%\%AppName%

[Strings] ; Optional section

reg_path = Software\Microsoft\My Test App

[Shortcuts.All]

Sample App,0,sample.exe ; Uses the path in DestinationDirs.

Sample App,0,sample.exe,%InstallDir% ; The path is explicitly specified.

[Files.Common]

begin.wav,,,0

end.wav,,,0

Sample Help File.hlp,sample.hlp,,0 ; Rename the destination file.

[Files.SH3]

sample.exe,,,0

[Files.MIPS]

sample.exe,,,0

[RegSettings.All]

HKLM,%reg_path%,,0x00000000,alpha ; <default> = "alpha"

HKLM,%reg_path%,test,0x00010001,3 ; test = 3

HKLM,%reg_path%\new,another,0x00010001,6 ; new\another = 6


Creating an .ini File for the Application Manager

The .ini file contains information that registers an application with the Application Manager. The .ini file has the following format:

[CEAppManager]

Version = version_number

Component = component_name

[component_name]

Description = descriptive_name

[Uninstall = uninstall_name]

[InstallDir = install_directory]

[IconFile = icon_filename]

[IconIndex = icon_index]

[DeviceFile = device_filename]

CabFiles = cab_filename [,cab_filename]

version_number

Numeric version of the Application Manager, which is 1.0.

component_name

String that identifies the name of the section for the application.

descriptive_name

String that will appear in the Description field of the Application Manager when a user chooses the application.

uninstall_name

String that identifies the application's Windows Uninstall registry key name. This name must match the application's registered Windows Uninstall key name, which is found in the HKLM\Software\Microsoft\Windows
\CurrentVersion\Uninstall
registry key. Providing this name enables the Application Manager to automatically remove the application from the desktop computer and the device when a user clicks the Remove button in the Application Manager UI.

install_directory

String that identifies the desktop installation directory containing the location of the .cab files. If this key is nonexistent, which is recommended, the path of the .inf file is used for the installation directory.

icon_filename

String that identifies the relative path from install_directory to the desktop icon file. This string is used to display the device_filename when the file name is viewed in Windows CE Services.

icon_index

Numeric index into icon_filename. The value is used to display the device_filename when it is viewed in Windows CE Services. If this key is nonexistent, the first icon in icon_filename is used.

device_filename

File name on the device that will display the icon specified by icon_filename and icon_index when the device_filename is viewed in Windows CE Services.

cab_filename

File name of the available .cab files, relative to install_directory. Use commas to separate multiple cab_filenames. Do not include unnecessary spaces in this list of file names.


Sample .ini File for application manager

The following code example shows a typical.ini file.

[CEAppManager]

Version = 1.0

Component = Games

[Games]

Description = Game Pack for your Windows CE–based device

Uninstall = Game Pack

;Do not specify the "InstallDir" key so that CEAppMgr will use

;the directory of this .ini file as the installation directory.

IconFile = gamepack.ico

IconIndex = 0

DeviceFile = gamepack.exe

;Because there are multiple .cab files specific to a CPU type,

;these files are relative to the installation directory.

CabFiles = SH3\gamepack.cab,MIPS\gamepack.cab