I've been asked for assistance with the following issue today. A developer has a CAB that he wants to install on the device without using CeAppMgr, from his own setup application. In addition he wanted to force the installation to the storage card if present.
This task involves several steps:
1. Copying CAB to the device.
I would use cecopy (from Windows Mobile Developer Power Toys) or RAPI (CeCreateFile, CeWriteFile). If working with managed code, I suggest OpenNETCF.Communications library, or RapiDeploy tool
2. Detecting storage card presence.
While on the device side the preferred method is to use FindFirstFlashCard/FindNextFlashCard, these functions do not have Rapi equivalent. From the desktop side use CeFindAllFiles/FAF_FOLDERS_ONLY (or CeFindFirstFile/CeFindNextFile) to search the root directory and enumerate all files for having FILE_ATTRIBUTE_DIRECTORY and FILE_ATTRIBUTE_TEMPORARY combination of attributes (0x110).
3. Launch wceload.exe to install the cab
This is the interesting part. Here is a list of command-line switches that wceload.exe supports:
Dialog displayed by wceload when /askdest is specified
The /noaskdest switch is the most inetersting of them all. When you specify it, wceload ignores the rest of the command line. Instead it checks the following registry location - [HKEY_LOCAL_MACHINE\SOFTWARE\Apps\Microsoft Application Installer\Install]
The key contents are key/value pairs:[CAB file path] = [CAB destination directory]e.g. \Storage Card\MyApp.CAB = \Storage Card\Program Files\My App
wceload will try to install the cab specified in the value name to the location specified in the value value. Below is the sample registry content:
To reiterate: in order to install a cab to the memory card, one needs to:
Remember Me
Powered by: newtelligence dasBlog 1.8.5223.2
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.
© Copyright 2009, Alex Feinman