PDA

View Full Version : Detecting other products with Installscript



TheStrak
07-15-2005, 03:08 AM
Hello All,
I'm actually using DevStudio 9 but there is no section for that but this is an InstallScript question so I figure it doesn't really matter.

We have a suite of four products, with the default installation folder as C:\Program Files\abc, we want to change to change this folder to C:\Program Files\xyz (obviously these aren't the real folder names!).
We only want to install to folder xyz on machines where none of the four products have previously been installed to folder abc.
Does anyone know how I can use installscript to detect this and then change the target folder accordingly? I know I could do it by checking for each installations GUID in the registry, but I'm not sure if each version of Windows (95, 98, NT4, 2000, XP) uses the same part of the registry to store this information. Is there a function to check for other installed apps more easily? If so some code to do this would be very handy!

Any ideas?
Cheers :)

dbriggs
07-15-2005, 10:40 AM
Unless you have already stored the information you need somewhere else... ok I suppose not ... the best place to look is usually in the Registry. If each Setup is InstallScript, it will create an uninstall entry under:-

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

This Key is standard on everything from 95 up to 2003.

Each product/uninstall has a separate {PRODUCT_GUID} Key that is used by Add/Remove Programs and there are several Strings and things in there. Unfortunately, none of the default values contain a pointer to the install directory.

So, a DS9 Setup doesn't write an InstallLocation= String with anything useful by default, but that's the best way to do it. Oh, you haven't done that yet? Well do it now so you don't forget! Then you can simply look up the GUIDs.

Otherwise, you will have to think up something that each product does in the Registry or the filing system to identify itself. If there is such a thing, then write some InstallScript to find it for each possible variant. This is going to be more complicated. If that doesn't work, you may have to go looking on the disk. That would be much slower than reading the Registry...

Hope that helps,

David

P.S. For the DS9 Forums, look under "Legacy Installer Products"...

TheStrak
07-18-2005, 03:16 AM
Thanks for that.
Luckily the person that worked on the installs before I did (using Installshield 6) had the foresight to set the InstallLocation, so it's all fairly straightforward now I know that all versions of Windows store the installation stuff in the same bit of the registry.

Cheers :)

dbriggs
07-18-2005, 06:45 AM
I have some code that looks in HKEY_CURRENT_USER for non-privileged installs on NT+ systems. I wrote it some time ago (IS3 possibly $;-) and don't remember whether it is really needed any more. It might be worth checking there if you can't find your key in HKEY_LOCAL_MACHINE. Or, do a non-privileged install on NT+ and see where it goes!

David

TheStrak
07-19-2005, 06:59 AM
Thanks for that, I'll give it a go!