PowerBuilder Authors: Chris Pollach, Yeshim Deniz, Jayaram Krishnaswamy, Kevin Benedict, Avi Rosenthal

Related Topics: PowerBuilder

PowerBuilder: Article

Automatically Installing Applications After a Cold Boot

A simple solution

After continually reinstalling my PocketBuilder application, ASA, and PocketBuilder on my Symbol handheld scanner unit each time I rebooted the unit, I felt "enough is enough..."

WinCE units have volatile and non-volatile memory. By default, applications are installed into volatile memory and will be wiped out each time the unit is hard reset.

Within the "My Device" area on WinCE, the two directories Application and Platform are non-volatile (see Figure 1). Anything put in these two directories will remain even after a cold boot.

CAB files placed in the application directory will be automatically run on a hard reset but unfortunately get deleted once they've been executed. Making the CAB files read-only means they won't get deleted and would seem like the answer to my problem. Unfortunately the files will also be executed on a soft reset. Added to this, each time a new version of the application is produced, the developer has to remember to make the CAB file read-only. Given that I am the developer and my memory is flaky at the best of times, I needed a more foolproof method.

Copy Files and Reg Files
Another feature of the operating system are the RegMerge and CopyMerge drivers run early on in the boot sequence that pick up any files with a .reg or .cpy extension, respectively.

These files are useful for a number of reasons:

  • Using CopyMerge, the data source name file (.dsn) and the application initialization file (.ini) can be stored in non-volatile memory and then copied at boot time to the directory where the application is being installed to.
  • Using RegMerge, the CAB files can be held in a subdirectory of the application directory (this is still non-volatile memory) and executed by an application loader designed to do just this job (see below). This means the CAB files are not run on a soft reset as they don't reside at the application directory level.
The Application Loader
The answer to most of my woes lay in the wceldcmd.exe file (if you can find a copy) that loads CAB files and allows you to specify whether to remove the CAB file or not. (The wceldcmd.exe file is for OEM devices. For non-OEM devices use the wceload.exe file.)

The Final Solution
Armed with all this knowledge, my problem had dissolved into a simple solution...

Create an install directory under the \Application directory (see Figure 2). The install directory should contain:

  • The wceldcmd.exe*
  • All the CAB files (PocketBuilder, ASA, your PocketBuilder application)
  • The data source name file (.DSN) and application initialization file (.INI)
In the \Application directory there should be a .reg file (see Figure 3) (it can be called anything but must have a .reg extension) - if not, then create one.

The .reg file should contain the following:

"Command"="/delete 0 \Application\install\asa_ce.ARM.30.CAB"

"Command"="/delete 0 \Application\install\myapp.ARM.CAB"

"Command"="/delete 0

The /delete 0 parameter makes sure the CAB files aren't deleted after installation. The ColdBootOnly makes sure nothing happens on a warm boot (soft reset).

The application directory should also contain a .cpy file. This example uses the PocketBuilder application "MyApp" as an example - which installs into the directory MyApp within Program Files.

The .cpy file should contain the following:

\application\install\pocketgi.dsn > \Program Files\MyApp\MyApp.dsn
\application\install\gi.ini > \Program Files\MyApp\MyApp.ini

These statements copy the Data Source Name file and the MyApp Application's initialization file from their non-volatile location in the Install directory to the directory where the MyApp application's CAB file will install the application (the MyApp directory within Program Files).

With the above setup in place, a hard boot of the handheld unit will cause the installation of PocketBuilder, ASA, and the MyApp application using the CAB files in the install directory (which have been retained following the hard boot as they exist in non-volatile memory).

The settings in the .REG file ensure the CAB files remain in place ready for the next hard boot and won't get executed during a soft boot. The .CPY file ensures the MyApp.ini and the MyApp.dsn files are put in the MyApp installation directory.

This process can be repeated again and again. The installation of new versions of the MyApp application is simply a matter of copying the CAB file to the install directory and hard resetting the unit - very neat!

Further Information

More Stories By Graham Atkinson

Graham Atkinson is a computer consultant based in Cheshire, England, and director of Masterclass Computer Consultants Limited (http://master.org.uk). He has been using PB since 1994.

Comments (1) View Comments

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.

Most Recent Comments
Ashvin Gunga 01/21/08 01:24:40 AM EST

Hi, I am using a symbol mc9094 device running on a windows mobile 5.0. Are these features supported?