Add path example to install dir

Add path example to install dir

; Script generated by the Inno Script Studio Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "Imperial Splendour"
#define MyAppVersion "2.0"
#define MyAppPublisher "Imperial Splendour"
#define MyAppURL "https://imperialsplendour.com/"
#define MyAppExeName "ImperialSplendour.exe"
#define TmpFolder "ImperialSplendour"
#define UninstallDir "IS_Uninstall"
#define UninstallHelperExe "deactivator.exe"
#define SetupName "ImperialSplendourSetup"
#define ETWDefaultPath "steam\steamapp\common\Empire Total War"
#define CampaignPath "data\campaigns\imperial_splendour"

#define MyAppId "{{DC820B8B-AE7B-4555-AB8A-C1399266A06F}"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={#MyAppId}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DisableDirPage=yes
DefaultDirName={commonpf}
AlwaysShowDirOnReadyPage=yes
DefaultGroupName={#MyAppName}
OutputBaseFilename={#SetupName}
Compression=lzma
SolidCompression=yes
; 10GB = 10,737,418,240
ExtraDiskSpaceRequired=10737418240
DirExistsWarning=yes
SetupIconFile=appicon.ico
UninstallDisplayIcon={app}\{#MyAppExeName}
UninstallFilesDir={app}\{#UninstallDir}
DiskSpanning=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
Source: "{#TmpFolder}\*.*"; DestDir: "{app}"; Flags: recursesubdirs

[Dirs]
Name: "{app}\{#CampaignPath}"

[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon

[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent

[UninstallRun]
Filename: "{app}\{#UninstallDir}\{#UninstallHelperExe}"; WorkingDir: "{app}"

[UninstallDelete]
Type: filesandordirs; Name: "{app}\{#UninstallDir}";

[CustomMessages]
NewerVersionExists=A newer version of {#MyAppName} is already installed.%n%nInstaller version: {#MyAppVersion}%nCurrent version:
ConfirmReinstall=It looks like you already have this version of {#MyAppName} installed. Do you want to re-install it?
ETWNotFound=Couldn''t find your Empire Total War installation. Please make sure you have it installed correctly and manually select the install folder.
InvalidPath=The install path you picked is invalid. Please check it and try again.
DeactivationError=There was an error preparing the upgrade. Please delete any remaining Imperial Splendour files manually and try again.

[Code]

var ExpectedPath: String;
var HasInstallation: Boolean;
var OldInstallLocation: string;
var
  StartupInfoPage: TInputQueryWizardPage;
  InputDirPage:    TInputDirWizardPage;

function InitializeSetup: Boolean;
var InstalledVersion: String;
var RegistryPath: string;
var RegistryPathX32: string;
var RegistryPathX64: string;
var IsX64: string;
begin
  RegistryPathX32 := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#MyAppId}_is1');
  RegistryPathX64 := ExpandConstant('Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{#MyAppId}_is1');

  HasInstallation := RegValueExists(HKEY_LOCAL_MACHINE, RegistryPathX32, 'DisplayVersion');
  if HasInstallation then
    RegistryPath := RegistryPathX32
  else begin
    HasInstallation := RegValueExists(HKEY_LOCAL_MACHINE, RegistryPathX64, 'DisplayVersion')
    if HasInstallation then
      RegistryPath := RegistryPathX64
  end;

  if not HasInstallation then
  begin
    Result := True;
    Exit;
  end;

  RegQueryStringValue(HKEY_LOCAL_MACHINE, RegistryPath, 'DisplayVersion', InstalledVersion);
  if InstalledVersion > '{#MyAppVersion}' then begin
    MsgBox(ExpandConstant('{cm:NewerVersionExists} '+InstalledVersion), mbInformation, MB_OK);
    Result := False;
    Exit;
  end else if InstalledVersion = '{#MyAppVersion}' then begin
    if MsgBox(ExpandConstant('{cm:ConfirmReinstall}'), mbConfirmation, MB_OKCANCEL) = IDCANCEL then
      Result := false;
      Exit;
  end;

  RegQueryStringValue(HKEY_LOCAL_MACHINE, RegistryPath, 'InstallLocation', OldInstallLocation);
  Result := True;
end;

procedure InitializeWizard;
begin
  ExpectedPath := ExpandConstant('{commonpf}\{#ETWDefaultPath}');

  StartupInfoPage:= CreateInputQueryPage(wpWelcome,
    'Welcome',
    'Please read the following important information before continuing',
    'Requirements:'#13#10 +
    '- an Empire: Total War installation through Steam'#13#10 +
    '- at least 10GB of hard drive space'#13#10 +
    ''#13#10 +
    'NOTE: Having a different mod installed alongside Imperial Splendour can lead to issues when using the launcher. In this case, you can still use the installer but we recommend to switch between mods manually.');

  InputDirPage := CreateInputDirPage(StartupInfoPage.ID,
    'Select existing Empire: Total War Installation Location',
    '',
    'Imperial Splendour will be installed inside the following Empire: Total War folder.'#13#10 +
    ''#13#10 +
    'To continue, click Next. If you would like to select a different folder, click Browse. The folder should usually look something like this: C:\Program Files\steam\steamapp\common\Empire Total War',
    False, '');

  InputDirPage.Add('');
  if HasInstallation then
     InputDirPage.Values[0] := OldInstallLocation
  else if DirExists(ExpectedPath) then
    InputDirPage.Values[0] := ExpectedPath
  else
    InputDirPage.Values[0] := '';

end;

function NextButtonClick(CurPageID: Integer): Boolean;
begin
  if CurPageID = StartupInfoPage.ID then
    if InputDirPage.Values[0] = '' then
      MsgBox(ExpandConstant('{cm:ETWNotFound}'), mbError, MB_OK);

  if CurPageID = InputDirPage.ID then begin
    if not DirExists(InputDirPage.Values[0]) then begin
      MsgBox(ExpandConstant('{cm:InvalidPath}'), mbError, MB_OK);
      Result := false;
      Exit;
    end;

    WizardForm.DirEdit.Text := InputDirPage.Values[0];
  end;

  Result := true;
end;

function ShouldSkipPage(PageID: Integer): Boolean;
begin
  if PageID = InputDirPage.ID then begin
    if HasInstallation then
      Result := True;
      Exit;
  end;

  Result := False;
end;

function PrepareToInstall(var NeedsRestart: Boolean): String;
var ResultCode: Integer;
begin
  if not HasInstallation then begin
    Result := '';
    Exit;
  end;

  if not Exec(ExpandConstant(WizardForm.DirEdit.Text + '\{#UninstallDir}\{#UninstallHelperExe}'), '-strict', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
    Result := ExpandConstant('{cm:DeactivationError}')
  else
    Result := '';
end;

; Script generated by the Inno Script Studio Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "Imperial Splendour"
#define MyAppVersion "2.0"
#define MyAppPublisher "Imperial Splendour"
#define MyAppURL "https://imperialsplendour.com/"
#define MyAppExeName "ImperialSplendour.exe"
#define TmpFolder "ImperialSplendour"
#define UninstallDir "IS_Uninstall"
#define UninstallHelperExe "deactivator.exe"
#define SetupName "ImperialSplendourSetup"
#define ETWDefaultPath "steam\steamapp\common\Empire Total War"
#define CampaignPath "data\campaigns\imperial_splendour"

#define MyAppId "{{DC820B8B-AE7B-4555-AB8A-C1399266A06F}"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={#MyAppId}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DisableDirPage=yes
DefaultDirName={commonpf}
AlwaysShowDirOnReadyPage=yes
DefaultGroupName={#MyAppName}
OutputBaseFilename={#SetupName}
Compression=lzma
SolidCompression=yes
; 10GB = 10,737,418,240
ExtraDiskSpaceRequired=10737418240
DirExistsWarning=yes
SetupIconFile=appicon.ico
UninstallDisplayIcon={app}\{#MyAppExeName}
UninstallFilesDir={app}\{#UninstallDir}
DiskSpanning=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
Source: "{#TmpFolder}\*.*"; DestDir: "{app}"; Flags: recursesubdirs

[Dirs]
Name: "{app}\{#CampaignPath}"

[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon

[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent

[UninstallRun]
Filename: "{app}\{#UninstallDir}\{#UninstallHelperExe}"; WorkingDir: "{app}"

[UninstallDelete]
Type: filesandordirs; Name: "{app}\{#UninstallDir}";

[CustomMessages]
NewerVersionExists=A newer version of {#MyAppName} is already installed.%n%nInstaller version: {#MyAppVersion}%nCurrent version:
ConfirmReinstall=It looks like you already have this version of {#MyAppName} installed. Do you want to re-install it?
ETWNotFound=Couldn''t find your Empire Total War installation. Please make sure you have it installed correctly and manually select the install folder.
InvalidPath=The install path you picked is invalid. Please check it and try again.
DeactivationError=There was an error preparing the upgrade. Please delete any remaining Imperial Splendour files manually and try again.

[Code]

var ExpectedPath: String;
var HasInstallation: Boolean;
var OldInstallLocation: string;
var
  StartupInfoPage: TInputQueryWizardPage;
  InputDirPage:    TInputDirWizardPage;

function InitializeSetup: Boolean;
var InstalledVersion: String;
var RegistryPath: string;
var RegistryPathX32: string;
var RegistryPathX64: string;
var IsX64: string;
begin
  RegistryPathX32 := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#MyAppId}_is1');
  RegistryPathX64 := ExpandConstant('Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{#MyAppId}_is1');

  HasInstallation := RegValueExists(HKEY_LOCAL_MACHINE, RegistryPathX32, 'DisplayVersion');
  if HasInstallation then
    RegistryPath := RegistryPathX32
  else begin
    HasInstallation := RegValueExists(HKEY_LOCAL_MACHINE, RegistryPathX64, 'DisplayVersion')
    if HasInstallation then
      RegistryPath := RegistryPathX64
  end;

  if not HasInstallation then
  begin
    Result := True;
    Exit;
  end;

  RegQueryStringValue(HKEY_LOCAL_MACHINE, RegistryPath, 'DisplayVersion', InstalledVersion);
  if InstalledVersion > '{#MyAppVersion}' then begin
    MsgBox(ExpandConstant('{cm:NewerVersionExists} '+InstalledVersion), mbInformation, MB_OK);
    Result := False;
    Exit;
  end else if InstalledVersion = '{#MyAppVersion}' then begin
    if MsgBox(ExpandConstant('{cm:ConfirmReinstall}'), mbConfirmation, MB_OKCANCEL) = IDCANCEL then
      Result := false;
      Exit;
  end;

  RegQueryStringValue(HKEY_LOCAL_MACHINE, RegistryPath, 'InstallLocation', OldInstallLocation);
  Result := True;
end;

procedure InitializeWizard;
begin
  ExpectedPath := ExpandConstant('{commonpf}\{#ETWDefaultPath}');

  StartupInfoPage:= CreateInputQueryPage(wpWelcome,
    'Welcome',
    'Please read the following important information before continuing',
    'Requirements:'#13#10 +
    '- an Empire: Total War installation through Steam'#13#10 +
    '- at least 10GB of hard drive space'#13#10 +
    ''#13#10 +
    'NOTE: Having a different mod installed alongside Imperial Splendour can lead to issues when using the launcher. In this case, you can still use the installer but we recommend to switch between mods manually.');

  InputDirPage := CreateInputDirPage(StartupInfoPage.ID,
    'Select existing Empire: Total War Installation Location',
    '',
    'Imperial Splendour will be installed inside the following Empire: Total War folder.'#13#10 +
    ''#13#10 +
    'To continue, click Next. If you would like to select a different folder, click Browse.',
    False, '');

  InputDirPage.Add('');
  if HasInstallation then
     InputDirPage.Values[0] := OldInstallLocation
  else if DirExists(ExpectedPath) then
    InputDirPage.Values[0] := ExpectedPath
  else
    InputDirPage.Values[0] := '';

end;

function NextButtonClick(CurPageID: Integer): Boolean;
begin
  if CurPageID = StartupInfoPage.ID then
    if InputDirPage.Values[0] = '' then
      MsgBox(ExpandConstant('{cm:ETWNotFound}'), mbError, MB_OK);

  if CurPageID = InputDirPage.ID then begin
    if not DirExists(InputDirPage.Values[0]) then begin
      MsgBox(ExpandConstant('{cm:InvalidPath}'), mbError, MB_OK);
      Result := false;
      Exit;
    end;

    WizardForm.DirEdit.Text := InputDirPage.Values[0];
  end;

  Result := true;
end;

function ShouldSkipPage(PageID: Integer): Boolean;
begin
  if PageID = InputDirPage.ID then begin
    if HasInstallation then
      Result := True;
      Exit;
  end;

  Result := False;
end;

function PrepareToInstall(var NeedsRestart: Boolean): String;
var ResultCode: Integer;
begin
  if not HasInstallation then begin
    Result := '';
    Exit;
  end;

  if not Exec(ExpandConstant(WizardForm.DirEdit.Text + '\{#UninstallDir}\{#UninstallHelperExe}'), '-strict', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
    Result := ExpandConstant('{cm:DeactivationError}')
  else
    Result := '';
end;


Installer bugfix release 17.0.3.391-2

Installer bugfix release 17.0.3.391-2

; Script generated by the Inno Script Studio Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "Mesa3D software rendering drivers for Windows"
#define MyAppVersion "17.0.3.391-2"
#define MyAppPublisher "Pal100x"
#define MyAppURL "https://github.com/pal1000/mesa-dist-win"
#define MyAppExeName "mesa-{#MyAppVersion}-setup.exe"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{8EFCCC7F-5BAF-4651-A040-EFB13C59EF60}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
ArchitecturesInstallIn64BitMode=x64
DefaultDirName={pf}\{#MyAppName}
DisableProgramGroupPage=yes
LicenseFile=LICENSE
OutputDir=bin\
OutputBaseFilename=mesa-{#MyAppVersion}-setup
Compression=lzma
SolidCompression=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Files]
Source: "bin\x86\opengl32sw.dll"; DestDir: "{syswow64}"; Flags: ignoreversion
Source: "bin\x86\swrAVX.dll"; DestDir: "{syswow64}"; Flags: ignoreversion
Source: "bin\x86\swrAVX2.dll"; DestDir: "{syswow64}"; Flags: ignoreversion
Source: "bin\x86\dxtn.dll"; DestDir: "{syswow64}"; Flags: ignoreversion
Source: "bin\x86\osmesa-gallium.dll"; DestDir: "{syswow64}"; Flags: ignoreversion
Source: "bin\x86\osmesa-swrast.dll"; DestDir: "{syswow64}"; Flags: ignoreversion
Source: "bin\x86\graw.dll"; DestDir: "{syswow64}"; Flags: ignoreversion
Source: "bin\x64\opengl32sw.dll"; DestDir: "{win}\system32"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "bin\x64\swrAVX.dll"; DestDir: "{win}\system32"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "bin\x64\swrAVX2.dll"; DestDir: "{win}\system32"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "bin\x64\dxtn.dll"; DestDir: "{win}\system32"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "bin\x64\osmesa-gallium.dll"; DestDir: "{win}\system32"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "bin\x64\osmesa-swrast.dll"; DestDir: "{win}\system32"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "bin\x64\graw.dll"; DestDir: "{win}\system32"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "localdeploy.cmd"; DestDir: "{app}"
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Registry]
Root: "HKLM32"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL"; ValueType: string; ValueName: "DLL"; ValueData: "opengl32sw.dll"; Flags: createvalueifdoesntexist uninsdeletekey
Root: "HKLM32"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL"; ValueType: dword; ValueName: "DriverVersion"; ValueData: "1"; Flags: createvalueifdoesntexist uninsdeletekey
Root: "HKLM32"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL"; ValueType: dword; ValueName: "Flags"; ValueData: "1"; Flags: createvalueifdoesntexist uninsdeletekey
Root: "HKLM32"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL"; ValueType: dword; ValueName: "Version"; ValueData: "2"; Flags: createvalueifdoesntexist uninsdeletekey
Root: "HKLM"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL"; ValueType: string; ValueName: "DLL"; ValueData: "opengl32sw.dll"; Flags: createvalueifdoesntexist uninsdeletekey; Check: Is64BitInstallMode
Root: "HKLM"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL"; ValueType: dword; ValueName: "DriverVersion"; ValueData: "1"; Flags: createvalueifdoesntexist uninsdeletekey; Check: Is64BitInstallMode
Root: "HKLM"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL"; ValueType: dword; ValueName: "Flags"; ValueData: "1"; Flags: createvalueifdoesntexist uninsdeletekey; Check: Is64BitInstallMode
Root: "HKLM"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL"; ValueType: dword; ValueName: "Version"; ValueData: "2"; Flags: createvalueifdoesntexist uninsdeletekey; Check: Is64BitInstallMode

[UninstallDelete]
Type: files; Name: "{syswow64}\opengl32sw.dll"
Type: files; Name: "{syswow64}\swrAVX.dll";
Type: files; Name: "{syswow64}\swrAVX2.dll"
Type: files; Name: "{syswow64}\dxtn.dll"
Type: files; Name: "{syswow64}\graw.dll";
Type: files; Name: "{syswow64}\osmesa-gallium.dll"
Type: files; Name: "{syswow64}\osmesa-swrast.dll"
Type: files; Name: "{win}\system32\opengl32sw.dll"; Check: Is64BitInstallMode
Type: files; Name: "{win}\system32\swrAVX.dll"; Check: Is64BitInstallMode
Type: files; Name: "{win}\system32\swrAVX2.dll"; Check: Is64BitInstallMode
Type: files; Name: "{win}\system32\dxtn.dll"; Check: Is64BitInstallMode
Type: files; Name: "{win}\system32\osmesa-gallium.dll"; Check: Is64BitInstallMode
Type: files; Name: "{win}\system32\osmesa-swrast.dll"; Check: Is64BitInstallMode
Type: files; Name: "{win}\system32\graw.dll"; Check: Is64BitInstallMode

[Icons]
Name: "{commondesktop}\Mesa3D local deployment utility"; Filename: "cmd"; Parameters: "/c ""{app}\localdeploy.cmd"""; AfterInstall: SetElevationBit ('{commondesktop}\Mesa3D local deployment utility.lnk')

[InstallDelete]
Type: files; Name: "{syswow64}\cygwin1.dll"

[Code]

procedure SetElevationBit(Filename: string);
var
  Buffer: string;
  Stream: TStream;
begin
  Filename := ExpandConstant(Filename);
  Log('Setting elevation bit for ' + Filename);

  Stream := TFileStream.Create(FileName, fmOpenReadWrite);
  try
    Stream.Seek(21, soFromBeginning);
    SetLength(Buffer, 1);
    Stream.ReadBuffer(Buffer, 1);
    Buffer[1] := Chr(Ord(Buffer[1]) or $20);
    Stream.Seek(-1, soFromCurrent);
    Stream.WriteBuffer(Buffer, 1);
  finally
    Stream.Free;
  end;
end;

; Script generated by the Inno Script Studio Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "Mesa3D software rendering drivers for Windows"
#define MyAppVersion "17.0.3.391-1"
#define MyAppPublisher "Pal100x"
#define MyAppURL "https://github.com/pal1000/mesa-dist-win"
#define MyAppExeName "mesa-{#MyAppVersion}-setup.exe"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{8EFCCC7F-5BAF-4651-A040-EFB13C59EF60}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
ArchitecturesInstallIn64BitMode=x64
DefaultDirName={pf}\{#MyAppName}
DisableProgramGroupPage=yes
LicenseFile=LICENSE
OutputDir=bin\
OutputBaseFilename=mesa-{#MyAppVersion}-setup
Compression=lzma
SolidCompression=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Files]
Source: "bin\x86\opengl32sw.dll"; DestDir: "{syswow64}"; Flags: ignoreversion
Source: "bin\x86\swrAVX.dll"; DestDir: "{syswow64}"; Flags: ignoreversion
Source: "bin\x86\swrAVX2.dll"; DestDir: "{syswow64}"; Flags: ignoreversion
Source: "bin\x86\dxtn.dll"; DestDir: "{syswow64}"; Flags: ignoreversion
Source: "bin\x86\osmesa-gallium.dll"; DestDir: "{syswow64}"; Flags: ignoreversion
Source: "bin\x86\osmesa-swrast.dll"; DestDir: "{syswow64}"; Flags: ignoreversion
Source: "bin\x86\graw.dll"; DestDir: "{syswow64}"; Flags: ignoreversion
Source: "bin\x64\opengl32sw.dll"; DestDir: "{win}\system32"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "bin\x64\swrAVX.dll"; DestDir: "{win}\system32"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "bin\x64\swrAVX2.dll"; DestDir: "{win}\system32"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "bin\x64\dxtn.dll"; DestDir: "{win}\system32"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "bin\x64\osmesa-gallium.dll"; DestDir: "{win}\system32"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "bin\x64\osmesa-swrast.dll"; DestDir: "{win}\system32"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "bin\x64\graw.dll"; DestDir: "{win}\system32"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "localdeploy.cmd"; DestDir: "{app}"
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Registry]
Root: "HKLM32"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL"; ValueType: string; ValueName: "DLL"; ValueData: "opengl32sw.dll"; Flags: createvalueifdoesntexist uninsdeletekey
Root: "HKLM32"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL"; ValueType: dword; ValueName: "DriverVersion"; ValueData: "1"; Flags: createvalueifdoesntexist uninsdeletekey
Root: "HKLM32"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL"; ValueType: dword; ValueName: "Flags"; ValueData: "1"; Flags: createvalueifdoesntexist uninsdeletekey
Root: "HKLM32"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL"; ValueType: dword; ValueName: "Version"; ValueData: "2"; Flags: createvalueifdoesntexist uninsdeletekey
Root: "HKLM"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL"; ValueType: string; ValueName: "DLL"; ValueData: "opengl32sw.dll"; Flags: createvalueifdoesntexist uninsdeletekey; Check: Is64BitInstallMode
Root: "HKLM"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL"; ValueType: dword; ValueName: "DriverVersion"; ValueData: "1"; Flags: createvalueifdoesntexist uninsdeletekey; Check: Is64BitInstallMode
Root: "HKLM"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL"; ValueType: dword; ValueName: "Flags"; ValueData: "1"; Flags: createvalueifdoesntexist uninsdeletekey; Check: Is64BitInstallMode
Root: "HKLM"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL"; ValueType: dword; ValueName: "Version"; ValueData: "2"; Flags: createvalueifdoesntexist uninsdeletekey; Check: Is64BitInstallMode

[UninstallDelete]
Type: files; Name: "{syswow64}\opengl32sw.dll"
Type: files; Name: "{syswow64}\swrAVX.dll";
Type: files; Name: "{syswow64}\swrAVX2.dll"
Type: files; Name: "{syswow64}\dxtn.dll"
Type: files; Name: "{syswow64}\graw.dll";
Type: files; Name: "{syswow64}\osmesa-gallium.dll"
Type: files; Name: "{syswow64}\osmesa-swrast.dll"
Type: files; Name: "{win}\system32\opengl32sw.dll"; Check: Is64BitInstallMode
Type: files; Name: "{win}\system32\swrAVX.dll"; Check: Is64BitInstallMode
Type: files; Name: "{win}\system32\swrAVX2.dll"; Check: Is64BitInstallMode
Type: files; Name: "{win}\system32\dxtn.dll"; Check: Is64BitInstallMode
Type: files; Name: "{win}\system32\osmesa-gallium.dll"; Check: Is64BitInstallMode
Type: files; Name: "{win}\system32\osmesa-swrast.dll"; Check: Is64BitInstallMode
Type: files; Name: "{win}\system32\graw.dll"; Check: Is64BitInstallMode

[Icons]
Name: "{commondesktop}\Mesa3D local deployment utility"; Filename: "cmd"; Parameters: "/c ""{app}\localdeploy.cmd"""; AfterInstall: SetElevationBit ('{commondesktop}\Mesa3D local deployment utility.lnk')

[InstallDelete]
Type: files; Name: "{syswow64}\cygwin1.dll"

[Code]

procedure SetElevationBit(Filename: string);
var
  Buffer: string;
  Stream: TStream;
begin
  Filename := ExpandConstant(Filename);
  Log('Setting elevation bit for ' + Filename);

  Stream := TFileStream.Create(FileName, fmOpenReadWrite);
  try
    Stream.Seek(21, soFromBeginning);
    SetLength(Buffer, 1);
    Stream.ReadBuffer(Buffer, 1);
    Buffer[1] := Chr(Ord(Buffer[1]) or $20);
    Stream.Seek(-1, soFromCurrent);
    Stream.WriteBuffer(Buffer, 1);
  finally
    Stream.Free;
  end;
end;


v5.2 released

v5.2 released

; Script generated by the Inno Setup Script Wizard.    Version 2 !!!
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

[Setup]
AppName=CSV-Import
AppVerName=CSV-Import 5.2
DiskSpanning=no
AppPublisher=tm
AppPublisherURL=http://www.easyct.de
AppSupportURL=http://www.easyct.de
AppUpdatesURL=http://www.easyct.de
DefaultDirName={pf}\EasyCash&Tax\Plugins\CSV-Import
DefaultGroupName=EasyCash
OutputBaseFilename=ECTImportXSetup
OutputDir=.\Setup
MinVersion=5.0
; MFC9 greift auf GetFileSizeEx zu, das Win 98 nicht in der kernel.dll hat.
Compression=bzip
SignTool=vs6

[Files]
Source: .\Release\ECTImportX.ocx; DestDir: {app}; Flags: regserver ignoreversion
Source: .\ECTIFace.dll; DestDir: {app}; Flags: ignoreversion
; ECTIFace nur noch bentigt fr GetIniFileName
Source: .\LIZENZ.TXT; DestDir: {app}; Flags: ignoreversion
; veraltete Help Datei nicht mehr: Source: D:\Work\ECTImportX\Release\ECTEImport.hlp; DestDir: {app}; Flags: ignoreversion
Source: .\ECTEImport.htm; DestDir: {app}; Flags: ignoreversion
Source: .\gawk.exe; DestDir: {app}; Flags: ignoreversion
Source: .\button.gif; DestDir: {app}; Flags: ignoreversion

[Registry]
Root: HKLM; Subkey: Software\Tools; Flags: uninsdeletekeyifempty
Root: HKLM; Subkey: Software\Tools\EasyCash; Flags: uninsdeletekeyifempty
Root: HKLM; Subkey: Software\Tools\EasyCash\Plugins; Flags: uninsdeletekeyifempty
Root: HKLM; Subkey: Software\Tools\EasyCash\Plugins\CSV-Import; Flags: uninsdeletekey
Root: HKLM; Subkey: Software\Tools\EasyCash\Plugins\CSV-Import; ValueType: string; ValueName: Aufruf; ValueData: ECTImportX.ECTImportXCtrl.1
Root: HKLM; Subkey: Software\Tools\EasyCash\Plugins\CSV-Import; ValueType: string; ValueName: Beschreibung; ValueData: kann Daten im CSV-Format (Character Separated Values) importieren
Root: HKLM; Subkey: Software\Tools\EasyCash\Plugins\CSV-Import; ValueType: string; ValueName: Bitmap; ValueData: {app}\button.gif
Root: HKLM; Subkey: Software\Tools\EasyCash\Plugins\CSV-Import; ValueType: string; ValueName: Name; ValueData: CSV-Import
Root: HKLM; Subkey: Software\Tools\EasyCash\Plugins\CSV-Import; ValueType: string; ValueName: Typ; ValueData: noscroll

[Languages]
Name: "de"; MessagesFile: "compiler:Languages\German.isl"

[Code]
// shared code for installing the products
#include "scripts\products.iss"
// helper functions
#include "scripts\products\stringversion.iss"
#include "scripts\products\winversion.iss"
#include "scripts\products\fileversion.iss"
// actual products
#include "scripts\products\msiproduct.iss"
#include "scripts\products\vcredist2013.iss"

function CheckProcessRunning( aProcName,
                              aProcDesc: string ): boolean;
var
  ShellResult: boolean;
  ResultCode: integer;
  cmd: string;
  sl: TStringList;
  f: string;
  d: string;
begin
  cmd := 'for /f "delims=," %%i ' +
         'in (''tasklist /FI "IMAGENAME eq ' + aProcName + '" /FO CSV'') ' +
         'do if "%%~i"=="' + aProcName + '" exit 1';
  f := 'CheckProc.cmd';
  d := AddBackSlash( ExpandConstant( '{tmp}' ));
  sl := TStringList.Create;
  sl.Add( cmd );
  sl.Add( 'exit /0' );
  sl.SaveToFile( d + f );
  sl.Free;
  Result := true;
  while ( Result ) do
  begin
    ResultCode := 1;
    ShellResult := Exec( f,
                         '',
                         d,
                         SW_HIDE,
                         ewWaitUntilTerminated,
                         ResultCode );
    Result := ResultCode > 0;
    if Result and
       ( MsgBox( aProcDesc + ' ist noch aktiv. Das Programm muss beendet werden, um fortzufahren.'#13#10#13#10 +
                 'Bitte wechseln Sie zu dem Programm, schlieen Sie es und drcken auf OK.',
                 mbConfirmation,
                 MB_OKCANCEL ) <> IDOK ) then
      Break;
  end;
  DeleteFile( d + f );
end;

// Perform some initializations.  Return False to abort setup
function InitializeSetup: Boolean;
begin
  // Do not use any user defined vars in here such as {app}
  Result := not ( CheckProcessRunning( 'EasyCT.exe',      'EasyCash&Tax' ));

	initwinversion();
  SetForceX86(true); // force 32-bit install of next products
	vcredist2013();
	SetForceX86(false); // disable forced 32-bit install again
end;

function InitializeUninstall: Boolean;
begin
  Result := not ( CheckProcessRunning( 'EasyCT.exe',      'EasyCash&Tax' ));
end;

; Script generated by the Inno Setup Script Wizard.    Version 2 !!!
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

[Setup]
AppName=CSV-Import
AppVerName=CSV-Import 5.1 Test
DiskSpanning=no
AppPublisher=tm
AppPublisherURL=http://www.easyct.de
AppSupportURL=http://www.easyct.de
AppUpdatesURL=http://www.easyct.de
DefaultDirName={pf}\EasyCash&Tax\Plugins\CSV-Import
DefaultGroupName=EasyCash
OutputBaseFilename=ECTImportXSetup
OutputDir=.\Setup
MinVersion=5.0
; MFC9 greift auf GetFileSizeEx zu, das Win 98 nicht in der kernel.dll hat.
Compression=bzip
SignTool=vs6

[Files]
Source: .\Release\ECTImportX.ocx; DestDir: {app}; Flags: regserver ignoreversion
Source: .\ECTIFace.dll; DestDir: {app}; Flags: ignoreversion
; ECTIFace nur noch bentigt fr GetIniFileName
Source: .\LIZENZ.TXT; DestDir: {app}; Flags: ignoreversion
; veraltete Help Datei nicht mehr: Source: D:\Work\ECTImportX\Release\ECTEImport.hlp; DestDir: {app}; Flags: ignoreversion
Source: .\ECTEImport.htm; DestDir: {app}; Flags: ignoreversion
Source: .\gawk.exe; DestDir: {app}; Flags: ignoreversion
Source: .\button.gif; DestDir: {app}; Flags: ignoreversion

[Registry]
Root: HKLM; Subkey: Software\Tools; Flags: uninsdeletekeyifempty
Root: HKLM; Subkey: Software\Tools\EasyCash; Flags: uninsdeletekeyifempty
Root: HKLM; Subkey: Software\Tools\EasyCash\Plugins; Flags: uninsdeletekeyifempty
Root: HKLM; Subkey: Software\Tools\EasyCash\Plugins\CSV-Import; Flags: uninsdeletekey
Root: HKLM; Subkey: Software\Tools\EasyCash\Plugins\CSV-Import; ValueType: string; ValueName: Aufruf; ValueData: ECTImportX.ECTImportXCtrl.1
Root: HKLM; Subkey: Software\Tools\EasyCash\Plugins\CSV-Import; ValueType: string; ValueName: Beschreibung; ValueData: kann Daten im CSV-Format (Character Separated Values) importieren
Root: HKLM; Subkey: Software\Tools\EasyCash\Plugins\CSV-Import; ValueType: string; ValueName: Bitmap; ValueData: {app}\button.gif
Root: HKLM; Subkey: Software\Tools\EasyCash\Plugins\CSV-Import; ValueType: string; ValueName: Name; ValueData: CSV-Import
Root: HKLM; Subkey: Software\Tools\EasyCash\Plugins\CSV-Import; ValueType: string; ValueName: Typ; ValueData: noscroll

[Languages]
Name: "de"; MessagesFile: "compiler:Languages\German.isl"

[Code]
// shared code for installing the products
#include "scripts\products.iss"
// helper functions
#include "scripts\products\stringversion.iss"
#include "scripts\products\winversion.iss"
#include "scripts\products\fileversion.iss"
// actual products
#include "scripts\products\msiproduct.iss"
#include "scripts\products\vcredist2013.iss"

function CheckProcessRunning( aProcName,
                              aProcDesc: string ): boolean;
var
  ShellResult: boolean;
  ResultCode: integer;
  cmd: string;
  sl: TStringList;
  f: string;
  d: string;
begin
  cmd := 'for /f "delims=," %%i ' +
         'in (''tasklist /FI "IMAGENAME eq ' + aProcName + '" /FO CSV'') ' +
         'do if "%%~i"=="' + aProcName + '" exit 1';
  f := 'CheckProc.cmd';
  d := AddBackSlash( ExpandConstant( '{tmp}' ));
  sl := TStringList.Create;
  sl.Add( cmd );
  sl.Add( 'exit /0' );
  sl.SaveToFile( d + f );
  sl.Free;
  Result := true;
  while ( Result ) do
  begin
    ResultCode := 1;
    ShellResult := Exec( f,
                         '',
                         d,
                         SW_HIDE,
                         ewWaitUntilTerminated,
                         ResultCode );
    Result := ResultCode > 0;
    if Result and
       ( MsgBox( aProcDesc + ' ist noch aktiv. Das Programm muss beendet werden, um fortzufahren.'#13#10#13#10 +
                 'Bitte wechseln Sie zu dem Programm, schlieen Sie es und drcken auf OK.',
                 mbConfirmation,
                 MB_OKCANCEL ) <> IDOK ) then
      Break;
  end;
  DeleteFile( d + f );
end;

// Perform some initializations.  Return False to abort setup
function InitializeSetup: Boolean;
begin
  // Do not use any user defined vars in here such as {app}
  Result := not ( CheckProcessRunning( 'EasyCT.exe',      'EasyCash&Tax' ));

	initwinversion();
  SetForceX86(true); // force 32-bit install of next products
	vcredist2013();
	SetForceX86(false); // disable forced 32-bit install again
end;

function InitializeUninstall: Boolean;
begin
  Result := not ( CheckProcessRunning( 'EasyCT.exe',      'EasyCash&Tax' ));
end;


a corrected version of the x86 installer script

  ; Inno Setup script for
; BrailleBlaster x86/x64 version 2012.1
; file name: bb_setup_x86_2012.1.iss
; Created by TJ McElroy
; last compiled: June 28, 2012
; by Vic Beckley
; Using Inno Setup version 5.5.0
; latest Inno Setup Compiler as of June 08, 2012
; can be found at:
; http://www.jrsoftware.org/isdl.php

; Last modified: Jun 28, 2012
; Modified comments at beginning of script
;
; begin:
#define MyAppName "BrailleBlaster"
#define MyAppVersion "2012.1 x86"
#define MyAppPublisher "Jointly ViewPlus Technologies and Abilitiessoft"
#define MyAppURL "http://www.brailleblaster.org/"
#define MyAppExeName "brailleblaster.jar"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{3A313675-BD73-4903-A956-A4C57136AAE7}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
AllowNoIcons=yes
LicenseFile=..\..\dist\LICENSE.txt
InfoBeforeFile=pre_install.txt
InfoAfterFile=thank_you.txt
OutputDir=..\..\
OutputBaseFilename=BrailleBlaster_2012.1_win_x86
Compression=lzma
SolidCompression=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1

[Files]
Source: "..\..\dist\brailleblaster.jar"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\..\dist\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
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,{#StringChange(MyAppName, '&', '&&')}}"; Flags: shellexec postinstall skipifsilent

  ; Inno Setup script for
; BrailleBlaster x86/x64 version 2012.1
; file name: bb_setup_x86_2012.1.iss
; Created by TJ McElroy
; last compiled: June 28, 2012
; by Vic Beckley
; Using Inno Setup version 5.5.0
; latest Inno Setup Compiler as of June 08, 2012
; can be found at:
; http://www.jrsoftware.org/isdl.php

; Last modified: Jun 28, 2012
; Modified comments at beginning of script
;
; begin:
#define MyAppName "BrailleBlaster"
#define MyAppVersion "2012.1 x86"
#define MyAppPublisher "Jointly ViewPlus Technologies and Abilitiessoft"
#define MyAppURL "http://www.brailleblaster.org/"
#define MyAppExeName "brailleblaster.jar"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{3A313675-BD73-4903-A956-A4C57136AAE7}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
AllowNoIcons=yes
LicenseFile=..\..\dist\LICENSE.txt
InfoBeforeFile=pre_install.txt
InfoAfterFile=thank_you.txt
OutputDir=..\..\
OutputBaseFilename=BrailleBlaster_2012.1_win_x86
Compression=lzma
SolidCompression=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1

[Files]
Source: "..\..\dist\brailleblaster.jar"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\..\BrailleBlaster\dist\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
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,{#StringChange(MyAppName, '&', '&&')}}"; Flags: shellexec postinstall skipifsilent


obsolete logs im programm verzeichnis werden nun gelöscht.

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "PALAST"
#define MyAppPublisher "Pixinger"
#define MyAppURL "https://github.com/Pixinger/PALAST/wiki"
#define MyAppExeName "PALAST.exe"
#define MyAppVersion GetFileVersion(AddBackslash(SourcePath) + "PALAST.exe")

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{3D8EA12C-82EA-460B-A548-376FF135778F}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
AllowNoIcons=yes
LicenseFile=D:\_git_src\PALAST\source\_iss\license.txt
OutputDir=D:\_git_src\PALAST\_releases\
OutputBaseFilename=setupPALAST
SetupIconFile=D:\_git_src\PALAST\source\PALAST\Rocket.ico
Compression=lzma
SolidCompression=yes
ShowLanguageDialog=no
LanguageDetectionMethod=none
AppComments=Pixingers Arma Launch And Sync Tool
RestartIfNeededByRun=False

[Languages]
Name: "german"; MessagesFile: "compiler:Languages\German.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1

[Files]
Source: "D:\_git_src\PALAST\source\_iss\PALAST.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\_git_src\PALAST\source\_iss\PALASTServer.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\_git_src\PALAST\source\_iss\NLog.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\_git_src\PALAST\source\_iss\PALAST.Common.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\_git_src\PALAST\source\_iss\configuration.xml"; DestDir: "{app}"; Flags: ignoreversion onlyifdoesntexist; Permissions: everyone-modify
Source: "D:\_git_src\PALAST\source\_iss\license.txt"; DestDir: "{app}"; Flags: ignoreversion isreadme
Source: "D:\_git_src\PALAST\source\_iss\NLog.PALAST.config"; DestDir: "{localappdata}\PALAST\"; Flags: ignoreversion onlyifdoesntexist
Source: "D:\_git_src\PALAST\source\_iss\NLog.PALASTServer.config"; DestDir: "{localappdata}\PALAST\"; Flags: ignoreversion onlyifdoesntexist
Source: "D:\_git_src\PALAST\source\_iss\_log_PALAST.txt"; DestDir: "{app}"; Flags: ignoreversion deleteafterinstall
Source: "D:\_git_src\PALAST\source\_iss\_log_PALASTServer.txt"; DestDir: "{app}"; Flags: ignoreversion deleteafterinstall
Source: "D:\_git_src\PALAST\source\_iss\_log_PALAST.txt"; DestDir: "{localappdata}\PALAST\"; Flags: ignoreversion onlyifdoesntexist
Source: "D:\_git_src\PALAST\source\_iss\_log_PALASTServer.txt"; DestDir: "{localappdata}\PALAST\"; Flags: ignoreversion onlyifdoesntexist
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
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}"; Flags: nowait postinstall skipifsilent; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"
Filename: "{app}\{#MyAppExeName}"; Parameters: "/updated"; Flags: nowait postinstall skipifnotsilent; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"

[Dirs]
Name: "{localappdata}\PALAST"

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "PALAST"
#define MyAppPublisher "Pixinger"
#define MyAppURL "https://github.com/Pixinger/PALAST/wiki"
#define MyAppExeName "PALAST.exe"
#define MyAppVersion GetFileVersion(AddBackslash(SourcePath) + "PALAST.exe")

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{3D8EA12C-82EA-460B-A548-376FF135778F}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
AllowNoIcons=yes
LicenseFile=D:\_git_src\PALAST\source\_iss\license.txt
OutputDir=D:\_git_src\PALAST\_releases\
OutputBaseFilename=setupPALAST
SetupIconFile=D:\_git_src\PALAST\source\PALAST\Rocket.ico
Compression=lzma
SolidCompression=yes
ShowLanguageDialog=no
LanguageDetectionMethod=none
AppComments=Pixingers Arma Launch And Sync Tool
RestartIfNeededByRun=False

[Languages]
Name: "german"; MessagesFile: "compiler:Languages\German.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1

[Files]
Source: "D:\_git_src\PALAST\source\_iss\PALAST.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\_git_src\PALAST\source\_iss\PALASTServer.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\_git_src\PALAST\source\_iss\NLog.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\_git_src\PALAST\source\_iss\PALAST.Common.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\_git_src\PALAST\source\_iss\configuration.xml"; DestDir: "{app}"; Flags: ignoreversion onlyifdoesntexist; Permissions: everyone-modify
Source: "D:\_git_src\PALAST\source\_iss\license.txt"; DestDir: "{app}"; Flags: ignoreversion isreadme
Source: "D:\_git_src\PALAST\source\_iss\NLog.PALAST.config"; DestDir: "{localappdata}\PALAST\"; Flags: ignoreversion onlyifdoesntexist
Source: "D:\_git_src\PALAST\source\_iss\NLog.PALASTServer.config"; DestDir: "{localappdata}\PALAST\"; Flags: ignoreversion onlyifdoesntexist
Source: "D:\_git_src\PALAST\source\_iss\_log_PALAST.txt"; DestDir: "{localappdata}\PALAST\"; Flags: ignoreversion onlyifdoesntexist
Source: "D:\_git_src\PALAST\source\_iss\_log_PALASTServer.txt"; DestDir: "{localappdata}\PALAST\"; Flags: ignoreversion onlyifdoesntexist
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
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}"; Flags: nowait postinstall skipifsilent; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"
Filename: "{app}\{#MyAppExeName}"; Parameters: "/updated"; Flags: nowait postinstall skipifnotsilent; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"

[Dirs]
Name: "{localappdata}\PALAST"


Updates Git for Windows prereq version to 2.6.4.

; This script requires Inno Setup Compiler 5.5.6 or later to compile
; The Inno Setup Compiler (and IDE) can be found at http://www.jrsoftware.org/isinfo.php
; The IDP plugin for Inno Setup is also required and can be found at https://mitrichsoftware.wordpress.com/inno-setup-tools/inno-download-plugin/

#include <idp.iss>

#define MyAppName "Microsoft Git Credential Manager for Windows"
#define MyAppVersion "1.0.0"
#define MyAppPublisher "Microsoft Corporation"
#define MyAppPublisherURL "http://www.microsoft.com"
#define MyAppURL "https://github.com/Microsoft/Git-Credential-Manager-for-Windows"
#define MyAppExeName "git-credential-manager.exe"
#define Git4WinName "Git for Windows 2.6.4"
#define Git4WinUrl "https://github.com/git-for-windows/git/releases/download/v2.6.4.windows.1/Git-2.6.4-64-bit.exe"
#define Git4WinFile "Git-2.6.4-64-bit.exe"
#define Git4WinSpace 394309632
#define NetFxName "The Microsoft .NET Framework 4.6."
#define NetFxBaseFile "NetFx40Installer.exe"
#define NetFxBaseUrl "http://download.microsoft.com/download/1/B/E/1BE39E79-7E39-46A3-96FF-047F95396215/dotNetFx40_Full_setup.exe"
#define NetFxCoreFile "NetFx46Installer.exe"
#define NetFxCoreUrl "http://download.microsoft.com/download/1/4/A/14A6C422-0D3C-4811-A31F-5EF91A83C368/NDP46-KB3045560-Web.exe"
#define NetFxSpace 381005824

[Setup]
AppId={{9F0CBE43-690B-4C03-8845-6AC2CDB29815}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppPublisherURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
AppCopyright=Copyright  Microsoft 2015
AppReadmeFile=https://github.com/Microsoft/Git-Credential-Manager-for-Windows/blob/master/README.md
BackColor=clWhite
BackSolid=yes
DefaultDirName={userpf}\{#MyAppName}
LicenseFile=..\Deploy\LICENSE.TXT
OutputBaseFilename=Setup
Compression=lzma2
InternalCompressLevel=ultra64
SolidCompression=yes
MinVersion=6.1.7600
DisableDirPage=yes
DisableReadyPage=yes
SetupIconFile=Assets\gcmicon.ico
ArchitecturesInstallIn64BitMode=x64
WizardImageBackColor=clWhite
WizardImageFile=Assets\gcmicon128.bmp
WizardSmallImageFile=Assets\gcmicon64.bmp
WizardImageStretch=no
WindowResizable=no

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl";

[Types]
Name: "full"; Description: "Full installation"; Flags: iscustom;

[Components]
Name: "NetFx"; Description: {#NetFxName}; ExtraDiskSpaceRequired: {#NetFxSpace}; Types: full; Flags: fixed; Check: DetectNetFxChecked;
Name: "Git4Win"; Description: {#Git4WinName}; ExtraDiskSpaceRequired: {#Git4WinSpace}; Types: full; Flags: fixed; Check: DetectGitChecked;

[Dirs]
Name: "{tmp}\gcmSetup"

[Files]
Source: "..\Deploy\git-credential-manager.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\Deploy\Microsoft.Alm.Authentication.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\Deploy\Microsoft.Alm.Git.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\Deploy\Microsoft.IdentityModel.Clients.ActiveDirectory.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\Deploy\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\Deploy\README.md"; DestDir: "{app}"; Flags: ignoreversion

[UninstallDelete]
Type: files; Name: "{app}\git-credential-manager.exe";
Type: files; Name: "{app}\Microsoft.Alm.Authentication.dll";
Type: files; Name: "{app}\Microsoft.Alm.Git.dll";
Type: files; Name: "{app}\Microsoft.IdentityModel.Clients.ActiveDirectory.dll";
Type: files; Name: "{app}\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll";
Type: files; Name: "{app}\README.md";

[Code]
type NetFx_Version = (
     NetFx_v30,  // .NET Framework 3.0
     NetFx_v35,  // .NET Framework 3.5
     NetFx_v40,  // .NET Framework 4.0
     NetFx_v45,  // .NET Framework 4.5
     NetFx_v451, // .NET Framework 4.5.1
     NetFx_v452, // .NET Framework 4.5.2
     NetFx_v46); // .NET Framework 4.6

function DetectGit(): Boolean;
var
  bSuccess: Boolean;
  strValue: String;
begin
    Result := True;

    bSuccess := RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Git_is1', 'InstallLocation', strValue)
             or RegQueryStringValue(HKLM, 'SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Git_is1', 'InstallLocation', strValue)
             or RegQueryStringValue(HKCU, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Git_is1', 'InstallLocation', strValue)
             or RegQueryStringValue(HKCU, 'SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Git_is1', 'InstallLocation', strValue);

    if not bSuccess then
      begin
        Result := False;
      end;
end;

function DetectGitChecked(): Boolean;
begin
  Result := not DetectGit();
end;

function DetectNetFx(version: NetFx_Version): Boolean;
var
  bSuccess: Boolean;
  regVersion: Cardinal;
begin
  Result := False;

  bSuccess := RegQueryDWordValue(HKLM, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0', 'Install', regVersion);

  if (NetFx_v30 = version) and bSuccess then
    begin
      Result := True;
    end;

  bSuccess := RegQueryDWordValue(HKLM, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5', 'Install', regVersion);

  if (NetFx_v35 = version) and bSuccess then
    begin
      Result := True;
    end;

  bSuccess := RegQueryDWordValue(HKLM, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v4.0\Full', 'Install', regVersion)
           or RegQueryDWordValue(HKLM, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v4.0\Client', 'Install', regVersion);

  if (NetFx_v40 = version) and bSuccess then
      begin
        Result := True;
      end;

  bSuccess := RegQueryDWordValue(HKLM, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full', 'Release', regVersion)
           or RegQueryDWordValue(HKLM, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Client', 'Release', regVersion);

  if bSuccess then
    begin
      if (NetFx_v45 = version) and (regVersion >= 378389)then
        begin
          Result := True;
        end;

      if (NetFx_v451 = version) and (regVersion >= 378675)then
        begin
          Result := True;
        end;

      if (NetFx_v452 = version) and (regVersion >= 379893)then
        begin
          Result := True;
        end;

      if (NetFx_v46 = version) and (regVersion >= 393295) then
        begin
          Result := True;
        end;
    end;
end;

function DetectNetFxChecked(): Boolean;
begin
  Result := not DetectNetFx(NetFx_v451);
end;

function InstallPrerequisites() : Boolean;
var
  bInstallFx40: Boolean;
  bInstallFx46: Boolean;
  bInstallGit: Boolean;
  StatusText: string;
  ResultCode: Integer;
begin
  Result := True;

  bInstallFx40 := FileExists(ExpandConstant('{tmp}\{#NetFxBaseFile}'));
  bInstallFx46 := FileExists(ExpandConstant('{tmp}\{#NetFxCoreFile}'));
  bInstallGit := FileExists(ExpandConstant('{tmp}\{#Git4WinFile}'));

  if bInstallFx40 or bInstallFx46 then
    begin
      StatusText := WizardForm.StatusLabel.Caption;
      WizardForm.StatusLabel.Caption := 'Installing {#NetFxName}. This might take a few minutes...';
      WizardForm.ProgressGauge.Style := npbstMarquee;

      try
        if bInstallFx40 then
          begin
            if not Exec(ExpandConstant('{tmp}\{#NetFxBaseFile}'), '/passive /norestart', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
              begin
                Result := False;
                MsgBox('.NET installation failed with code: ' + IntToStr(ResultCode) + '.', mbError, MB_OK);
              end;
          end;

        if bInstallFx46 then
          begin
            if not Exec(ExpandConstant('{tmp}\{#NetFxCoreFile}'), '/passive /norestart', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
              begin
                Result := False;
                MsgBox('.NET installation failed with code: ' + IntToStr(ResultCode) + '.', mbError, MB_OK);
              end;
          end;
      finally
        WizardForm.StatusLabel.Caption := StatusText;
        WizardForm.ProgressGauge.Style := npbstNormal;
      end;
    end;

  if bInstallGit then
    begin
      StatusText := WizardForm.StatusLabel.Caption;
      WizardForm.StatusLabel.Caption := 'Installing {#Git4WinName}. This might take a few minutes...';
      WizardForm.ProgressGauge.Style := npbstMarquee;

      try
        if not Exec(ExpandConstant('{tmp}\{#Git4WinFile}'), '/NOCANCEL', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
          begin
            Result := False;
            MsgBox('Installing Git for Windows failed with code: ' + IntToStr(ResultCode) + '.', mbError, MB_OK);
          end;
      finally
        WizardForm.StatusLabel.Caption := StatusText;
        WizardForm.ProgressGauge.Style := npbstNormal;
      end;
    end;
end;

function InstallManager() : Boolean;
var
  ResultCode: integer;
  StatusText: string;
begin
  Result := False;

  StatusText := WizardForm.StatusLabel.Caption;
  WizardForm.StatusLabel.Caption := 'Installing {#MyAppName}.';
  WizardForm.ProgressGauge.Style := npbstMarquee;

  try
    if Exec(ExpandConstant('{app}\git-credential-manager.exe'), 'deploy --passive --nofail', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) then
      begin
        Result := True;
      end;
  finally
    WizardForm.StatusLabel.Caption := StatusText;
    WizardForm.ProgressGauge.Style := npbstNormal;
  end;
end;

function UninstallManager() : Boolean;
var
  ResultCode: integer;
  StatusText: string;
begin
  Result := false;

  if Exec(ExpandConstant('{app}\git-credential-manager.exe'), 'remove --passive --nofail', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) then
    begin
      Result := True;
    end;
end;

function InitializeUninstall(): Boolean;
begin
  Result := True;
end;

procedure InitializeWizard;
begin
  if not DetectNetFx(NetFx_v40) then
    begin
      idpAddFile('{#NetFxBaseUrl}', ExpandConstant('{tmp}\{#NetFxBaseFile}'));
      idpDownloadAfter(wpReady);
    end;

  if not DetectNetFx(NetFx_v451) then
    begin
      idpAddFile('{#NetFxCoreUrl}', ExpandConstant('{tmp}\{#NetFxCoreFile}'));
      idpDownloadAfter(wpReady);
    end;

  if not DetectGit() then
    begin
      idpAddFile('{#Git4WinUrl}', ExpandConstant('{tmp}\{#Git4WinFile}'));
      idpDownloadAfter(wpReady);
    end;
end;

procedure CurStepChanged(CurStep: TSetupStep);
begin
  case CurStep of
    ssInstall:
      begin
        if not (InstallPrerequisites()) then
          begin
            Abort();
          end;
      end;

    ssPostInstall:
      begin
        if not (InstallManager()) then
          begin
            RaiseException('Fatal: An error occured when updating the local system.');
          end;
      end;
  end;
end;

procedure CurUninstallStepChanged(CurStep: TUninstallStep);
begin
  case CurStep of
    usUninstall:
      if not (UninstallManager()) then
        begin
          Abort();
        end;
    end;
end;

; This script requires Inno Setup Compiler 5.5.6 or later to compile
; The Inno Setup Compiler (and IDE) can be found at http://www.jrsoftware.org/isinfo.php
; The IDP plugin for Inno Setup is also required and can be found at https://mitrichsoftware.wordpress.com/inno-setup-tools/inno-download-plugin/

#include <idp.iss>

#define MyAppName "Microsoft Git Credential Manager for Windows"
#define MyAppVersion "1.0.0"
#define MyAppPublisher "Microsoft Corporation"
#define MyAppPublisherURL "http://www.microsoft.com"
#define MyAppURL "https://github.com/Microsoft/Git-Credential-Manager-for-Windows"
#define MyAppExeName "git-credential-manager.exe"
#define Git4WinName "Git for Windows 2.6.3"
#define Git4WinUrl "https://github.com/git-for-windows/git/releases/download/v2.6.3.windows.1/Git-2.6.3-64-bit.exe"
#define Git4WinFile "Git-2.6.3-64-bit.exe"
#define Git4WinSpace 394309632
#define NetFxName "The Microsoft .NET Framework 4.6."
#define NetFxBaseFile "NetFx40Installer.exe"
#define NetFxBaseUrl "http://download.microsoft.com/download/1/B/E/1BE39E79-7E39-46A3-96FF-047F95396215/dotNetFx40_Full_setup.exe"
#define NetFxCoreFile "NetFx46Installer.exe"
#define NetFxCoreUrl "http://download.microsoft.com/download/1/4/A/14A6C422-0D3C-4811-A31F-5EF91A83C368/NDP46-KB3045560-Web.exe"
#define NetFxSpace 381005824

[Setup]
AppId={{9F0CBE43-690B-4C03-8845-6AC2CDB29815}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppPublisherURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
AppCopyright=Copyright  Microsoft 2015
AppReadmeFile=https://github.com/Microsoft/Git-Credential-Manager-for-Windows/blob/master/README.md
BackColor=clWhite
BackSolid=yes
DefaultDirName={userpf}\{#MyAppName}
LicenseFile=..\Deploy\LICENSE.TXT
OutputBaseFilename=Setup
Compression=lzma2
InternalCompressLevel=ultra64
SolidCompression=yes
MinVersion=6.1.7600
DisableDirPage=yes
DisableReadyPage=yes
SetupIconFile=Assets\gcmicon.ico
ArchitecturesInstallIn64BitMode=x64
WizardImageBackColor=clWhite
WizardImageFile=Assets\gcmicon128.bmp
WizardSmallImageFile=Assets\gcmicon64.bmp
WizardImageStretch=no
WindowResizable=no

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl";

[Types]
Name: "full"; Description: "Full installation"; Flags: iscustom;

[Components]
Name: "NetFx"; Description: {#NetFxName}; ExtraDiskSpaceRequired: {#NetFxSpace}; Types: full; Flags: fixed; Check: DetectNetFxChecked;
Name: "Git4Win"; Description: {#Git4WinName}; ExtraDiskSpaceRequired: {#Git4WinSpace}; Types: full; Flags: fixed; Check: DetectGitChecked;

[Dirs]
Name: "{tmp}\gcmSetup"

[Files]
Source: "..\Deploy\git-credential-manager.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\Deploy\Microsoft.Alm.Authentication.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\Deploy\Microsoft.Alm.Git.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\Deploy\Microsoft.IdentityModel.Clients.ActiveDirectory.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\Deploy\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\Deploy\README.md"; DestDir: "{app}"; Flags: ignoreversion

[UninstallDelete]
Type: files; Name: "{app}\git-credential-manager.exe";
Type: files; Name: "{app}\Microsoft.Alm.Authentication.dll";
Type: files; Name: "{app}\Microsoft.Alm.Git.dll";
Type: files; Name: "{app}\Microsoft.IdentityModel.Clients.ActiveDirectory.dll";
Type: files; Name: "{app}\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll";
Type: files; Name: "{app}\README.md";

[Code]
type NetFx_Version = (
     NetFx_v30,  // .NET Framework 3.0
     NetFx_v35,  // .NET Framework 3.5
     NetFx_v40,  // .NET Framework 4.0
     NetFx_v45,  // .NET Framework 4.5
     NetFx_v451, // .NET Framework 4.5.1
     NetFx_v452, // .NET Framework 4.5.2
     NetFx_v46); // .NET Framework 4.6

function DetectGit(): Boolean;
var
  bSuccess: Boolean;
  strValue: String;
begin
    Result := True;

    bSuccess := RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Git_is1', 'InstallLocation', strValue)
             or RegQueryStringValue(HKLM, 'SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Git_is1', 'InstallLocation', strValue)
             or RegQueryStringValue(HKCU, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Git_is1', 'InstallLocation', strValue)
             or RegQueryStringValue(HKCU, 'SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Git_is1', 'InstallLocation', strValue);

    if not bSuccess then
      begin
        Result := False;
      end;
end;

function DetectGitChecked(): Boolean;
begin
  Result := not DetectGit();
end;

function DetectNetFx(version: NetFx_Version): Boolean;
var
  bSuccess: Boolean;
  regVersion: Cardinal;
begin
  Result := False;

  bSuccess := RegQueryDWordValue(HKLM, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0', 'Install', regVersion);

  if (NetFx_v30 = version) and bSuccess then
    begin
      Result := True;
    end;

  bSuccess := RegQueryDWordValue(HKLM, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5', 'Install', regVersion);

  if (NetFx_v35 = version) and bSuccess then
    begin
      Result := True;
    end;

  bSuccess := RegQueryDWordValue(HKLM, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v4.0\Full', 'Install', regVersion)
           or RegQueryDWordValue(HKLM, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v4.0\Client', 'Install', regVersion);

  if (NetFx_v40 = version) and bSuccess then
      begin
        Result := True;
      end;

  bSuccess := RegQueryDWordValue(HKLM, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full', 'Release', regVersion)
           or RegQueryDWordValue(HKLM, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Client', 'Release', regVersion);

  if bSuccess then
    begin
      if (NetFx_v45 = version) and (regVersion >= 378389)then
        begin
          Result := True;
        end;

      if (NetFx_v451 = version) and (regVersion >= 378675)then
        begin
          Result := True;
        end;

      if (NetFx_v452 = version) and (regVersion >= 379893)then
        begin
          Result := True;
        end;

      if (NetFx_v46 = version) and (regVersion >= 393295) then
        begin
          Result := True;
        end;
    end;
end;

function DetectNetFxChecked(): Boolean;
begin
  Result := not DetectNetFx(NetFx_v451);
end;

function InstallPrerequisites() : Boolean;
var
  bInstallFx40: Boolean;
  bInstallFx46: Boolean;
  bInstallGit: Boolean;
  StatusText: string;
  ResultCode: Integer;
begin
  Result := True;

  bInstallFx40 := FileExists(ExpandConstant('{tmp}\{#NetFxBaseFile}'));
  bInstallFx46 := FileExists(ExpandConstant('{tmp}\{#NetFxCoreFile}'));
  bInstallGit := FileExists(ExpandConstant('{tmp}\{#Git4WinFile}'));

  if bInstallFx40 or bInstallFx46 then
    begin
      StatusText := WizardForm.StatusLabel.Caption;
      WizardForm.StatusLabel.Caption := 'Installing {#NetFxName}. This might take a few minutes...';
      WizardForm.ProgressGauge.Style := npbstMarquee;

      try
        if bInstallFx40 then
          begin
            if not Exec(ExpandConstant('{tmp}\{#NetFxBaseFile}'), '/passive /norestart', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
              begin
                Result := False;
                MsgBox('.NET installation failed with code: ' + IntToStr(ResultCode) + '.', mbError, MB_OK);
              end;
          end;

        if bInstallFx46 then
          begin
            if not Exec(ExpandConstant('{tmp}\{#NetFxCoreFile}'), '/passive /norestart', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
              begin
                Result := False;
                MsgBox('.NET installation failed with code: ' + IntToStr(ResultCode) + '.', mbError, MB_OK);
              end;
          end;
      finally
        WizardForm.StatusLabel.Caption := StatusText;
        WizardForm.ProgressGauge.Style := npbstNormal;
      end;
    end;

  if bInstallGit then
    begin
      StatusText := WizardForm.StatusLabel.Caption;
      WizardForm.StatusLabel.Caption := 'Installing {#Git4WinName}. This might take a few minutes...';
      WizardForm.ProgressGauge.Style := npbstMarquee;

      try
        if not Exec(ExpandConstant('{tmp}\{#Git4WinFile}'), '/NOCANCEL', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
          begin
            Result := False;
            MsgBox('Installing Git for Windows failed with code: ' + IntToStr(ResultCode) + '.', mbError, MB_OK);
          end;
      finally
        WizardForm.StatusLabel.Caption := StatusText;
        WizardForm.ProgressGauge.Style := npbstNormal;
      end;
    end;
end;

function InstallManager() : Boolean;
var
  ResultCode: integer;
  StatusText: string;
begin
  Result := False;

  StatusText := WizardForm.StatusLabel.Caption;
  WizardForm.StatusLabel.Caption := 'Installing {#MyAppName}.';
  WizardForm.ProgressGauge.Style := npbstMarquee;

  try
    if Exec(ExpandConstant('{app}\git-credential-manager.exe'), 'deploy --passive --nofail', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) then
      begin
        Result := True;
      end;
  finally
    WizardForm.StatusLabel.Caption := StatusText;
    WizardForm.ProgressGauge.Style := npbstNormal;
  end;
end;

function UninstallManager() : Boolean;
var
  ResultCode: integer;
  StatusText: string;
begin
  Result := false;

  if Exec(ExpandConstant('{app}\git-credential-manager.exe'), 'remove --passive --nofail', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) then
    begin
      Result := True;
    end;
end;

function InitializeUninstall(): Boolean;
begin
  Result := True;
end;

procedure InitializeWizard;
begin
  if not DetectNetFx(NetFx_v40) then
    begin
      idpAddFile('{#NetFxBaseUrl}', ExpandConstant('{tmp}\{#NetFxBaseFile}'));
      idpDownloadAfter(wpReady);
    end;

  if not DetectNetFx(NetFx_v451) then
    begin
      idpAddFile('{#NetFxCoreUrl}', ExpandConstant('{tmp}\{#NetFxCoreFile}'));
      idpDownloadAfter(wpReady);
    end;

  if not DetectGit() then
    begin
      idpAddFile('{#Git4WinUrl}', ExpandConstant('{tmp}\{#Git4WinFile}'));
      idpDownloadAfter(wpReady);
    end;
end;

procedure CurStepChanged(CurStep: TSetupStep);
begin
  case CurStep of
    ssInstall:
      begin
        if not (InstallPrerequisites()) then
          begin
            Abort();
          end;
      end;

    ssPostInstall:
      begin
        if not (InstallManager()) then
          begin
            RaiseException('Fatal: An error occured when updating the local system.');
          end;
      end;
  end;
end;

procedure CurUninstallStepChanged(CurStep: TUninstallStep);
begin
  case CurStep of
    usUninstall:
      if not (UninstallManager()) then
        begin
          Abort();
        end;
    end;
end;


update version number in pathvisio.iss file

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

; requires ISPP (InnoSetup Pre-Processor) to be installed.
#define AppVerStr "3.0.0"

[Setup]
AppName=PathVisio
AppVerName=PathVisio {#AppVerStr}
AppPublisher=BiGCaT Bioinformatics, University of Maastricht
AppPublisherURL=http://www.genmapp.org
AppSupportURL=http://www.pathvisio.org
AppUpdatesURL=http://www.pathvisio.org
DefaultDirName={pf}\PathVisio
DefaultGroupName=PathVisio
AllowNoIcons=yes
OutputBaseFilename=PathVisio-{#AppVerStr}-Setup
Compression=lzma
SolidCompression=yes
OutputDir=release
ChangesAssociations=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
Source: "pathvisio.bat"; DestDir: "{app}"; Flags: ignoreversion
Source: "pvicon.ico"; DestDir: "{app}"; Flags: ignoreversion
Source: "pathvisio.jar"; DestDir: "{app}"; Flags: ignoreversion
Source: "readme.txt"; DestDir: "{app}"; Flags: ignoreversion
Source: "LICENSE-2.0.txt"; DestDir: "{app}"; Flags: ignoreversion
Source: "NOTICE.txt"; DestDir: "{app}"; Flags: ignoreversion
Source: "CONTRIBUTORS.txt"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\PathVisio"; Filename: "{app}\pathvisio.bat"; IconFilename: "{app}\pvicon.ico";
Name: "{group}\{cm:UninstallProgram,PathVisio}"; Filename: "{uninstallexe}"
Name: "{userdesktop}\PathVisio"; Filename: "{app}\pathvisio.bat"; IconFilename: "{app}\pvicon.ico"; Tasks: desktopicon

[Run]
Filename: "{app}\pathvisio.bat"; Description: "{cm:LaunchProgram,PathVisio}"; Flags: nowait postinstall skipifsilent

[Registry]
Root: HKCR; Subkey: ".gpml"; ValueType: string; ValueName: ""; ValueData: "GpmlPathway"; Flags: uninsdeletevalue
Root: HKCR; Subkey: "GpmlPathway"; ValueType: string; ValueName: ""; ValueData: "GPML Pathway for PathVisio"; Flags: uninsdeletekey
Root: HKCR; Subkey: "GpmlPathway\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\pvicon.ico"
Root: HKCR; Subkey: "GpmlPathway\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\pathvisio.bat"" ""%1"""

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

; requires ISPP (InnoSetup Pre-Processor) to be installed.
#define AppVerStr "3.0.Beta3"

[Setup]
AppName=PathVisio
AppVerName=PathVisio {#AppVerStr}
AppPublisher=BiGCaT Bioinformatics, University of Maastricht
AppPublisherURL=http://www.genmapp.org
AppSupportURL=http://www.pathvisio.org
AppUpdatesURL=http://www.pathvisio.org
DefaultDirName={pf}\PathVisio
DefaultGroupName=PathVisio
AllowNoIcons=yes
OutputBaseFilename=PathVisio-{#AppVerStr}-Setup
Compression=lzma
SolidCompression=yes
OutputDir=release
ChangesAssociations=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
Source: "pathvisio.bat"; DestDir: "{app}"; Flags: ignoreversion
Source: "pvicon.ico"; DestDir: "{app}"; Flags: ignoreversion
Source: "pathvisio.jar"; DestDir: "{app}"; Flags: ignoreversion
Source: "readme.txt"; DestDir: "{app}"; Flags: ignoreversion
Source: "LICENSE-2.0.txt"; DestDir: "{app}"; Flags: ignoreversion
Source: "NOTICE.txt"; DestDir: "{app}"; Flags: ignoreversion
Source: "CONTRIBUTORS.txt"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\PathVisio"; Filename: "{app}\pathvisio.bat"; IconFilename: "{app}\pvicon.ico";
Name: "{group}\{cm:UninstallProgram,PathVisio}"; Filename: "{uninstallexe}"
Name: "{userdesktop}\PathVisio"; Filename: "{app}\pathvisio.bat"; IconFilename: "{app}\pvicon.ico"; Tasks: desktopicon

[Run]
Filename: "{app}\pathvisio.bat"; Description: "{cm:LaunchProgram,PathVisio}"; Flags: nowait postinstall skipifsilent

[Registry]
Root: HKCR; Subkey: ".gpml"; ValueType: string; ValueName: ""; ValueData: "GpmlPathway"; Flags: uninsdeletevalue
Root: HKCR; Subkey: "GpmlPathway"; ValueType: string; ValueName: ""; ValueData: "GPML Pathway for PathVisio"; Flags: uninsdeletekey
Root: HKCR; Subkey: "GpmlPathway\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\pvicon.ico"
Root: HKCR; Subkey: "GpmlPathway\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\pathvisio.bat"" ""%1"""