PocketPC Toolkit.com
PocketPC Toolkit.com


Pocket PC Installer Professional - v3.4605
June 2009
 

New "Install .cab file, if newer" function

Previously, Pocket PC Installer Professional had two options for letting you install .cab files:
  - Install a .cab file on the device, if it's not currently installed
  - Always install a .cab file on the device, regardless of if it's already installed or not.

One issue which has come up time and time again is "how can I ask my installer file to install a "upgrade" .cab file, if it's a newer version than what's currently installed on the device?"

This new feature gets around this limitation on PocketPC devices.

The short version

If you're itching to try this option out, go for it !

There's just one thing to know: this option goes against the "Industry Standard" way of deciding whether to install .cab files. If you are planning on only using PocketPC Installer Professional to deploy your applications, then, no problem. This is a powerful new feature that you'll love.

However, if your users might alternatively install your .cab files from elsewhere, then you need to read on, to decide if this is the functionality you really want.

An example

Let's start with an example.

My users are happily using v1.0 of my award-winning "Mikes Application" PocketPC program, and I've just finished developing a new version, v1.1, of the software.

I've created a v1.1 upgrade .cab containing the files that have been updated, and want to install this upgrade on devices that are currently running v1.0.

Unfortunately, straight away, we hit a brick-wall.
Annoyingly, .cab files don't have any versioning information contained within them. There's no options I can add to my .inf file, to announce that this is a "v1.1" cab.

This limitation is easy to demonstrate.

Pick a Microsoft .cab file, such as one of the SQLCE library files..
   - Copy the .cab file to your device
   - Install it on your device
   - When it's finished installing, copy it to your device again, and install it again.

Even Microsoft's own .cab files make absolutely no effort to warn you that you already have the same version of one of their .cab files already installed. They simply warn that this application is currently installed, then offer to uninstall it, before re-installing exactly the same version again !

(Is it any wonder iPhone users snigger at the useability of our modern PocketPC devices!)

.Net CF cab file

Ah, you'll say, but how come Pocket PC Installer Professional has an "Install or upgrade to this version of .Net CF" option ? How can we do that if there's no versioning ?

Well, here, we've made an exception, as nearly all of users will want to have this specific .cab file installed on their device.

We've hardcoded a function to check which version of .Net CF is installed on your device, and when you add a .Net CF cab to your project, we interogate the .cab file to find out which version of .Net CF it contains.

The problem is, we've deliberately worked out how to get the versioning in this particular .cab. Every other type of .cab file in the world won't follow these rules, so we have no way of knowing/testing what version it represents.


So, with no industry-standard versioning in .cab files to use, we decided to make our own.
Let's explain what we've done, how we've done it, then what you should be aware of, before deciding if to use it or not.
 

"Install .cab file, if newer" option

The first important point is that we are basing our .cab file versioning solely on the date/time of when your .cab file was created.

