InnoTools Downloader does not work with Inno 5.5

Following the recommendation of a few posts here at SO, I worked with InnoTools Downloader to try and install a third-party dependent for our application during the installation of the script in Inno settings.

Unfortunately, InnoTools Downloader does not update after a few years and begins to look incompatible with the current installation of Inno Tools (5.5.2 (u) on my machine currently). The PChar parameters in ITD have been replaced with PAnsiChar parameters, and when I try to execute various ITD_xxx procedures, it gives me a different degree of failure:

  • ITD_DownloadFiles gives a type mismatch error and will not compile in Inno Setup
  • ITD_DownloadFile compiles, but the file that is displayed has a length of 6 KB and does not work.

Has anyone received ITP to work with new versions of Unoode Inno (post-5.3.0)? Or do I need to look for another solution?

EDIT To clarify things a bit, I tried to go into the it_download.iss file and replace all instances of PChar with PAnsiChar. This led me to compilation errors when I first tried to integrate ITD with my setup script.

Here is an example Inno script section:

 [Code] procedure InitializeWizard(); begin ITD_Init; // initialize the InnoTools Downloader // install 3rd party tool (ex. Git) from the internet. if ITD_DownloadFile('http://git-scm.com/download/win',expandconstant('{tmp}\GitInstaller.exe'))=ITDERR_SUCCESS then begin MsgBox(expandconstant('{tmp}\GitInstaller.exe'), mbInformation, MB_OK); Exec(ExpandConstant('{tmp}\GitInstaller.exe'), '', '', SW_SHOW, ewWaitUntilTerminated, tmpResult); end end; 

When this is started, a dialog box will appear in which it will be "downloaded" and the file will be saved - on my machine it is in the subdirectory c: \ Users \\ AppData \ Local \ Temp. This file is 6 KB, unlike the file downloaded from http://git-scm.com/download/win , which is currently 15,221 KB.

The ITP_DownloadAfter method gives a similar result.

+6
source share
1 answer

With the exception of replacing all PChar types of type PAnsiChar you will need to replace all occurrences of type string with AnsiString in the it_download.iss file. The next problem is the URL you are trying to get. The file size is different than expected because you are uploading an HTML document instead of the binary file to which this site is redirected. So, if you have ITD ready for Unicode, change the URL in the script to a direct binary URL . Please note that I did not use HTTPS because ITD does not currently support SSL. The code proof might look like this:

 [Code] const GitSetupURL = 'http://msysgit.googlecode.com/files/Git-1.8.4-preview20130916.exe'; procedure InitializeWizard; var Name: string; Size: Integer; begin Name := ExpandConstant('{tmp}\GitInstaller.exe'); ITD_Init; if ITD_DownloadFile(GitSetupURL, Name) = ITDERR_SUCCESS then begin if FileSize(Name, Size) then MsgBox(Name + #13#10 + 'Size: ' + IntToStr(Size) + ' B', mbInformation, MB_OK) else MsgBox('FileSize function failed!', mbError, MB_OK); end; end; 
+6
source

Source: https://habr.com/ru/post/956187/


All Articles