Blog entries   |  Inno Setup – creating an installer as downloader

Inno Setup – creating an installer as downloader

For the Simlock Remote Server software I needed to create a good installer that downloaded files based on installer components selected by the user and then installed the downloaded files. There are some commercial solutions for creating installers however there is also a very good and free one called ‘Inno Setup‘.

I was completely new to this install creator so I needed to do a lot of research to get it all working especially because documentation for the downloader addons isn’t very extensive / non existing. The basics of Inno Setup are not very difficult and it is well documented. Just check out the examples that come with Inno Setup and you’ll be on your way. As for the downloader addons, there are 2:

1. InnoTools downloader – This one is also linked from the official Inno Setup website. It is a good installer with some examples and some documentation on how to use it and good features. However there is no support what-so-ever for this plugin if you run into problems.

2. IsTools downloader – is part of a GUI for InnoSetup, which is good enough for simple use but I prefer just to work with the code I can see and not some GUI. The downloader part of this package does not come with any examples nor documentation, and judging from their Sourceforge page if you have questions you can wait until…… well lets just say a long time..

I first tried to do what I wanted with InnoTools and all looked good and worked smooth (so I toughed). InnoTools has better features for working with different languages and offers an download mirror option in case the normal download link fails and it is just in general a bit more user friendly to use. However it seems to contain a very weird bug. I needed to download 2 files (15mb and 23mb), on most computers both files downloaded without problems and with good speed. However on 1 computer I have it just refused to download the second 23mb file. It always stopped at 19.xx mb and gave an error (error HTTP code 200; which is not an error!). I tried EVERYTHING to fix it (changing download servers, removing language options, stripping all options etc) and it just did not work. I tried on 3 computers which I have here and for 2 it always worked perfect and third had problems (Win 7 EN, Win XP en, Win XP Dutch; with problem). Then I started hearing from several customers that they had some problem as on my WinXP Dutch machine. So it wasn’t just that one computer any more..

Like I said I tried everything, including contacting the programmer of InnoTools, but I did not get any reply there. So in the end the only solution was using the ISTool downloader dll and that one did work. Took a bit more effort to get that one working due to lack of examples but all seems to be good now.

In the end I still don’t know the reason but I made like 20 installers and tried them all on the computer with problems and nothing worked, it always failed at 19.xx mb of the download. The only thing in common which I can see so far is; the problem occurs with non English Windows installations for so far all the customers I talked to with this problem had non English Windows Installation. Oh in case you were thinking, I of course also just downloaded the file directly from that problem computer to see if there was anything wrong with the file, which was not the case.

Code for the downloading part with ISTools (you need isxdl.dll, isxdl.iss, smallimg.bmp in same dir as your installer iss script) using components to select what to download:

Name: “full”; Description: “Full installation”
Name: “compact”; Description: “Compact installation”
Name: “custom”; Description: “Custom installation”; Flags: iscustom[Components]
Name: “someinstaller”; Description: “Soft description”; Types: full compact; ExtraDiskSpaceRequired: <sizeinbytes>;
Name: “somedrivers”; Description: “drivers”; Types: full; ExtraDiskSpaceRequired: <sizeinbytes>[Files]
Source: “smallimg.bmp”; Flags: dontcopy;

function NextButtonClick(CurPageID: Integer): Boolean;
ResultCode: Integer;
hWnd: Integer;
FileName: String;
case CurPageID of
hWnd := StrToInt(ExpandConstant(‘{wizardhwnd}’));
isxdl_SetOption(‘label’, ‘Downloading  files’);
isxdl_SetOption(‘description’, ‘Setup needs to install some components. Please wait while Setup is downloading the files to your computer.’);
FileName := ExpandConstant(‘{tmp}\smallimg.bmp’);
if not FileExists(FileName) then ExtractTemporaryFile(ExtractFileName(FileName));
isxdl_SetOption(‘smallwizardimage’, FileName);
end;        //downloaddd
if IsComponentSelected(‘srssoftware’) then begin
isxdl_AddFile(‘’, expandconstant(‘{tmp}\file.exe’));
end;if IsComponentSelected(‘samsungdrivers’) then begin
isxdl_AddFile(‘’, expandconstant(‘{tmp}\driver.exe’));
end;//Start the download after the “Ready to install” screen is shown
if isxdl_DownloadFiles(hWnd) = 0 then begin
MsgBox(‘Error downloading files’, mbCriticalError, MB_OK);

if IsComponentSelected(‘someinstaller’) then begin
if not Exec(ExpandConstant(‘{tmp}\file.exe’), ExpandConstant(‘/DIR=”{app}” /SILENT /TASKS=”modifypath” /NORESTART /NOCANCEL’), ”, SW_SHOW, ewWaitUntilTerminated, ResultCode) then begin
MsgBox(‘Error installing software, please run the installer again’, mbCriticalError, MB_OK);
if IsComponentSelected(‘somedrivers’) then begin
if not Exec(ExpandConstant(‘{tmp}\driver.exe’), ”, ”, SW_SHOW, ewWaitUntilTerminated, ResultCode) then begin
MsgBox(‘The installer could not install the drivers. Please try again’, mbError, MB_OK);
Result := true;

Leave a Reply

Your email address will not be published. Required fields are marked *