Prevent downgrading of installation

Got a problem you cannot solve? Try here.
Post Reply
MatthewFinch
Posts: 11
Joined: Wed Mar 16, 2011 6:30 am

Prevent downgrading of installation

Post by MatthewFinch »

Hello,

I was wondering if there was a way to prevent downgrading of an installation?

As IA uninstalls before overinstalling there is no way that it can use the usual WISE technique of only updating files if file date time is newer than current. Therefore, is there a way to read the 'product version' (e.g. 1.5.0.0) of the currently installed version of the software and prevent installation if 'product version' within the new installation .exe is less than current (e.g. 1.3.0.0).

I need to be able to generate a single .exe for a product that has improving versions of the application but stop a user from downgrading once they have upgraded as changes made to things like database structures etc cannot be undone.

I have read entries and know that there is no formal way for IA to run a fresh install if no current version is present but run an overinstall (without uninstall) if current version is present and only replace files with more recent date time.

Any help on this matter would be great.

Cheers,

Matt Finch
giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: Prevent downgrading of installation

Post by giaviv »

Dear Matt,

You can read the DisplayVersion registry entry located in:
HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\{ProductCode}
and compare it to the installer version.
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
MatthewFinch
Posts: 11
Joined: Wed Mar 16, 2011 6:30 am

Re: Prevent downgrading of installation

Post by MatthewFinch »

Hi,

Thanks for the reply.

I now have the registry entry available for comparison. However, I was wondering if there was an easier way to get the installer version as a decimal value like 'Version' registry entry instead of string format like 'DisplayVersion' entry. This makes life much easier as I can simply use 'greater than' comparison. My version string format is x.x.x.x which follows historical structure. Therefore, to do valid comparison on string I would need to chop out the four parts of each string and compare which makes life annoying!

I don't think there is a predefined variable for version as hex/decimal but only as displayversion string format. Any ideas would be very helpful.

Kind Regards,

Matt
giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: Prevent downgrading of installation

Post by giaviv »

Matt,

I think you got a little confused here - $VERSION$ predefined variable refers to the version of the current running setup.
The DisplayVersion in the registry is the version of the currently installed setup - there is no predefined variable that magically gets the version of the installed setup :)
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
MatthewFinch
Posts: 11
Joined: Wed Mar 16, 2011 6:30 am

Re: Prevent downgrading of installation

Post by MatthewFinch »

I hope I am not that confused! :)

Registry for currently installed application has values of

DisplayVersion 2.15.0.0

also has

Version 0x020F0000 (34537472)
VersionMajor 0x00000002 (2)
VersionMinor 0x0000000F (15)

When I run my script I currently read the DisplayVersion from the registry. I then compare this to currently running setup which has pre defined variable $Version$. The $Version$ variable returns in same format as DisplayVersion (format = x1.x2.x3.x4 e.g. 2.14.0.0) . Therefore to make sure I don't downgrade I would need to compare the two string formats x1 >= x1, x2 >= x2, x3 >= x3, x4 >= x4. A bit long winded in MSIcode. Therefore I was wondering if there is a possibility to convert variable $Version$ to a DWord so that I can read the Version entry from the registry and simply do a greater than comparison.

I hope that is a little more clearer explanation.

Cheers

Matt
MatthewFinch
Posts: 11
Joined: Wed Mar 16, 2011 6:30 am

Re: Prevent downgrading of installation

Post by MatthewFinch »

Have sorted it now. Thanks for the help.
giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: Prevent downgrading of installation

Post by giaviv »

Dear Matt,

You are welcome to share your experience with us so other users can use your knowledge as well!
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
MatthewFinch
Posts: 11
Joined: Wed Mar 16, 2011 6:30 am

Re: Prevent downgrading of installation

Post by MatthewFinch »

That's a good point!
Last edited by MatthewFinch on Thu May 26, 2011 8:43 am, edited 1 time in total.
giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: Prevent downgrading of installation

Post by giaviv »

Thank you Matt.
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Post Reply