Can I cancel installation with inno setup after all files are installed - inno-setup

I am using inno setup. Is it possible to create custom page after copying all files:
Page := CreateCustomPage(wpInstalling, 'expl', 'expl 2');
or with other parameters. There is no cancel button. May this page to be able to cancel Installation and revert all files?

Related

Inno Setup - How to change the icon of the shortcut of uninstaller without separate icon file?

Is it possible to change the icon of the uninstaller shortcut in the Start menu without storing a separate icon file (to the app folder)?
I see this: Using Resource Hacker for changing the icon after the build, but I cannot implement it.
My code:
[Icons]
Name: {group}\{cm:UninstallProgram,{#MyAppName}}; Filename: {uninstallexe}
An icon of a Windows shell shortcut can be set by an external icon file (what you do not want) or by the file the shortcut points to. So you have to modify the icon of the uninstaller.
You have to modify the uninstaller icon on a compile time.
You cannot do this on install time, as the uninstaller includes its own checksum. If you modify the uninstaller, it with refuse to start, claiming it is corrupted. Unless you find out how to also fix the checksum stored in the uninstaller.
But Inno Setup does not really allow modifying the uninstaller icon on a compile time.
What you can do, is to abuse the SignTool "callback". The command set to SignTool processes even the uninstaller. And it can actually do anything with the uninstaller, not only "sign" it. But it has to "sign" it in any case (Inno Setup explicitly checks that the executable was signed after the "tool" finishes).
You can achieve that by setting SignTool to a batch file (or other script) that will run the actual signtool.exe in the end, but before that, it will modify the icon (e.g. using Resource Hacker command-line).
For an example of such batch file that both modify the uninstaller and signs it, see Microsoft SmartScreen - suspended using Inno Setup installer?
So this is doable, only if you do code signing (what you should anyway). You need a code signing certificate for that.
Disclaimer: Adding a shortcut to an uninstaller to Start menu is against Windows guidelines (and creating Start menu groups is against Windows guidelines for Windows 8 and above at least).

Inno Download Plugin - Only download updated files

I'm trying to find the best way of updating my program using Inno Setup and Inno Download Plugin (IDP). My program is around 3.5gb in size so finding a way where the user doesn't have to download 3.5gb everytime I release a 100mb update is really important.
Currently I have IDP downloading all the files for my program from my FTP using the code below:
procedure InitializeWizard();
begin
idpSetLogin('%%username%%', '%%password%%');
{Add all files in URL, including subdirectories}
idpAddFtpDir('%%myftp%%','', ExpandConstant('{tmp}'), true);
idpDownloadAfter(wpReady);
end;
What is the best way to deliver updates to users so that they only have to download the updated files and not all 3.5gb?
The Inno Download Plugin has no API to retrieve a timestamp of a file on the server.
So you have to solve it another way.
The easiest to implement in Inno Setup, would be to a have an online service (say a simple PHP script) that the installer will call with version a number of the installed program and version number of the program being installed. The service will list the files that need an update and the installer will act accordingly. Or you can have the installer send timestamps of all installed files, and the service to check the files one by one, listing those that need an update.
If you cannot build such online service, another option is have a static plain text file with list of files and their timestamp. Upload the files to the FTP server. The file will need to be updated everytime you update the files on the server. The installer will download the file, parse it and decide itself what files need update.

Creating another page and requiring a directory and checking if a specific file exists in that directory

I have Created a Inno Setup script using its wizard, now it's what I need, However, I want to create an additional page after the Installation Directory selection page, requiring another directory And if the user selected the directory, The "Next" Button should only enable when a specific file exists in that directory.
Can this be done in Inno Setup?
Short answer: Yes it can be done.
You have to code the new page using Pascal scripting.
For a start:
Use the CreateInputDirPage support function to create the new page.
Use the NextButtonClick event function to control, if the user is allowed to proceed.
Use the FileExists support function to test, if the file exists.

How I can create and remove a network drive from Inno Setup?

I'm writing a Inno Setup script which need to execute a very old third party setup application, this old installer (called setup.exe) only works from a root folder (if not fails), so I need to create (and remove) a network drive to copy the files of this installer and then execute the setup.exe. so the question is how i can create and remove network drive from Inno Setup? I am looking something like the WNetAddConnection function.
You can use the WshNetwork object, which is part of the Windows Script Host:
var
WshNetWork : Variant;
begin
WshNetWork:=CreateOleObject('WScript.Network');
//create the network drive
WshNetwork.MapNetworkDrive('H:', '\\localhost\c$\data');
//do your stuff here
//remove the network drive
WshNetwork.RemoveNetworkDrive('H:');
end;

NSIS installer like loader

For my project i need to do next:
Install Silverlight
Install XAP file
Run XAP file
It takes only 3 minutes, no configuration, just click-and-install
I would like to hide all controlls (progress bar, buttons, log list). Just logo and gif loading animation. All steps to create installer was done, so now i need to know could i do such customization or not?
Create simple NSIS installer with SILENT flag.
Use Exec to execute Silverlight and XAP installation (also in quiet mode) and filanne use ShellExecute to open a XAP file.
I am not sure if you want to hide silverlight's buttons or your one.
Silverlight: try quiet mode: /q.
Your: that long story, we need your NSIS code first.

Resources