Inno Setup clean uninstall not possible with shell extensions [duplicate] - inno-setup

This question already has answers here:
Use RestartManager during Uninstall (Inno Setup)
(1 answer)
How do you close then restart explorer.exe in Inno Setup uninstall using the Restart Manager?
(1 answer)
Closed 2 years ago.
I'm using Inno Setup 6.0.5 and I register two shell extension DLLs which are similar to the ones from ownCloud. One DLL registers a dynamic context menu, another DLL adds overlay icons.
I'm using the facilities Inno Setup provides to do this step. That means:
[Setup]
ChangesAssociations=true
ChangesEnvironment=true
[Files]
...
Source: "shell-integration\*"; DestDir: "{app}\shell-integration"; Flags: regserver 64bit; Check: IsAdminInstallMode;
What I observe is the following:
After the setup finished, the overlay icons are not active. They only are once I force-restart explorer.exe manually. There are sources like this which claim that this is possible by calling SHChangeNotify and SendMessageTimeoutW, but they are obviously wrong, since I am doing exactly that (see ChangesAssociations and ChangesEnvironment which are supposed to do this).
After uninstalling, the app directory is not deleted, because the 2 DLLs files are still locked. This also inhibits updating my application. Inno Setup is supposed to detect locked files and offer to close the apps that lock them, but that mechanism doesn't seem to work... Also, uninsrestartdelete flag is of no use, as this causes Inno Setup to delete the files only after a reboot, but I don't want to force the user to restart the machine in case they upgrade the application.
What am I supposed to do? The only solution I see is to do everything myself, and not rely on [Files] and regserver flag. Especially the uninstallation requires to first unregister the DLL, then force-restart explorer.exe, then actually delete the files and folders. I would do this in CurUninstallStepChanged in the if CurUninstallStep = usUninstall block. And to restart explorer.exe I would modify CurStepChanged in the if (CurStep = ssDone) block.

Related

Make installer capable of installing addon files to various applications in Inno Setup

I have a set of files (scenery data of an airport) that should be installed to one of several applications (3 different flight simulators) depending on the target applications being installed. If more than one is installed, the user has to choose into what application the set of files should be installed.
Of course I could write for each application a separate installer but that would make it awkward to maintain and blow up the number of installers since there are many sets of files to install.
Problem is that depending on the chosen application the AppId, the installation destination and other installation values changes.
I intend to write a custom wizard page that is shown immediately after the welcome page to find out which of the target applications are installed and let the user choose the required application in case there are several installed.
My current problem is that the files to copy are not fully the same for each possible application. So I need in the [Files] section the posibility to copy a file to its target location depending on the application selected. I hoped to find a general parameter for the [Files] section that could be used to copy or not. But I could not find one. How could I solve this problem? I also studied [Components] and [Tasks] to find a solution but was not successful.
Thanks for any hint how to solve my problem!
To answer your literal question: Use Check parameter to bind [Files] (and other) section entries to the selection on the custom page.
Some examples:
Inno Setup - Multiple software versions in one installation
How to install only file based on condition (external configuration file) in Inno Setup
Conditional file copy in Inno Setup
Inno Setup: How to auto select a component by comparing a register key version?
Though you also might consider using a preprocessor to easily maintain and auto-generate multiple installers from same source script.
For an example, see:
Compile Inno Setup installer for specific component only

Remove read-only attribute from existing files in Inno Setup

I'm creating a setup with Inno Setup. This setup adds files to a "main program" and after installing some files it runs another custom program which kind of unpacks some previously installed files.
This unpacking program relies on some existing files being writable, which usually is the case. But on development machines these files are under version control and therefore write protected (have read-only attribute).
The unpacking program just doesn't unpack when these files are write protected (maybe it shows a warning in the console, but the console is hidden so one won't see this warning). And I can't change the code of this unpacking program.
So, I'm looking for a way to make these files writable with Inno Setup even though these files are not installed by Inno Setup.
How can I achieve this?
There's no built-in mechanism for that in Inno Setup.
But you can do almost anything from Pascal Script using WinAPI. In this case, you want to use SetFileAttributes.
For an example how to use SetFileAttributes from Inno Setup, see:
Inno Setup Code section create hidden file

Where is Inno Setup uninstaller executable?

I'm very new to Inno Setup, so forgive my ignorance on this one.
I created a very small install script and it's building and working the way I want—I get my setup.exe built to the output directory, and all the source files are being copied to my specified destinations.
Now I want to make sure users can uninstall the files that I specified in my [Files] section of my script. The problem is I don't understand how Inno Setup handles this. I assume Inno Setup doesn't make an executable specifically for Uninstall, but even if I run setup.exe after I have installed my application, the wizard doesn't ask if I want to uninstall.
However, if I enable the Run menu's Target Uninstall in the ISC compiler, I am able to uninstall the files. So my question is, how do I uninstall my application outside of the ISC compiler. In my [Setup] section I do have Uninstallable=yes.
I know this is a total noob question, but any help is appreciated.
(As you have found yourself), Inno Setup creates an entry in Add/Remove Programs Control Panel applet (if CreateUninstallRegKey is yes).
The entry is a link to an uninstaller program, which is generated by the compiler (when Uninstallable is yes).
The uninstaller program is located by default in the application directory (unless overridden by UninstallFilesDir) and is named unins001.exe (the number is incremented, if needed, to avoid naming conflicts).

Inno Setup /SUPPRESSMSGBOXES customisation

I have a setup that is installing a PDF program. It works perfectly on test machines. When there is other PDF software on the machine, errors pop up because of the large number of shared files that are inuse.
Inno has the /SUPPRESSMSGBOXES option. However I can not seem to configure this to ignore the file copy - it either wants to Abort or Retry. Abort - the setup will fail. Retry - will never succeed because the file is in use.
Does anyone know how to automatically ignore any copy file errors while setting up?
You can use the restartreplace flag for the files that may be in use, it is exactly to suppress those error dialogs.
To quote the documentation of the [Files] section:
restartreplace
When an existing file needs to be replaced, and it is in use (locked) by another running process, Setup will by default display an error message. This flag tells Setup to instead register the file to be replaced the next time the system is restarted (by calling MoveFileEx or by creating an entry in WININIT.INI). When this happens, the user will be prompted to restart their computer at the end of the installation process.

How do I have Inno Setup update multiple locations?

I have an application that uses Inno Setup as its installer.
I am now writing an updater using Inno Setup to apply some updates to various installed locations.
This application can be installed on removable flash drives as a portable app and I would like to be able to roll out the updates across several drives/locations/directories for each drive attached to the PC at once.
Is there a way to get Inno Setup to roll out its contents as an update to each location in an array of locations?
Not directly. One option is to build an install for the files that is designed to be silent.
Then write a second install that compiles that uses the first one. Then you [Code] Section you could call ShellExecute() executing the first installer. You could call the first installer as many times as you wanted.
Although, I suspect this may really creates havok on the Add/Remove Programs.

Resources