From fed0153384f767c4d74e03c25ff9a2c36c7920c0 Mon Sep 17 00:00:00 2001 From: Martijn Laan Date: Sun, 21 Mar 2021 13:40:07 +0100 Subject: [PATCH] Make the iscrypt download optional via the wizard instead of requiring a command line parameter. To avoid unexpected downloads the option is disabled by default. It still doesnt redownload if iscrypt.dll is already present (unlike ISPack did). --- iscrypt.ico | Bin 0 -> 4286 bytes iscrypt.iss | 163 +++++++++++++++++++++++++++++++++++++++++++++++++++ setup.iss | 38 ++---------- whatsnew.htm | 2 +- 4 files changed, 168 insertions(+), 35 deletions(-) create mode 100644 iscrypt.ico create mode 100644 iscrypt.iss diff --git a/iscrypt.ico b/iscrypt.ico new file mode 100644 index 0000000000000000000000000000000000000000..63adf1166dbae2b42b1d8e680afba5b3b4db2a5f GIT binary patch literal 4286 zcmds)dr(wYwucXhC+k`>b!T zb=F>8M-Vi`mrN$~y$cnFf?z5Lg1sowB>0Kyv-b_9_}%}bp()1FCyjrOsj#kDl2P5{ zm;2GhdHdDZQ&j5qU1^0Ce*gTN|G;{H=tEzWktj)cN~Uf4p}LK#hK`=2ZC`Tu;#~^P zwsZLMeGayEk-WQvO@$Sy{{il=E(VEyiK$gfWR?7T5-nM+1=R7^(9Dphgj7Ii`H_9jKv z#`B8Z`)@8-Jb!yqMKjr--lpJu5Bbe^+24AP^2-mXYX6Fw&mWUsa+27+$51E~eraiG zJ~=r#BmWFL!q+2oZJ>X*V%dDsBbJi+{$I&Ti6c2Lm4wV>6vgEzGLbg*4LNle zIC%aJ`RW_wiQ3)RMb?>{tjgHO7S%EK?c4WOAGfNi%Hj9;Z<}iQEs>jbukvvqda4I8 zGbXZb?lcs^fy5>*Cv0mpp@|VB=H;_uT_o#^Ye_xQOu^M>6m@)0ZtFuzZ+uVjmB;LE zy31l^K8qAN9IrdoS1-Rif`$p9OJsvsAvYjojD#>JGor@Z5Hrb{b+fz)SviNm=!MK# zwSds{%>+iwC$2=z#=~k<&9^vt>l;pe(Tlq0?=(F4@t0c6DnH4}?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WuG(i3*TV;&T))cuaE7zf!HMJV6jRE;~*^zrfZ=$ zSqF)q5tiOk^}i%vG;|$yI`*K(hev1T@Xdt?zUxTlhprv`c)x(-PwFXuRL7BqGi0_d(uE^19IqGHAOFi* zKf_07=JtNm8o~FUD|ykqPh{8fb8j;*zq`cK?=GV5JxA5UqvUqw68G5>=6+;NfOs~& z%fxe9IT455V;EcH!xDvzQ9E6*OcejCRu08vxfDsT6ure}-TkqDwLNJJR`y<6%?~%W z@>5SKKY#rRFP~rJ)%R`Oeb&O|r>)dHu4i}GJ~p%|2y2|p+f|0VCH5%qViVkQhhm!V z&a(BE*k`*TPqe}^O5{hHVG=PKgN4S*Us?UlPn$yx6B@j_H(Z>~PxniC`Q$XOo?j68 zSGoVJmBxo^@t#z2;Lcu_-q=Bmcs3T-dor`i28T?2y!YEP@xTP!_juyDRjh?XYmsk` z#Y#I&LS@}Hvj_a)laI}(UM?fmBRKMTG(Ue;%d2N6KHzDl` zR$oqL?q{ilsKc1|Q5X|S18^+~V%%^IHE{ymvrf1Ka5g}2TKoz&vlYu04Klq<6cYYU?4S_J=nJ&oQ=u~c1N z&wHJ@%)ORQL~AljukK+*^IjI8+Qz$e+gWrt4!48v_e!_>|LM42-%ntp+{LZIT5a9z z#N?w6hzSR~yUR6G=Gl4^~f)u#mm( z^WXXGTyGj^Qmdn$bbb+`ZAxZ*JcT#JUa_P$fRGY5$_t!X)RZXp#7&I<+iJDRp#Z;s zhx13*#Gi1G86PzZbguJLPN|u!ns{Q4+N086Wt?HG^w{eZs9Q7l59|B481#*wV|;lb zScw{hQW)?`5Qe-EpKHGrbx%}-DCPf3^dsp04&vB`v3p{ literal 0 HcmV?d00001 diff --git a/iscrypt.iss b/iscrypt.iss new file mode 100644 index 000000000..b641a28f2 --- /dev/null +++ b/iscrypt.iss @@ -0,0 +1,163 @@ +// -- IsCrypt.iss -- +// Include file with support functions to download encryption support +// Must be included before adding [Files] entries +// +[Files] +Source: "iscrypt.ico"; Flags: dontcopy +Source: "{tmp}\ISCrypt.dll"; DestDir: "{app}"; Flags: ignoreversion external skipifsourcedoesntexist touch + +[Code] +const + ISCryptHash = '2f6294f9aa09f59a574b5dcd33be54e16b39377984f3d5658cda44950fa0f8fc'; + +var + ISCryptPage: TWizardPage; + ISCryptCheckBox: TCheckBox; + +function GetModuleHandle(lpModuleName: LongInt): LongInt; +external 'GetModuleHandleA@kernel32.dll stdcall'; +function ExtractIcon(hInst: LongInt; lpszExeFileName: String; nIconIndex: LongInt): LongInt; +external 'ExtractIconW@shell32.dll stdcall'; +function DrawIconEx(hdc: LongInt; xLeft, yTop: Integer; hIcon: LongInt; cxWidth, cyWidth: Integer; istepIfAniCur: LongInt; hbrFlickerFreeDraw, diFlags: LongInt): LongInt; +external 'DrawIconEx@user32.dll stdcall'; +function DestroyIcon(hIcon: LongInt): LongInt; +external 'DestroyIcon@user32.dll stdcall'; + +const + DI_NORMAL = 3; + +procedure CreateCustomOption(Page: TWizardPage; ACheckCaption: String; var CheckBox: TCheckBox; PreviousControl: TControl); +begin + CheckBox := TCheckBox.Create(Page); + with CheckBox do begin + Top := PreviousControl.Top + PreviousControl.Height + ScaleY(12); + Width := Page.SurfaceWidth; + Height := ScaleY(Height); + Anchors := [akLeft, akTop, akRight]; + Caption := ACheckCaption; + Parent := Page.Surface; + end; +end; + +function CreateCustomOptionPage(AAfterId: Integer; ACaption, ASubCaption, AIconFileName, ALabel1Caption, ALabel2Caption, + ACheckCaption: String; var CheckBox: TCheckBox): TWizardPage; +var + Page: TWizardPage; + Rect: TRect; + hIcon: LongInt; + Label1, Label2: TNewStaticText; +begin + Page := CreateCustomPage(AAfterID, ACaption, ASubCaption); + + try + AIconFileName := ExpandConstant('{tmp}\' + AIconFileName); + if not FileExists(AIconFileName) then + ExtractTemporaryFile(ExtractFileName(AIconFileName)); + + Rect.Left := 0; + Rect.Top := 0; + Rect.Right := 32; + Rect.Bottom := 32; + + hIcon := ExtractIcon(GetModuleHandle(0), AIconFileName, 0); + try + with TBitmapImage.Create(Page) do begin + with Bitmap do begin + Width := 32; + Height := 32; + Canvas.Brush.Color := Page.SurfaceColor; + Canvas.FillRect(Rect); + DrawIconEx(Canvas.Handle, 0, 0, hIcon, 32, 32, 0, 0, DI_NORMAL); + end; + Width := Bitmap.Width; + Height := Bitmap.Width; + Parent := Page.Surface; + end; + finally + DestroyIcon(hIcon); + end; + except + end; + + Label1 := TNewStaticText.Create(Page); + with Label1 do begin + AutoSize := False; + Left := WizardForm.SelectDirLabel.Left; + Width := Page.SurfaceWidth - Left; + Anchors := [akLeft, akTop, akRight]; + WordWrap := True; + Caption := ALabel1Caption; + Parent := Page.Surface; + end; + WizardForm.AdjustLabelHeight(Label1); + + Label2 := TNewStaticText.Create(Page); + with Label2 do begin + Top := Label1.Top + Label1.Height + ScaleY(12); + Width := Page.SurfaceWidth; + Anchors := [akLeft, akTop, akRight]; + WordWrap := True; + Caption := ALabel2Caption; + Parent := Page.Surface; + end; + WizardForm.AdjustLabelHeight(Label2); + + CreateCustomOption(Page, ACheckCaption, CheckBox, Label2); + + Result := Page; +end; + + +procedure IsCryptInitializeWizard; +var + ExistingFileName, Caption, SubCaption1, IconFileName, Label1Caption, Label2Caption, CheckCaption: String; +begin + if WizardForm.PrevAppDir <> '' then begin + ExistingFileName := AddBackslash(WizardForm.PrevAppDir) + 'ISCrypt.dll'; + try + if GetSHA256OfFile(ExistingFileName) = ISCryptHash then + Exit; + except + end; + end; + + Caption := 'Encryption Support'; + SubCaption1 := 'Would you like to download encryption support?'; + IconFileName := 'iscrypt.ico'; + Label1Caption := + 'Inno Setup supports encryption. However, because of encryption import/export laws in some countries, encryption support is not included in the main' + + ' Inno Setup installer. Instead, it can be downloaded from a server located in the Netherlands now.'; + Label2Caption := 'Select whether you would like to download and install encryption support, then click Next.'; + CheckCaption := '&Download and install encryption support'; + + ISCryptPage := CreateCustomOptionPage(wpSelectProgramGroup, Caption, SubCaption1, IconFileName, Label1Caption, Label2Caption, CheckCaption, ISCryptCheckBox); + + ISCryptCheckBox.Checked := ExpandConstant('{param:downloadiscrypt|0}') = '1'; +end; + + +function IsCryptNextButtonClick(CurPageID: Integer): Boolean; +var + DownloadPage: TDownloadWizardPage; +begin + Result := True; + if (CurPageID = wpReady) and (ISCryptCheckBox <> nil) and ISCryptCheckBox.Checked then begin + if DownloadPage = nil then + DownloadPage := CreateDownloadPage(SetupMessage(msgWizardPreparing), SetupMessage(msgPreparingDesc), nil); + DownloadPage.Clear; + DownloadPage.Add('https://jrsoftware.org/download.php/iscrypt.dll', 'ISCrypt.dll', ISCryptHash); + DownloadPage.Show; + try + try + DownloadPage.Download; + except + if DownloadPage.AbortedByUser then + Log('Aborted by user.') + else + SuppressibleMsgBox(AddPeriod(GetExceptionMessage), mbCriticalError, MB_OK, IDOK); + end; + finally + DownloadPage.Hide; + end; + end; +end; \ No newline at end of file diff --git a/setup.iss b/setup.iss index d715c0da5..e1879eef3 100644 --- a/setup.iss +++ b/setup.iss @@ -6,6 +6,8 @@ ; Portions Copyright (C) 2000-2021 Martijn Laan. All rights reserved. ; For conditions of distribution and use, see LICENSE.TXT. +#include "iscrypt.iss" + #include "isdonateandmail.iss" #include "isportable.iss" @@ -78,7 +80,7 @@ Name: english; MessagesFile: "files\Default.isl" #expr FindFiles("files\Languages\") [Messages] -HelpTextNote=/PORTABLE=1%nEnable portable mode.%n/NODOWNLOAD=1%nDisable ISCrypt.dll download. +HelpTextNote=/PORTABLE=1%nEnable portable mode.%n/DOWNLOADISCRYPT=1%nEnable ISCrypt.dll download. ; Two "Setup" on the same line looks weird, so put a line break in between english.WelcomeLabel1=Welcome to the Inno Setup%nSetup Wizard @@ -184,7 +186,6 @@ Source: "files\ISPP.chm"; DestDir: "{app}"; Flags: ignoreversion touch #endif Source: "files\{#isppdll}"; DestName: "ISPP.dll"; DestDir: "{app}"; Flags: ignoreversion signonce touch Source: "files\ISPPBuiltins.iss"; DestDir: "{app}"; Flags: ignoreversion touch -Source: "{tmp}\ISCrypt.dll"; DestDir: "{app}"; Flags: ignoreversion external skipifsourcedoesntexist touch [INI] Filename: "{app}\isfaq.url"; Section: "InternetShortcut"; Key: "URL"; String: "https://jrsoftware.org/isfaq.php" @@ -208,35 +209,4 @@ Filename: "{app}\Compil32.exe"; WorkingDir: "{app}"; Description: "{cm:LaunchPro [UninstallRun] ; The /UNASSOC line will be automatically skipped on portable mode, because of Uninstallable being set to no -Filename: "{app}\Compil32.exe"; Parameters: "/UNASSOC"; RunOnceId: "RemoveISSAssoc" - -[Code] -const - ISCryptHash = '2f6294f9aa09f59a574b5dcd33be54e16b39377984f3d5658cda44950fa0f8fc'; - -function NextButtonClick(CurPageID: Integer): Boolean; -var - DownloadPage: TDownloadWizardPage; - ExistingFileName: String; -begin - Result := True; - try - if (CurPageID = wpReady) and not (ExpandConstant('{param:nodownload|0}') = '1') then begin - ExistingFileName := ExpandConstant('{app}\ISCrypt.dll'); - if not FileExists(ExistingFileName) or (GetSHA256OfFile(ExistingFileName) <> ISCryptHash) then begin; - if DownloadPage = nil then - DownloadPage := CreateDownloadPage(SetupMessage(msgWizardPreparing), SetupMessage(msgPreparingDesc), nil); - DownloadPage.Clear; - DownloadPage.Add('https://jrsoftware.org/download.php/iscrypt.dll', 'ISCrypt.dll', ISCryptHash); - DownloadPage.Show; - try - DownloadPage.Download; - finally - DownloadPage.Hide; - end; - end; - end; - except - Log(GetExceptionMessage); - end; -end; \ No newline at end of file +Filename: "{app}\Compil32.exe"; Parameters: "/UNASSOC"; RunOnceId: "RemoveISSAssoc" \ No newline at end of file diff --git a/whatsnew.htm b/whatsnew.htm index ff45ba006..3ddfbae93 100644 --- a/whatsnew.htm +++ b/whatsnew.htm @@ -31,7 +31,7 @@

6.1.3-dev (?)

  • The QuickStart Pack installer has been removed because of a lack of added value and a lack of downloads.
  • -
  • The standard Inno Setup installer now always tries to download the encryption module if it's missing, like the QuickStart Pack installer could download it before. This can be disabled using a /NODOWNLOAD=1 command line parameter.
  • +
  • The standard Inno Setup installer now offers to download encryption support if it's missing, like the QuickStart Pack installer did before.