Detect installation mode when validating a serial - Advanced Installer Community
ElectronShepherd
Posts: 29
Joined: Thu Jun 30, 2011 11:51 am

Detect installation mode when validating a serial

We have two editions of our software, with different serial numbers for each; call the editions A and B. A is a cut-down version of B, and so an upgrade from A to B is supported. A and B have the required upgrade codes so that if A is currently installed, installing B will uninstall A and then install B. This is what we want to happen. We also have enabled the serial number search facility in AI (we store it in the registry), so that if someone upgrades an older version of A to a newer version of A, or an older version of B to a newer version of B, the serial number is automatically populated for them.

However, if we have A installed, and run an install of B, the serial number dialog is pre-populated with the A serial number. This fails validation (as expected). It's more of a problem if we run an unattended install, running a B install and passing PIDKEY=<B serial number> on the command line. The install reads the existing A serial number, which fails validation by the B install, so the B install terminates. The result of this is that there is no way to do an unattended upgrade of A to B.

Is there some way that I can override the search for the existing serial number with a custom action of some kind? We use other custom actions so writing a DLL in C++ to do this is not a problem.

If the search for PIDKEY finds a serial number, and a different one is passed on the command line, can I somehow read both of them?
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Detect installation mode when validating a serial

Hi,

In order to overcome this problem you can use one of the solutions below:
1. store the A and B serial numbers to different registry entries, so that the B search will not find the A serial number
2. rename the B search (i.e. PIDKEY_B) and set the PIDKEY property to the value of the search only if their values are different and the search property is not empty: PIDKEY <> PIDKEY_B
3.
use the "Set installer property" custom action to backup the PIDKEY property before searches and restore it if the backup property is not empty and is different that the PIDKEY property

Just let me know if you need more clarifications.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
ElectronShepherd
Posts: 29
Joined: Thu Jun 30, 2011 11:51 am

Re: Detect installation mode when validating a serial

Apologies for the delay in replying to this - I've been engaged on other aspects of our software.

Is there a way to detect the fact that a PIDKEY was passed in on the command line? We do store the serial number in the registry (please ignore a previous edit of this post that said we didn't - that was my mistake :oops: ). Using different keys (1) isn't really an option given how the rest of the software uses the serial number. (2) or (3) seem the best approach - where would the custom action need to be? When is serial number validation called relative to the other custom actions?
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Detect installation mode when validating a serial

Hi,

The serial number validation is done during the "Paths Resolution" action group, after the "LaunchConditions" standard action. So you can place your "Set installer property" custom aciton between the "Searches" and the "Paths Resolution" action groups if you use approach (2). If you use approach (3), you need to add one more custom action to backup the "PIDKEY" before the "Searches" action group.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”