InnoSetup: Check oldest version of app and show info message - installation

How to check that oldest version of application was installed during process of installation new version? What do I mean? I want before start installation start check process with dialog "please wait", if my installation found old version I can provide dialog "update or delete old and install new".
How can I do it?
Thanks.

I'm not sure whether this can be done at all, as running an InnoSetup-setup always assumes that you want to install new or update an existing installation. I don't think you can switch a setup from "installation mode" to "uninstallation mode" upon user's choice as you'd like it to do.
InnoSetup works differently than Windows Installer at that point. It has a separate installer and uninstaller as opposed to Windows Installer, which "contains both".
If you want that feature, you may want to look into Windows Installer XML (WiX), which creates MSI setups and can do exactly what you're looking for.
EDIT
First of all, thanks for the downvote. I don't quite know why anybody would downvote a perfectly reasonable reply, but I guess I'll have to cope with it.
To answer your comment about BeforeInstall: If you read the documentation you will notice that BeforeInstall is called before an item is installed. Quote from docs:
The name of a function that is to be called once just before an entry is installed
What you want to do comes down to:
Decide whether the user should be able to choose if he wants to install or uninstall when setup is run
install or uninstall depending on user's choice
What I'm trying to say is that as far as I know you can not switch from installation mode (setup.exe is run) into uninstallation mode (uninstall.exe is run) from your installation script.
InnoSetup assumes that running Setup.exe is equivalent to wanting to installing or upgrading. I the user had wanted to uninstall, he would have run the uninstaller, not the setup.

Related

Is there a "best" way to forcibly "uninstall" a product when the MSI fails during uninstall?

My install fails on uninstall because of a bug in my CustomAction. I've fixed the bug, but I now have a test machine with that product installed and I can't get it to uninstall (keeps rolling back and staying).
In the past (years ago), I used msizap.exe that comes with the Windows SDK. But it doesn't seem to come with it anymore. I installed it and can't find it. My only guess is that it's no longer relevant in Windows 10.
Anyway, is there a best way to forcibly remove the product so that Windows no longer thinks it's installed?
msizap.exe: You are correct, msizap.exe has been deprecated long ago.
Broken Uninstall Workarounds: This problem is very common. You can find a list of approaches for these kind of uninstall problems here.
The easiest and fastest is probably to just use the Microsoft FixIt tool to remove the package. This basically "unregisters it" by the looks of it, and is similar to msizap.exe in that regard.
If this is just a single machine you can hack the cached installation database using Orca (how to find cached msi path, powershell version, using Windows Explorer - point 2) - if it involves many machines you should make a patch. Please see details in link above.
Virtual Machines: It is obvious, but just to mention that you should check setups on virtual machines so you can just revert the virtual machine when you encounter "development and QA bugs" like these.
Custom Action Flag: You can also add a condition to each custom action so that you can disable the whole custom action from running by a custom command line sent to msiexec.exe.
If your flag is a property RUNCA="1", then you can disable it by setting this flag property to 0 via the command line - this is sort of a little inoculation for the package's uninstall feature breaking - you can disable custom actions from running at all during install / uninstall - it might even be useful for your tech-support guys and real-world installations:
msiexec.exe /x {PRODUCT-CODE} RUNCA=0

How exactly does windows remember which programs are installed?

