Here is the promised Inno Setup Script
CODE
#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.txt
InfoBeforeFile=D:\CCleaner\history.txt
OutputBaseFilename=ccleaner1.41.0.544
Compression=lzma/ultra64
SolidCompression=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: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Components]
Name: "main"; Description: "Main Files"; Types: full compact custom; Flags: fixed
Name: "help"; Description: "Help Files"; Types: full
Name: "winapp2"; Description: "Extra Programs to clean (downloads winapp2.ini file)"; Types: full compact custom
Name: "lang"; Description: "Additional Language Files"; Types: full
Name: "lang\albanian"; Description: "Albanian"; Types: full
Name: "lang\arabic"; Description: "Arabic"; Types: full
Name: "lang\Bosnian"; Description: "Bosnian"; Types: full
Name: "lang\bulgarian"; Description: "Bulgarian"; Types: full
Name: "lang\catalan"; Description: "Català (Catalan)"; Types: full
Name: "lang\chinesetrad"; Description: "Chinese (Traditional)"; Types: full
Name: "lang\chinesesimp"; Description: "Chinese (Simplified)"; Types: full
Name: "lang\czech"; Description: "Ceskı (Czech)"; Types: full
Name: "lang\danish"; Description: "Danish"; Types: full
Name: "lang\dutch"; Description: "Dutch"; Types: full
Name: "lang\english"; Description: "English"; Types: full compact custom; Flags: fixed dontinheritcheck
Name: "lang\finnish"; Description: "Suomi (Finnish)"; Types: full
Name: "lang\french"; Description: "Français (French)"; Types: full
Name: "lang\galician"; Description: "Galician"; Types: full
Name: "lang\german"; Description: "German"; Types: full
Name: "lang\greek"; Description: "Greek"; Types: full
Name: "lang\hebrew"; Description: "Hebrew"; Types: full
Name: "lang\hungarian"; Description: "Magyar (Hungarian)"; Types: full
Name: "lang\italian"; Description: "Italiano (Italian)"; Types: full
Name: "lang\japanese"; Description: "Japanese"; Types: full
Name: "lang\korean"; Description: "Korean"; Types: full
Name: "lang\lithuanian"; Description: "Lietuviu (Lithuanian)"; Types: full
Name: "lang\macedonian"; Description: "Macedonian"; Types: full
Name: "lang\norwegian"; Description: "Norwegian"; Types: full
Name: "lang\polish"; Description: "Polski (Polish)"; Types: full
Name: "lang\portbras"; Description: "Português do Brasil (Brazilian Portuguese)"; Types: full
Name: "lang\portuguese"; Description: "Português (Portuguese)"; Types: full
Name: "lang\romanian"; Description: "Romana (Romanian)"; Types: full
Name: "lang\russian"; Description: "Russian"; Types: full
Name: "lang\serbianlatin"; Description: "Serbian (Latin)"; Types: full
Name: "lang\serbiancyrillic"; Description: "Serbian (Cyrillic)"; Types: full
Name: "lang\slovak"; Description: "Slovak (Slovanian)"; Types: full
Name: "lang\spanish"; Description: "Español (Spanish)"; Types: full
Name: "lang\swedish"; Description: "Svenska (Swedish)"; Types: full
Name: "lang\turkish"; Description: "Türkçe (Turkish)"; Types: full
[Files]
;Source: "compiler:isxdl.dll"; DestDir: {tmp}; Flags: dontcopy
Source: "compiler:unzip.exe"; DestDir: {tmp}; Flags: dontcopy
Source: "compiler:languages\english.ini"; DestDir: {tmp}; Flags: dontcopy
Source: "D:\CCleaner\lang-1025.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\arabic
Source: "D:\CCleaner\lang-1026.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\bulgarian
Source: "D:\CCleaner\lang-1027.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\catalan
Source: "D:\CCleaner\lang-1028.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\chinesetrad
Source: "D:\CCleaner\lang-1029.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\czech
Source: "D:\CCleaner\lang-1030.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\danish
Source: "D:\CCleaner\lang-1031.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\german
Source: "D:\CCleaner\lang-1032.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\greek
Source: "D:\CCleaner\lang-1033.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\english
Source: "D:\CCleaner\lang-1034.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\spanish
Source: "D:\CCleaner\lang-1035.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\finnish
Source: "D:\CCleaner\lang-1036.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\french
Source: "D:\CCleaner\lang-1037.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\hebrew
Source: "D:\CCleaner\lang-1038.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\hungarian
Source: "D:\CCleaner\lang-1040.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\italian
Source: "D:\CCleaner\lang-1041.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\japanese
Source: "D:\CCleaner\lang-1042.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\korean
Source: "D:\CCleaner\lang-1043.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\dutch
Source: "D:\CCleaner\lang-1044.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\norwegian
Source: "D:\CCleaner\lang-1045.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\polish
Source: "D:\CCleaner\lang-1046.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\portbras
Source: "D:\CCleaner\lang-1048.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\romanian
Source: "D:\CCleaner\lang-1049.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\russian
Source: "D:\CCleaner\lang-1051.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\slovak
Source: "D:\CCleaner\lang-1052.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\albanian
Source: "D:\CCleaner\lang-1053.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\swedish
Source: "D:\CCleaner\lang-1055.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\turkish
Source: "D:\CCleaner\lang-1063.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\lithuanian
Source: "D:\CCleaner\lang-1071.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\macedonian
Source: "D:\CCleaner\lang-1110.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\galician
Source: "D:\CCleaner\lang-2052.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\chinesesimp
Source: "D:\CCleaner\lang-2070.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\portuguese
Source: "D:\CCleaner\lang-2074.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\serbianlatin
Source: "D:\CCleaner\lang-3098.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\serbiancyrillic
Source: "D:\CCleaner\lang-5146.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: lang\Bosnian
Source: "D:\CCleaner\winapp.ini"; DestDir: "{app}"; Flags: ignoreversion; Components: main
Source: "D:\CCleaner\winreg.ini"; DestDir: "{app}"; Flags: ignoreversion; Components: main
Source: "D:\CCleaner\winsys.ini"; DestDir: "{app}"; Flags: ignoreversion; Components: main
Source: "D:\CCleaner\CCHelper.ocx"; DestDir: "{app}"; Flags: ignoreversion regserver; Components: main
Source: "D:\CCleaner\CCleaner.dll"; DestDir: "{app}"; Components: main
Source: "D:\CCleaner\CCleaner.exe"; DestDir: "{app}"; Components: main
Source: "D:\CCleaner\CCListBar.ocx"; DestDir: "{app}"; Flags: ignoreversion regserver; Components: main
Source: "D:\CCleaner\CCListView.ocx"; DestDir: "{app}"; Flags: ignoreversion regserver; Components: main
Source: "D:\CCleaner\CCSubTimer.dll"; DestDir: "{app}"; Components: main
Source: "D:\CCleaner\CCSystem.dll"; DestDir: "{app}"; Components: main
Source: "D:\CCleaner\CCTab.ocx"; DestDir: "{app}"; Flags: ignoreversion regserver; Components: main
Source: "D:\CCleaner\CCTreeView.ocx"; DestDir: "{app}"; Flags: ignoreversion regserver; Components: main
Source: "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: desktopicon
Name: "{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]
const
winapp2 = '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 begin
hWnd := 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)