This is far from the ideal solution, but it's the best attribute at our disposal, it's always present on every .cab file (you can't forget to set it !), and it gives us the ability to find out if one .cab file is newer than another.

So, my "MikesApplication.cab" file might contain the v1.1 upgrade files that I want to install on the device, but the only thing our installers will use to decide whether or not to install the .cab is the date/time when I built this .cab file.

If I decide to change a file in my v1.0 install .cab file, and I rebuild the v1.0 .cab file, then our installer files will now think that my v1.0 .cab file is the later version, and needs to be installed, even on a device running v1.1.

Implementation


Our installer files install .cab files onto your device using the Microsoft "wceload.exe" application. After a .cab file has been installed, "wceload.exe" creates a few registry entries to store details about the application.

What we've done is to make your installer files add a couple of extra registry values, CabFileDate and CabFilename. These will store the filename and the date/time of the .cab file you used to install this application.

After running an installer file on your device, you will notice that the log file (\installer.txt) now shows you the CabFileDate registry value being set:

4/6/2009 14:18 : File 11 of 11 : sql.ppc.wce4.armv4.CAB
4/6/2009 14:18 : ----------------------------------------------------------------
4/6/2009 14:18 : Application name: Microsoft SQL Client 2.0
4/6/2009 14:18 : Copy Method : Copy & install
4/6/2009 14:18 : Install on this type of device? : Yes
4/6/2009 14:18 : Is this .CAB file already installed ? : no.
4/6/2009 14:18 : Uncompressing file.. ok.
4/6/2009 14:18 : Installing "Microsoft SQL Client 2.0"
4/6/2009 14:18 : Running: \Windows\wceload.exe "\Temp\PPCInstaller\sql.ppc.wce4. armv4.CAB" /delete 0 ok, exit code: 0.
4/6/2009 14:18 : Setting .cab file versioning: Registry "Software\Apps\Microsoft SQL Client 2.0" value "CabFileDate" set to "2/4/2008 20:51:30".
4/6/2009 14:18 : Deleting \Temp\PPCInstaller\sql.ppc.wce4.armv4.CAB... ok.

A quick exception: Sometimes, when wceload.exe is installing a .cab file, a dialog might pop up, perhaps complaining that your application can't be installed as .Net CF is missing, and then exit, returning a "success" value of 0. In this situation, where the application hasn't actually been installed, we won't set the CabFileDate and CabFilename registry values.

5/6/2009 13:25 : Running: \Windows\wceload.exe "\Temp\PPCInstaller\sql.dev.ENU.ppc.wce5.armv4i. CAB" /delete 0 ok, exit code: 0.
5/6/2009 13:25 : .cab file versioning skipped: wceload.exe returned 0, but application hasn't been installed.

 

So, if you create a PocketPC Installer Professional installer file, and set a .cab file to "Install if newer", then the installer file will install your .cab file if any of these conditions is true:

   - the application isn't currently installed on your device
   - the application is installed, but the filename of your .cab file is different to the filename that was used to previously install this application.
   - the application is installed, the .cab filenames are the same, but the date/time of the .cab file in your installer (autorun.exe) is more recent than the one that was used to install this application on the device.

Side-effects

We can't say this strongly enough.
For the first time, we are creating installer files which aren't following the Microsoft standard.

No other installers know about our two new registry values, and the "wceload.exe" certainly doesn't know about them. If the user manually installs a .cab file, these two registry values won't be created or updated, so our installers will no longer know what version of an application you have installed.

This "Install if newer" option should only be used if you're confident that your users won't be installing a particular .cab file from anywhere else.

An example, part II

Let's go back to our "Mikes Application" example.

So, I've built the v1.1 upgrade .cab file for my application, and used Pocket PC Installer Professional to create an installer file, containing the this "MikesApplication.cab" upgrade .cab file.

As long as my users only ever install "Mikes Application" using my Pocket PC Installer Professional installer file, then I can safely use the "Install if newer" option.

However, if they've used this installer to install v1.0 of "Mikes Application", but then I email them a copy of the v1.1 Upgrade of "MikesApplication.cab" and they install this manually, then our special "CabFileDate" registry entry will still contain the date/time of the v1.0 .cab file.

If they later used a Pocket PC Installer install file containing the same v1.1 .cab file, set to "Install if newer", then it will attempt to re-install this .cab file.

 

Another note: these two registry values didn't exist prior to this release of Pocket PC Installer Professional.

So, if my users had installed v1.0 of "Mikes Application", using an installer file created by the June 2008 version of PPIP, then, again, the registry values won't have been set, and "Install if newer" won't have the information it needs to correctly determine if a .cab file needs to be installed.


We are clearly explaining how we've implemented this functionality, to let you make an educated decision on whether or not to use it in your installer files. And when you use this feature and run an installer file on your device, our log file will show you the decision making process it's gone through, in deciding whether or not to install a .cab file on your device, making it easy for you to check for installation problems.

6/6/2009 0:57 : File 2 of 2 : sqlce.wce4.armv4.CAB
6/6/2009 0:57 : ----------------------------------------------------------------
6/6/2009 0:57 : Application name: Microsoft SQLCE 2.0
6/6/2009 0:57 : Copy Method : Copy & install, if this is a newer .cab file
6/6/2009 0:57 : Install on this type of device? : Yes
6/6/2009 0:57 : Installed .cab: "sqlce.wce4.armv4.CAB", date: "19/10/2002 0:58:08".
6/6/2009 0:57 : .cab in this installer: "sqlce.wce4.armv4.CAB", date: "19/10/2002 0:58:08".
6/6/2009 0:57 : Dates are the same, do not install this .cab file.
6/6/2009 0:57 : Is this .CAB file already installed ? : yes, don't install again.

Side-effects

Remember, if you choose NOT to use this feature, then there is an alternative method of creating an upgrade installer file using Pocket PC Installer Professional.

Rather than building a v1.1 upgrade .cab file, you can just add your v1.1 files (your .exe's, your data files, etc) into a Pocket PC Installer Professional project, and set each of the files to "Copy to device, if newer". So, file by file, your installer will just install the files that are more up-to-date in the installer file, than on the device.

 

 

I know, that's a lot of information, just to decide whether or not to select a particular way of installing your .cab files.

But, this feature has been regularly requested by our users, it isn't an ideal solution and won't be the right solution for some of you, but for others, this is the missing link you've been asking for for years !

 

Let us know how you get on.
We'd love to hear your experiences.

support@pocketpctoolkit.com