I am having trouble uninstalling a package from Windows 7 that I myself have created with InstallShield.
Running remove program from control panel only got 1/2 way before it aborted and rolled back.
Funnily it reported the problem being one of my install steps, not one of the uninstall steps.
Frustrated I used the Windows Install Cleanup and the package is no longer listed under Remove programs.
However when I try to run the installer once more it reports that a previous version of the software must be uninstalled before it can proceed.
I was guessing that the Unique ID was still present in the registry but is not.
How exactly does windows determine that a previous version of the software is installed on my machine?
The best solution to an uninstall issue that prevents the product from being uninstalled is to debug the issue (often a custom action) and fix it or delete it, then rebuild the MSI with the same ProductCode. Then reinstall it with a command line:
msiexec /I [path to msi file] REINSTALL=ALL REINSTALLMODE=vomus
which updates the product in place and the re-cached fixed product will now uninstall. Otherwise (because you can't recreate the MSI) it is possible to go into the cached MSI in C:\Windows\installer and change the MSI manually with Orca, conditioning CAs not to run, for example. But you need to know what you're doing.
In other words and unfortunately, it would have been better to get the uninstall issue dealt with before resorting to the installer clean up utility, which I believe may no longer be supported because it doesn't completely clean up the system.
Your best approach now is to change your ProductCode, UpgradeCode and PackageCode because they'll be among the items on the system that Windows will use to see that your product is already installed. This stuff is in the registry, but it's obfuscated (rearranged guids) and scattered around.

Intallshield Programming - Reboot behavior - Windows does not ask user to close open files before restart

My engineer send me 2 versions of installation software for evaluation (made with Installshield), which he said he has made no changes to the Restart settings, but just changes messages in dialog boxes.
However, when tested on Win 8 and Win 7
One version will restart Windows while Windows does not prompt there are applications with open files
One version will attempt to restart Windows, but then Windows will prompt there are applications with open files
I am not a programmer, but I would like to know what may be possible cause of this difference? And what is the setting which can cause the 2 different restart behavior.
Then I would like to know how can I test the installation software to make sure it is designed properly and make Windows attempts to restart properly such that it won't force a restart if there is any open files; after all, making users lose their work is very bad.
Thank you very much.
John
If your Installer installs any prerequisites, it may be possible that the reboot is required to install the prerequisite properly. So it is possible that the prerequisite would be installed when you wold have installed your product for the first time and it would have asked for the 'Restart'. And now as the prerequisite is installed, no need to reinstall it so 'Reboot' is not required.
If this is the case, you can go to'Application Data' > 'Redistributables' and edit the prerequisite. Here you can specify appropriate condition to handle the 'Restart' behavior.
If your application doesn't install prerequisite and it is your product that requires a reboot, please have a look at this answer. You can configure a property to handle the 'Restart' properly.

How to automate uninstallation of software from old InstallShield?

I'm writing a new installer for our legacy software. The installer was originally built with InstallShield Professional 6.40, and I'm now building it in Inno Setup. Because of major changes in the software's infrastructure, I need to first uninstall the old one so that I can perform a fresh installation using the new one (using Inno Setup).
The old version was installed in the drive's root (C:\SoftwareName\) And now I'm moving it to its appropriate place in the Program Files - as well as changing the registry key names. So although it's the same software, it's really treated as a completely different software.
I have found the entries in the registry for the old installation:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{[OUR GUID]}
And in here, there is an entry for uninstall information in UninstallString:
RunDll32 C:\PROGRA~2\COMMON~1\INSTAL~1\engine\6\INTEL3~1\Ctor.dll,LaunchSetup "C:\Program Files (x86)\InstallShield Installation Information\{[OUR GUID]}\Setup.exe"
The second part of that, I know I can execute to launch the "Modify / Uninstall" wizard. But this needs to be automated, showing only the progress of uninstalling.
I've found the following links:
http://www.symantec.com/connect/blogs/various-silent-parameters-uninstalling-installshield-applications
http://pic.dhe.ibm.com/infocenter/pcomhelp/v6r0/index.jsp?topic=%2Fcom.ibm.pcomm.doc%2Fbooks%2Fhtml%2Finstall_guide12.htm
But these appear to refer to newer versions of InstallShield. Our installation was with a very old one (6.40). I've managed to use that wisdom at least to initiate the uninstall like so...
RunDll32 C:\PROGRA~2\COMMON~1\INSTAL~1\engine\6\INTEL3~1\Ctor.dll,LaunchSetup "C:\Program Files (x86)\InstallShield Installation Information\{[OUR GUID]}\Setup.exe" -10x9 -uninst -s -w
But it still gives a yes/no prompt if user wishes to uninstall...
This process is supposed to...
Run silently with no wizard or user prompts
Display just the progress of uninstall
Wait until uninstall is complete before returning
But I have no luck accomplishing those things.
What's the appropriate way to perform this uninstall?

Why does InstallShield ask for a restart?

I have an installshield installer that works fine under normal circumstances. But when I run it while a particular software is running, the installer asks for a restart at the end.
Now on some research I have come to learn that a restart is asked only when the installer wants to modify files that are currently locked by other processes.
Is there anyway that I can find out which is the file installsheild wants to modify? (but cannot because it is locked by another process)
I would also like to know if it is only file modifications that affect the restart/no restart or is it also associated with registry key modifications.
You can use WhyReboot after the setup, it will show you pending reboot file and registry keys that could not be modified during the setup.
You tagged your question with "windows-installer", so I'm assuming you're using InstallShield to author an MSI installer.
Run the other software app, do a complete log of your install, like:
msiexec -i file.msi -l*vx test.log
In the resulting log, look for all lines containing "RESTART MANAGER". You will get more data on what is prompting for the reboot.
In my case, my installshield project had a "RebootPrompt" User Interface at the end of the Installation sequence with a condition "NOT INSTALLED". So all new installations would always show that Reboot prompt even if not needed.

Resources