_build/data/InnoSetup.template
[Messages]
BeveledLabel=https://www.eventghost.net
[Setup]
AppCopyright=(C) 2005-2017 EventGhost Project
AppId=EventGhost
AppMutex=Global\EventGhost:7EB106DC-468D-4345-9CFE-B0021039114B
AppName=EventGhost
AppPublisher=EventGhost Project
AppPublisherURL=http://www.eventghost.net/
AppSupportURL=http://www.eventghost.net/
AppUpdatesURL=http://www.eventghost.net/
AppVerName=EventGhost %(appVersion)s
AppVersion=%(appVersion)s
ChangesAssociations=yes
Compression=lzma/ultra
DefaultDirName={pf}\EventGhost
DefaultGroupName=EventGhost
DisableReadyPage=yes
InfoBeforeFile=%(dataDir)s\LICENSE.RTF
InternalCompressLevel=ultra
OutputBaseFilename=%(appName)s_%(appVersion)s_Setup
OutputDir=%(outputDir)s
SetupIconFile=%(docsDir)s\_static\arrow.ico
ShowLanguageDialog=auto
SolidCompression=yes
VersionInfoDescription=EventGhost Installer
#if Pos('WIP-', '%(appVersion)s')
VersionInfoVersion=0.0.0
#elif Pos('-', '%(appVersion)s')
VersionInfoVersion={#Copy('%(appVersion)s', 1, Pos('-', '%(appVersion)s') - 1)}
#else
VersionInfoVersion=%(appVersion)s
#endif
WizardImageAlphaFormat=defined
WizardImageFile=%(docsDir)s\_static\logo.bmp
WizardImageStretch=no
WizardSmallImageFile=%(docsDir)s\_static\logo_small.bmp
[Code]
function GetValue(Value: String): String;
var
Subkey: String;
begin
Subkey := 'Software\Microsoft\Windows\CurrentVersion\Uninstall\EventGhost_is1'
if not (RegQueryStringValue(HKCU, Subkey, Value, Result)) then begin
RegQueryStringValue(HKLM, Subkey, Value, Result)
end;
end;
function SafeRename(Src: String; Dest: String): Boolean;
var
i: Integer;
Success: Boolean;
begin
if (DirExists(Src)) then begin
i := 0
Success := False
repeat
if (i > 0) then begin
Sleep(500)
end;
Success := RenameFile(Src, Dest)
Inc(i)
until (i = 20) or (Success = True);
if (i = 20) then begin
Result := False
end else begin
Result := True
end;
end else begin
Result := True
end;
end;
function Split(Text: String; Separator: String): TArrayOfString;
var
i, p: Integer;
Dest: TArrayOfString;
begin
i := 0
repeat
SetArrayLength(Dest, i + 1)
p := Pos(Separator, Text)
if (p > 0) then begin
Dest[i] := Copy(Text, 1, p - 1)
Text := Copy(Text, p + Length(Separator), Length(Text))
i := i + 1
end else begin
Dest[i] := Text
Text := ''
end;
until (Length(Text) = 0)
Result := Dest
end;
function InitializeSetup: Boolean;
var
MS, LS: Cardinal;
begin
if (GetVersionNumbers(ExpandConstant('{sys}\gdiplus.dll'), MS, LS)) then begin
Result := True
end else begin
Result := False
MsgBox('You need to install GDI+ first.'#13#10#13#10 + 'Please visit http://www.eventghost.net/docs/faq.html for instructions.', MBError, MB_OK)
end;
end;
procedure CurStepChanged(CurStep: TSetupStep);
var
i: Integer;
Dirs: Array [0..1] of Array [0..1] of String;
DisplayVersion: String;
MajorVersion: Integer;
MinorVersion: Integer;
ResultCode: Integer;
SplitVersion: TArrayOfString;
UninstallString: String;
begin
if (CurStep = ssInstall) then begin
UninstallString := GetValue('UninstallString')
if (UninstallString <> '') then begin
Dirs[0][0] := ExpandConstant('{commonappdata}\EventGhost')
Dirs[0][1] := ExpandConstant('{commonappdata}\EventGhost.SetupBackup')
Dirs[1][0] := ExpandConstant('{userappdata}\EventGhost')
Dirs[1][1] := ExpandConstant('{userappdata}\EventGhost.SetupBackup')
MajorVersion := -1
MinorVersion := -1
// Read current major and minor version.
DisplayVersion := GetValue('DisplayVersion')
StringChange(DisplayVersion, 'WIP-', '')
SplitVersion := Split(DisplayVersion, '.')
MajorVersion := StrToInt(SplitVersion[0])
MinorVersion := StrToInt(SplitVersion[1])
if (MajorVersion = -1) or (MinorVersion = -1) then begin
MsgBox('Unable to read current version, so setup cannot continue. Please reinstall your current version of EventGhost and try again.', mbCriticalError, MB_OK)
Abort()
end;
// Backup user data if it will be removed on uninstall.
if (MajorVersion = 0) and (MinorVersion <= 4) then begin
for i := 0 to 1 do begin
if not (SafeRename(Dirs[i][0], Dirs[i][1])) then begin
MsgBox('Unable to backup user data, so setup cannot continue. Please reboot and try again.', mbCriticalError, MB_OK)
Abort()
end;
end;
end;
// Silently run uninstall command.
Exec(RemoveQuotes(UninstallString), '/SILENT', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);
// Restore user data.
if (MajorVersion = 0) and (MinorVersion <= 4) then begin
for i := 0 to 1 do begin
if not (SafeRename(Dirs[i][1], Dirs[i][0])) then begin
MsgBox('Unable to restore user data. Please manually rename "' + Dirs[i][1] + '" to "' + Dirs[i][0] + '".', mbError, MB_OK)
end;
end;
end;
end;
end;
end;
[Icons]
Name: "{group}\EventGhost Help"; Filename: "{app}\EventGhost.chm"
Name: "{group}\EventGhost Web Site"; Filename: "http://www.eventghost.net/"
Name: "{group}\Uninstall EventGhost"; Filename: "{uninstallexe}"
; with the original green arrow
Name: "{group}\EventGhost"; Filename: "{app}\EventGhost.exe"; IconIndex: 0; Tasks: arrow
Name: "{commondesktop}\EventGhost"; Filename: "{app}\EventGhost.exe"; IconIndex: 0; Tasks: arrow and desktopicon
Name: "{userstartup}\EventGhost"; Filename: "{app}\EventGhost.exe"; IconIndex: 0; Parameters: "-h -e OnInitAfterBoot"; Tasks: arrow and startupicon
; with the little ghost
Name: "{group}\EventGhost"; Filename: "{app}\EventGhost.exe"; IconIndex: 1; Tasks: ghost
Name: "{commondesktop}\EventGhost"; Filename: "{app}\EventGhost.exe"; IconIndex: 1; Tasks: ghost and desktopicon
Name: "{userstartup}\EventGhost"; Filename: "{app}\EventGhost.exe"; IconIndex: 1; Parameters: "-h -e OnInitAfterBoot"; Tasks: ghost and startupicon
[Languages]
Name: English; MessagesFile: "compiler:Default.isl"
Name: Armenian; MessagesFile: "compiler:Languages\Armenian.islu"
Name: BrazilianPortuguese; MessagesFile: "compiler:Languages\BrazilianPortuguese.isl"
Name: Catalan; MessagesFile: "compiler:Languages\Catalan.isl"
Name: Corsican; MessagesFile: "compiler:Languages\Corsican.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: Greek; MessagesFile: "compiler:Languages\Greek.isl"
Name: Hebrew; MessagesFile: "compiler:Languages\Hebrew.isl"
Name: Hungarian; MessagesFile: "compiler:Languages\Hungarian.isl"
Name: Italian; MessagesFile: "compiler:Languages\Italian.isl"
Name: Japanese; MessagesFile: "compiler:Languages\Japanese.isl"
Name: Nepali; MessagesFile: "compiler:Languages\Nepali.islu"
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: ScottishGaelic; MessagesFile: "compiler:Languages\ScottishGaelic.isl"
Name: SerbianCyrillic; MessagesFile: "compiler:Languages\SerbianCyrillic.isl"
Name: SerbianLatin; MessagesFile: "compiler:Languages\SerbianLatin.isl"
Name: Slovenian; MessagesFile: "compiler:Languages\Slovenian.isl"
Name: Spanish; MessagesFile: "compiler:Languages\Spanish.isl"
Name: Turkish; MessagesFile: "compiler:Languages\Turkish.isl"
Name: Ukrainian; MessagesFile: "compiler:Languages\Ukrainian.isl"
[Registry]
Root: HKCR; Subkey: ".egtree"; ValueType: string; ValueName: ""; ValueData: "EventGhost Tree"; Flags: uninsdeletevalue
Root: HKCR; Subkey: "EventGhost Tree"; ValueType: string; ValueName: ""; ValueData: "EventGhost Tree"; Flags: uninsdeletekey
Root: HKCR; Subkey: "EventGhost Tree\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\EventGhost.exe,0"
Root: HKCR; Subkey: "EventGhost Tree\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\EventGhost.exe"" ""%%1"""
Root: HKCR; Subkey: ".egplugin"; ValueType: string; ValueName: ""; ValueData: "EventGhost Plugin"; Flags: uninsdeletevalue
Root: HKCR; Subkey: "EventGhost Plugin"; ValueType: string; ValueName: ""; ValueData: "EventGhost Plugin"; Flags: uninsdeletekey
Root: HKCR; Subkey: "EventGhost Plugin\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\EventGhost.exe,0"
Root: HKCR; Subkey: "EventGhost Plugin\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\EventGhost.exe"" ""%%1"""
[Run]
; EG -install needs to be called with admin rights to install the COM-server
Filename: "{app}\EventGhost.exe"; Parameters: "-install"
Filename: "{app}\EventGhost.exe"; Flags: postinstall nowait skipifsilent
[Tasks]
Name: "desktopicon"; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}
Name: "startupicon"; Description: {cm:AutoStartProgram,{#SetupSetting('AppName')}}; GroupDescription: {cm:AutoStartProgramGroupDescription}
Name: "arrow"; Description: "Green Arrow"; GroupDescription: "Application icon:"; Flags: exclusive
Name: "ghost"; Description: "Ghost"; GroupDescription: "Application icon:"; Flags: exclusive unchecked
[UninstallDelete]
Type: dirifempty; Name: "{app}"
Type: files; Name: "{userstartup}\EventGhost.lnk"
[UninstallRun]
Filename: "{app}\EventGhost.exe"; Parameters: "-uninstall"