Here is the promised Inno Setup Script
#include "C:\Program Files\Inno Setup 5\isxdl.iss"#define MyAppName "CCleaner"#define MyAppVer GetFileVersion("CCleaner.exe");#define MyAppVerName MyAppName+" "+MyAppVer#define MyAppPublisher "Piriform"#define MyAppURL "http://www.CCleaner.com/"#define MyAppExeName "CCleaner.exe"[setup]AppName={#MyAppName}AppVerName={#MyAppVerName}AppPublisher={#MyAppPublisher}AppPublisherURL={#MyAppURL}AppSupportURL={#MyAppURL}AppUpdatesURL={#MyAppURL}DefaultDirName={pf}\{#MyAppName}DefaultGroupName={#MyAppName}LicenseFile=D:\CCleaner\CCleanerLicense.txtInfoBeforeFile=D:\CCleaner\history.txtOutputBaseFilename=ccleaner1.41.0.544Compression=lzma/ultra64SolidCompression=yes[Languages]Name: "english"; MessagesFile: "compiler:Default.isl"Name: "basque"; MessagesFile: "compiler:Languages\Basque.isl"Name: "brazilianportuguese"; MessagesFile: "compiler:Languages\BrazilianPortuguese.isl"Name: "catalan"; MessagesFile: "compiler:Languages\Catalan.isl"Name: "czech"; MessagesFile: "compiler:Languages\Czech.isl"Name: "danish"; MessagesFile: "compiler:Languages\Danish.isl"Name: "dutch"; MessagesFile: "compiler:Languages\Dutch.isl"Name: "finnish"; MessagesFile: "compiler:Languages\Finnish.isl"Name: "french"; MessagesFile: "compiler:Languages\French.isl"Name: "german"; MessagesFile: "compiler:Languages\German.isl"Name: "hebrew"; MessagesFile: "compiler:Languages\Hebrew.isl"Name: "hungarian"; MessagesFile: "compiler:Languages\Hungarian.isl"Name: "italian"; MessagesFile: "compiler:Languages\Italian.isl"Name: "norwegian"; MessagesFile: "compiler:Languages\Norwegian.isl"Name: "polish"; MessagesFile: "compiler:Languages\Polish.isl"Name: "portuguese"; MessagesFile: "compiler:Languages\Portuguese.isl"Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"Name: "slovak"; MessagesFile: "compiler:Languages\Slovak.isl"Name: "slovenian"; MessagesFile: "compiler:Languages\Slovenian.isl"Name: "spanish"; MessagesFile: "compiler:Languages\Spanish.isl"[Types]Name: "compact"; Description: "Compact installation"Name: "full"; Description: "Full installation"Name: "custom"; Description: "Custom installation"; Flags: iscustom[Tasks]Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: uncheckedName: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked[Components]Name: "main"; Description: "Main Files"; Types: full compact custom; Flags: fixedName: "help"; Description: "Help Files"; Types: fullName: "winapp2"; Description: "Extra Programs to clean (downloads winapp2.ini file)"; Types: full compact customName: "lang"; Description: "Additional Language Files"; Types: fullName: "lang\albanian"; Description: "Albanian"; Types: fullName: "lang\arabic"; Description: "Arabic"; Types: fullName: "lang\Bosnian"; Description: "Bosnian"; Types: fullName: "lang\bulgarian"; Description: "Bulgarian"; Types: fullName: "lang\catalan"; Description: "Catal? (Catalan)"; Types: fullName: "lang\chinesetrad"; Description: "Chinese (Traditional)"; Types: fullName: "lang\chinesesimp"; Description: "Chinese (Simplified)"; Types: fullName: "lang\czech"; Description: "Cesk? (Czech)"; Types: fullName: "lang\danish"; Description: "Danish"; Types: fullName: "lang\dutch"; Description: "Dutch"; Types: fullName: "lang\english"; Description: "English"; Types: full compact custom; Flags: fixed dontinheritcheckName: "lang\finnish"; Description: "Suomi (Finnish)"; Types: fullName: "lang\french"; Description: "Fran?ais (French)"; Types: fullName: "lang\galician"; Description: "Galician"; Types: fullName: "lang\german"; Description: "German"; Types: fullName: "lang\greek"; Description: "Greek"; Types: fullName: "lang\hebrew"; Description: "Hebrew"; Types: fullName: "lang\hungarian"; Description: "Magyar (Hungarian)"; Types: fullName: "lang\italian"; Description: "Italiano (Italian)"; Types: fullName: "lang\japanese"; Description: "Japanese"; Types: fullName: "lang\korean"; Description: "Korean"; Types: fullName: "lang\lithuanian"; Description: "Lietuviu (Lithuanian)"; Types: fullName: "lang\macedonian"; Description: "Macedonian"; Types: fullName: "lang\norwegian"; Description: "Norwegian"; Types: fullName: "lang\polish"; Description: "Polski (Polish)"; Types: fullName: "lang\portbras"; Description: "Portugu?s do Brasil (Brazilian Portuguese)"; Types: fullName: "lang\portuguese"; Description: "Portugu?s (Portuguese)"; Types: fullName: "lang\romanian"; Description: "Romana (Romanian)"; Types: fullName: "lang\russian"; Description: "Russian"; Types: fullName: "lang\serbianlatin"; Description: "Serbian (Latin)"; Types: fullName: "lang\serbiancyrillic"; Description: "Serbian (Cyrillic)"; Types: fullName: "lang\slovak"; Description: "Slovak (Slovanian)"; Types: fullName: "lang\spanish"; Description: "Espa?ol (Spanish)"; Types: fullName: "lang\swedish"; Description: "Svenska (Swedish)"; Types: fullName: "lang\turkish"; Description: "T?rk?e (Turkish)"; Types: full[Files];Source: "compiler:isxdl.dll"; DestDir: {tmp}; Flags: dontcopySource: "compiler:unzip.exe"; DestDir: {tmp}; Flags: dontcopySource: "compiler:languages\english.ini"; DestDir: {tmp}; Flags: dontcopySource: "D:\CCleaner\lang-1025.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\arabicSource: "D:\CCleaner\lang-1026.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\bulgarianSource: "D:\CCleaner\lang-1027.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\catalanSource: "D:\CCleaner\lang-1028.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\chinesetradSource: "D:\CCleaner\lang-1029.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\czechSource: "D:\CCleaner\lang-1030.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\danishSource: "D:\CCleaner\lang-1031.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\germanSource: "D:\CCleaner\lang-1032.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\greekSource: "D:\CCleaner\lang-1033.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\englishSource: "D:\CCleaner\lang-1034.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\spanishSource: "D:\CCleaner\lang-1035.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\finnishSource: "D:\CCleaner\lang-1036.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\frenchSource: "D:\CCleaner\lang-1037.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\hebrewSource: "D:\CCleaner\lang-1038.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\hungarianSource: "D:\CCleaner\lang-1040.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\italianSource: "D:\CCleaner\lang-1041.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\japaneseSource: "D:\CCleaner\lang-1042.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\koreanSource: "D:\CCleaner\lang-1043.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\dutchSource: "D:\CCleaner\lang-1044.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\norwegianSource: "D:\CCleaner\lang-1045.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\polishSource: "D:\CCleaner\lang-1046.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\portbrasSource: "D:\CCleaner\lang-1048.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\romanianSource: "D:\CCleaner\lang-1049.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\russianSource: "D:\CCleaner\lang-1051.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\slovakSource: "D:\CCleaner\lang-1052.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\albanianSource: "D:\CCleaner\lang-1053.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\swedishSource: "D:\CCleaner\lang-1055.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\turkishSource: "D:\CCleaner\lang-1063.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\lithuanianSource: "D:\CCleaner\lang-1071.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\macedonianSource: "D:\CCleaner\lang-1110.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\galicianSource: "D:\CCleaner\lang-2052.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\chinesesimpSource: "D:\CCleaner\lang-2070.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\portugueseSource: "D:\CCleaner\lang-2074.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\serbianlatinSource: "D:\CCleaner\lang-3098.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\serbiancyrillicSource: "D:\CCleaner\lang-5146.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\BosnianSource: "D:\CCleaner\winapp.ini"; DestDir: "{app}"; Flags: ignoreversion; Components: mainSource: "D:\CCleaner\winreg.ini"; DestDir: "{app}"; Flags: ignoreversion; Components: mainSource: "D:\CCleaner\winsys.ini"; DestDir: "{app}"; Flags: ignoreversion; Components: mainSource: "D:\CCleaner\CCHelper.ocx"; DestDir: "{app}"; Flags: ignoreversion regserver; Components: mainSource: "D:\CCleaner\CCleaner.dll"; DestDir: "{app}"; Components: mainSource: "D:\CCleaner\CCleaner.exe"; DestDir: "{app}"; Components: mainSource: "D:\CCleaner\CCListBar.ocx"; DestDir: "{app}"; Flags: ignoreversion regserver; Components: mainSource: "D:\CCleaner\CCListView.ocx"; DestDir: "{app}"; Flags: ignoreversion regserver; Components: mainSource: "D:\CCleaner\CCSubTimer.dll"; DestDir: "{app}"; Components: mainSource: "D:\CCleaner\CCSystem.dll"; DestDir: "{app}"; Components: mainSource: "D:\CCleaner\CCTab.ocx"; DestDir: "{app}"; Flags: ignoreversion regserver; Components: mainSource: "D:\CCleaner\CCTreeView.ocx"; DestDir: "{app}"; Flags: ignoreversion regserver; Components: mainSource: "D:\CCleaner\BeginnersGuide.chm"; DestDir: "{app}"; Flags: ignoreversion; Components: main help[uninstallDelete]Type: files; Name: "{app}\winapp2.ini"[icons]Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"Name: "{group}\{#MyAppName} Help"; Filename: "{app}\BeginnersGuide.chm"Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}"Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopiconName: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon[Run]Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#MyAppName}}"; Flags: nowait postinstall skipifsilent[Code]constwinapp2 = 'http://www.internetrotsyourbrain.com/winapp2/winapp2.zip';procedure CurStepChanged(CurStep: TSetupStep);var hWnd: Integer; sFileName, sUnzipFile, sDestFile: String; sComponents: String; nCode: Integer;begin if CurStep=ssPostInstall then beginhWnd := StrToInt(ExpandConstant('{wizardhwnd}'));isxdl_ClearFiles;sComponents := WizardSelectedComponents(false);if Pos('winapp2',sComponents)>0 then begin sFileName := ExpandConstant('{tmp}\winapp2.zip'); isxdl_AddFile(winapp2,sFileName);end;if isxdl_DownloadFiles(hWnd) <> 0 then begin sFileName := ExpandConstant('{tmp}\winapp2.zip'); if FileExists(sFileName) then begin ExtractTemporaryFile('unzip.exe'); sUnzipFile := ExpandConstant('{tmp}\unzip.exe'); Exec(sUnzipFile, sFileName, ExpandConstant('{tmp}'), SW_HIDE, ewWaitUntilTerminated,nCode) sFileName := ExpandConstant('{tmp}\winapp2.ini'); if FileExists(sFileName) then begin sDestFile := ExpandConstant('{app}')+'\winapp2.ini' FileCopy(sFileName, sDestFile, False); end; end;end; end;end;function InitializeSetup: Boolean;begin ExtractTemporaryFile('english.ini'); isxdl_SetOption('language',ExpandConstant('{tmp}\english.ini')); isxdl_SetOption('title','Setup - Download'); //isxdl_SetOption('label','Some label...'); //isxdl_SetOption('description','Some description...'); //isxdl_SetOption('resume','false'); //isxdl_SetOption('smallwizardimage','F:\UTVK\MISC\isxdl\WizModernSmallImage-IS.bmp'); Result := true;end;
This code relies on the following extra's
How it works:
It first just askes the normal question (license and stuff)
Then when you come to the components page, it will ask you wich components to install. (main components needed to run CCleaner are always selected and can not be unselected)
- HelpFile
- Languages
- winapp2.ini file
The HelpFile and All the languages are in the setup-file. the winapp2.dll file on the other hand is always downloaden from the alternative server (www.internetrotsyourbrain.com) to ensure you always have the latest version of this file, because this file is more updated then the rest of CCleaner. The unzip.exe file is needed, because the file that is downloaded is a zip-file wich needs to be unpacked.
it unpacks it and puts it in the right directory.
After that, you have the option to run CCleaner.
The uninstaller makes sure that the winapp2.ini file is deleted when you decide to uninstall CCleaner (
)
I know that the original install of CCleaner has the following things different, but i did that intentionally
- Install Option for Yahoo Toolbar (don't like it. bloats the installer to much)
- No license file (decided to enter a license file to make the installer look more complete)