Generated an Inno Setup installer script.

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

#define MyAppName "My Program"
#define MyAppVersion "1.5"
#define MyAppPublisher "My Company, Inc."
#define MyAppURL "http://www.example.com/"
#define MyAppExeName "MyProg.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={{DEA29385-E983-4A44-81AB-F9CA69961459}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
LicenseFile=..\LICENSE.txt
InfoAfterFile=..\AUTHORS.txt
OutputDir=../build
OutputBaseFilename=SolarSpaceSetup
Compression=lzma
SolidCompression=yes

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

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

[Files]
Source: "C:\Program Files (x86)\Inno Setup 5\Examples\MyProg.exe"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

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

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


call viewer build when creating installer

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

#define MyAppName "AvNav"
#define MyAppVersion GetFileVersion("..\\AvChartConvert.exe")
#define MyAppVersionMinus StringChange(MyAppVersion,".","-")
;#define MyAppVersion "2015-10-16"
#define MyAppPublisher "Andreas Vogel"
#define MyAppURL "http://www.wellenvogel.de/software/avnav"
#define MyAppExeName "AvChartConvert.exe"
#define RegKey "SOFTWARE\AvNav"
#define PythonMSI "python-2.7.10.msi"
#define PythonCode "{{E2B51919-207A-43EB-AE78-733F9C6797C2}"
#define PythonDir "python"
#define GdalMSI "gdal-111-1500-core.msi"
#define GdalCode "{{A811F26E-D8EE-4DDB-8E23-ED5386E98695}"
#define GdalDir "gdal"
#define GdalPythonMSI "GDAL-1.11.0.win32-py2.7.msi"
#define GdalPythonCode "{{B086ED88-4BB5-46E0-9CDA-8AA8ED2BF906}"
#define PillowWhl "Pillow-3.0.0-cp27-none-win32.whl"
#define PySerial "pyserial-2.7.tar.gz"
#define KeyInstalledPython "installedPython"
#define KeyInstalledGdal "installedGdal"
#define KeyUnistallBase "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"

[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={{832C93A9-F8FA-4EE4-9447-2645D4340A13}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
AllowNoIcons=yes
;OutputDir=C:\Users\andreas\Documents\GitHub\avnav\windows\installer
OutputBaseFilename=AvNavSetup-{#MyAppVersionMinus}
Compression=lzma
SolidCompression=yes
ChangesEnvironment=yes

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

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

[Files]
Source: "..\AvChartConvert.exe"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
Source: "..\avnav_server_home.xml"; DestDir: "{app}"; DestName: "avnav_server.xml"
Source: "..\..\server\*.py"; DestDir: "{app}\scripts"
Source: "..\..\chartconvert\*.py"; DestDir: "{app}\scripts"
Source: "..\..\chartconvert\tiler_tools\*.py"; DestDir: "{app}\scripts\tiler_tools"
Source: "..\..\chartconvert\tiler_tools\*.csv"; DestDir: "{app}\scripts\tiler_tools"
Source: "..\..\chartconvert\tiler_tools\*.html"; DestDir: "{app}\scripts\tiler_tools"
Source: "library\{#PythonMSI}"; DestDir: "{tmp}"
Source: "library\{#GdalMSI}"; DestDir: "{tmp}"
Source: "library\{#GdalPythonMSI}"; DestDir: "{tmp}"
Source: "library\{#PillowWhl}"; DestDir: "{tmp}"
Source: "library\{#PySerial}"; DestDir: "{tmp}"
Source: "..\..\viewer\avnav_min.js"; DestDir: "{app}\viewer"
Source: "..\..\viewer\loader.js"; DestDir: "{app}\viewer"
Source: "..\..\viewer\version.js"; DestDir: "{app}\viewer"
Source: "..\..\viewer\avnav_viewer.html"; DestDir: "{app}\viewer"
Source: "..\..\viewer\avnav_viewer.less"; DestDir: "{app}\viewer"
Source: "..\..\viewer\base.js"; DestDir: "{app}\viewer"
Source: "..\..\viewer\images\*.png"; DestDir: "{app}\viewer\images"
Source: "..\..\libraries\*"; DestDir: "{app}\libraries"; Flags: recursesubdirs; Excludes: "*.pyc,*debug.js"
Source: "..\..\test\nmea-20130630-3.log"; DestDir: "{app}\test"

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

[Run]
Filename: "{app}\{#MyAppExeName}"; Flags: nowait postinstall skipifsilent; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"
Filename: "msiexec.exe"; Parameters: "/i ""{tmp}\{#PythonMSI}"" /qb TARGETDIR=""{app}\{#PythonDir}"""; WorkingDir: "{tmp}"; Check: checkInstallPython
Filename: "msiexec.exe"; Parameters: "/i ""{tmp}\{#GdalMSI}"" /qb TARGETDIR=""{app}\{#GdalDir}"" INSTALLDIR=""{app}\{#GdalDir}"""; WorkingDir: "{tmp}"; Check: checkInstallGdal
Filename: "msiexec.exe"; Parameters: "/i ""{tmp}\{#GdalPythonMSI}"" /qb TARGETDIR=""{app}\{#GdalDir}"" INSTALLDIR=""{app}\{#GdalDir}"""; WorkingDir: "{tmp}"; Check: checkInstallGdal

[Registry]
Root: "HKLM"; Subkey: "{#RegKey}"; ValueType: string; ValueName: "InstallDir"; ValueData: "{app}"; Flags: createvalueifdoesntexist  uninsdeletekey
Root: "HKLM"; Subkey: "{#RegKey}"; ValueType: string; ValueName: "{#KeyInstalledPython}"; ValueData: "true"; Flags: createvalueifdoesntexist uninsdeletekey; Check: checkInstallPython
Root: "HKLM"; Subkey: "{#RegKey}"; ValueType: string; ValueName: "{#KeyInstalledGdal}"; ValueData: "true"; Flags: createvalueifdoesntexist uninsdeletekey;  Check: checkInstallGdal
Root: "HKCU"; Subkey: "Environment"; ValueType:string; ValueName:"GDAL_DATA"; ValueData:"{app}\gdal\gdal_data" ; Flags: preservestringtype ; Check: checkInstallGdal

[PreCompile]
Name: "build.cmd"; Flags: abortonerror cmdprompt redirectoutput

[Code]

function findPip(): string;
var
val: string;
pip: string;
spos: integer;
begin
  Result:='';
  if RegQueryStringValue(HKEY_CLASSES_ROOT,'Python.File\shell\open\command','',val) then begin
       spos:=Pos('" ',val);
       if spos > 0 then begin
         val:=copy(val,1,spos);
       end;
       val:=RemoveQuotes(val);
       Log('val='+val);
       pip:=ExtractFilePath(val)+'\scripts\pip.exe';
       //MsgBox('found pip at '+pip,mbError, MB_OK);
       Result:=pip;
  end;
end;

function BoolToStr(ip:Boolean): string;
begin
  if ip then
  begin
    Result:='true';
  end else begin
    Result:='false';
  end;
end;

function isProductInstalled(ProductCode: String): Boolean;
var rkey:string;
begin
  rkey:=ExpandConstant('{#KeyUnistallBase}')+ProductCode;
  Log('isProductInstalled '+rkey);
  Result:=RegKeyExists(HKEY_LOCAL_MACHINE,rkey);
end;

var
OptionPage: TInputOptionWizardPage;
uninstallPython: Boolean;
uninstallGdal: Boolean;
procedure InitializeWizard;
var
subcap:String;
pythonInstalled:Boolean;
gdalInstalled: Boolean;

begin
  { Create the pages }
  subcap:='If select to install python/gdal the embedded python/gdal will become your default';
  pythonInstalled:=isProductInstalled(ExpandConstant('{#PythonCode}'));
  Log('pythonInstalled: '+BoolToStr(pythonInstalled));
  gdalInstalled:=isProductInstalled(ExpandConstant('{#GdalCode}'));
  Log('gdalInstalled: '+BoolToStr(gdalInstalled));
  if pythonInstalled then begin
    subcap:=subcap+#13+'HINT: Python 2.7 is already installed';
  end;
  if gdalInstalled then begin
    subcap:=subcap+#13+'HINT: gdal is already installed';
  end;
  OptionPage := CreateInputOptionPage(wpWelcome,
    'Install Python/GDAL', 'Select if you want to install the embedded python/gdal',
    subcap,
    True, False);
  OptionPage.AddEx('Install Python',0,false);
  OptionPage.AddEx('Install GDAL',0,false);
  OptionPage.Values[0]:= not pythonInstalled;
  OptionPage.Values[1]:= not gdalInstalled;
end;

function checkInstall(index:integer): Boolean;
begin
  Result:=OptionPage.Values[index];
end;

function checkInstallPython(): Boolean;
begin
  Result:=checkInstall(0);
end;

function checkInstallGdal(): Boolean;
begin
  Result:=checkInstall(1);
end;

procedure CurStepChanged(CurStep: TSetupStep);
var
pip:string;
ResultCode: integer;
oldPath: string;
begin
  if CurStep = ssPostInstall then begin
    pip:=findPip();
    Log('pip found at '+pip);
    if FileExists(pip) then begin
       Exec(pip,'install "'+ExpandConstant('{tmp}\{#PillowWhl}')+'"','',SW_SHOW,ewWaitUntilTerminated, ResultCode);
       if ResultCode <> 0 then begin
         MsgBox('error during installing Pillow ',mbError, MB_OK);
       end;
       Exec(pip,'install "'+ExpandConstant('{tmp}\{#PySerial}')+'"','',SW_SHOW,ewWaitUntilTerminated, ResultCode);
       if ResultCode <> 0 then begin
         MsgBox('error during installing Pyserial ',mbError, MB_OK);
       end
    end else begin
      MsgBox('unable to find pip for python, cannot install Pillow/Pyserial ',mbError, MB_OK);
    end;
    if checkInstallGdal() then begin
      oldpath:='';
      RegQueryStringValue(HKEY_LOCAL_MACHINE,'SYSTEM\CurrentControlSet\Control\Session Manager\Environment',
        'Path',oldpath);
      if Pos('gdal',oldpath) < 1 then begin
        RegWriteExpandStringValue(HKEY_LOCAL_MACHINE,'SYSTEM\CurrentControlSet\Control\Session Manager\Environment',
          'Path',oldpath+';'+ExpandConstant('{app}\{#GdalDir}'));
      end;
    end;
    //add path
  end;
end;

//check if a feature was installed by us
function CheckFeature(Name:String;Key:String): Boolean;
var
  path: String;
  isInstalledByUs: string;
  dirpath: string;
  rkey: string;
begin
  Result:= False;
  rkey:=ExpandConstant('{#RegKey}');
  if RegQueryStringValue(HKEY_LOCAL_MACHINE,rkey,Key,isInstalledByUs) then begin
    if isInstalledByUs = 'true' then begin
      if RegQueryStringValue(HKEY_LOCAL_MACHINE, rkey,'InstallDir', path) then  begin
        dirpath:=path+'\'+Name;
        Result:=DirExists(dirpath);
      end;
    end;
  end;
end;

//Deinstall functions
procedure DeinstallFeature(fkey:String);
var
  ResultCode: Integer;
begin
    Exec('msiexec.exe', '/x '+fkey+' /qb', '', SW_SHOW,
     ewWaitUntilTerminated, ResultCode)
    Log('Deinstall for '+fkey+' ended with '+IntToStr(ResultCode));
end;

function InitializeUninstall(): Boolean;
begin
  Result:=true;
  uninstallPython:=checkFeature(ExpandConstant('{#PythonDir}'),ExpandConstant('{#KeyInstalledPython}'));
  uninstallGdal:=checkFeature(ExpandConstant('{#GdalDir}'),ExpandConstant('{#KeyInstalledGdal}'));
end;
//take the uninstall id from the properties of the MSI
//getmsiinfo.py library\python-2.7.10.msi "ProductCode"
//would be better to check for the python install dir...
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
  if CurUninstallStep = usPostUninstall then begin
    if uninstallPython then
    begin
      DeinstallFeature(ExpandConstant('{#PythonCode}'));
    end;
    if uninstallGdal then
    begin
      DeinstallFeature(ExpandConstant('{#GdalCode}'));
      DeinstallFeature(ExpandConstant('{#GdalPythonCode}'));
    end;
  end;
end;

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

#define MyAppName "AvNav"
#define MyAppVersion GetFileVersion("..\\AvChartConvert.exe")
#define MyAppVersionMinus StringChange(MyAppVersion,".","-")
;#define MyAppVersion "2015-10-16"
#define MyAppPublisher "Andreas Vogel"
#define MyAppURL "http://www.wellenvogel.de/software/avnav"
#define MyAppExeName "AvChartConvert.exe"
#define RegKey "SOFTWARE\AvNav"
#define PythonMSI "python-2.7.10.msi"
#define PythonCode "{{E2B51919-207A-43EB-AE78-733F9C6797C2}"
#define PythonDir "python"
#define GdalMSI "gdal-111-1500-core.msi"
#define GdalCode "{{A811F26E-D8EE-4DDB-8E23-ED5386E98695}"
#define GdalDir "gdal"
#define GdalPythonMSI "GDAL-1.11.0.win32-py2.7.msi"
#define GdalPythonCode "{{B086ED88-4BB5-46E0-9CDA-8AA8ED2BF906}"
#define PillowWhl "Pillow-3.0.0-cp27-none-win32.whl"
#define PySerial "pyserial-2.7.tar.gz"
#define KeyInstalledPython "installedPython"
#define KeyInstalledGdal "installedGdal"
#define KeyUnistallBase "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"

[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={{832C93A9-F8FA-4EE4-9447-2645D4340A13}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
AllowNoIcons=yes
;OutputDir=C:\Users\andreas\Documents\GitHub\avnav\windows\installer
OutputBaseFilename=AvNavSetup-{#MyAppVersionMinus}
Compression=lzma
SolidCompression=yes
ChangesEnvironment=yes

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

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

[Files]
Source: "..\AvChartConvert.exe"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
Source: "..\avnav_server_home.xml"; DestDir: "{app}"; DestName: "avnav_server.xml"
Source: "..\..\server\*.py"; DestDir: "{app}\scripts"
Source: "..\..\chartconvert\*.py"; DestDir: "{app}\scripts"
Source: "..\..\chartconvert\tiler_tools\*.py"; DestDir: "{app}\scripts\tiler_tools"
Source: "..\..\chartconvert\tiler_tools\*.csv"; DestDir: "{app}\scripts\tiler_tools"
Source: "..\..\chartconvert\tiler_tools\*.html"; DestDir: "{app}\scripts\tiler_tools"
Source: "library\{#PythonMSI}"; DestDir: "{tmp}"
Source: "library\{#GdalMSI}"; DestDir: "{tmp}"
Source: "library\{#GdalPythonMSI}"; DestDir: "{tmp}"
Source: "library\{#PillowWhl}"; DestDir: "{tmp}"
Source: "library\{#PySerial}"; DestDir: "{tmp}"
Source: "..\..\viewer\avnav_min.js"; DestDir: "{app}\viewer"
Source: "..\..\viewer\loader.js"; DestDir: "{app}\viewer"
Source: "..\..\viewer\version.js"; DestDir: "{app}\viewer"
Source: "..\..\viewer\avnav_viewer.html"; DestDir: "{app}\viewer"
Source: "..\..\viewer\avnav_viewer.less"; DestDir: "{app}\viewer"
Source: "..\..\viewer\base.js"; DestDir: "{app}\viewer"
Source: "..\..\viewer\images\*.png"; DestDir: "{app}\viewer\images"
Source: "..\..\libraries\*"; DestDir: "{app}\libraries"; Flags: recursesubdirs; Excludes: "*.pyc,*debug.js"
Source: "..\..\test\nmea-20130630-3.log"; DestDir: "{app}\test"

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

[Run]
Filename: "{app}\{#MyAppExeName}"; Flags: nowait postinstall skipifsilent; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"
Filename: "msiexec.exe"; Parameters: "/i ""{tmp}\{#PythonMSI}"" /qb TARGETDIR=""{app}\{#PythonDir}"""; WorkingDir: "{tmp}"; Check: checkInstallPython
Filename: "msiexec.exe"; Parameters: "/i ""{tmp}\{#GdalMSI}"" /qb TARGETDIR=""{app}\{#GdalDir}"" INSTALLDIR=""{app}\{#GdalDir}"""; WorkingDir: "{tmp}"; Check: checkInstallGdal
Filename: "msiexec.exe"; Parameters: "/i ""{tmp}\{#GdalPythonMSI}"" /qb TARGETDIR=""{app}\{#GdalDir}"" INSTALLDIR=""{app}\{#GdalDir}"""; WorkingDir: "{tmp}"; Check: checkInstallGdal

[Registry]
Root: "HKLM"; Subkey: "{#RegKey}"; ValueType: string; ValueName: "InstallDir"; ValueData: "{app}"; Flags: createvalueifdoesntexist  uninsdeletekey
Root: "HKLM"; Subkey: "{#RegKey}"; ValueType: string; ValueName: "{#KeyInstalledPython}"; ValueData: "true"; Flags: createvalueifdoesntexist uninsdeletekey; Check: checkInstallPython
Root: "HKLM"; Subkey: "{#RegKey}"; ValueType: string; ValueName: "{#KeyInstalledGdal}"; ValueData: "true"; Flags: createvalueifdoesntexist uninsdeletekey;  Check: checkInstallGdal
Root: "HKCU"; Subkey: "Environment"; ValueType:string; ValueName:"GDAL_DATA"; ValueData:"{app}\gdal\gdal_data" ; Flags: preservestringtype ; Check: checkInstallGdal

[Code]

function findPip(): string;
var
val: string;
pip: string;
spos: integer;
begin
  Result:='';
  if RegQueryStringValue(HKEY_CLASSES_ROOT,'Python.File\shell\open\command','',val) then begin
       spos:=Pos('" ',val);
       if spos > 0 then begin
         val:=copy(val,1,spos);
       end;
       val:=RemoveQuotes(val);
       Log('val='+val);
       pip:=ExtractFilePath(val)+'\scripts\pip.exe';
       //MsgBox('found pip at '+pip,mbError, MB_OK);
       Result:=pip;
  end;
end;

function BoolToStr(ip:Boolean): string;
begin
  if ip then
  begin
    Result:='true';
  end else begin
    Result:='false';
  end;
end;

function isProductInstalled(ProductCode: String): Boolean;
var rkey:string;
begin
  rkey:=ExpandConstant('{#KeyUnistallBase}')+ProductCode;
  Log('isProductInstalled '+rkey);
  Result:=RegKeyExists(HKEY_LOCAL_MACHINE,rkey);
end;

var
OptionPage: TInputOptionWizardPage;
uninstallPython: Boolean;
uninstallGdal: Boolean;
procedure InitializeWizard;
var
subcap:String;
pythonInstalled:Boolean;
gdalInstalled: Boolean;

begin
  { Create the pages }
  subcap:='If select to install python/gdal the embedded python/gdal will become your default';
  pythonInstalled:=isProductInstalled(ExpandConstant('{#PythonCode}'));
  Log('pythonInstalled: '+BoolToStr(pythonInstalled));
  gdalInstalled:=isProductInstalled(ExpandConstant('{#GdalCode}'));
  Log('gdalInstalled: '+BoolToStr(gdalInstalled));
  if pythonInstalled then begin
    subcap:=subcap+#13+'HINT: Python 2.7 is already installed';
  end;
  if gdalInstalled then begin
    subcap:=subcap+#13+'HINT: gdal is already installed';
  end;
  OptionPage := CreateInputOptionPage(wpWelcome,
    'Install Python/GDAL', 'Select if you want to install the embedded python/gdal',
    subcap,
    True, False);
  OptionPage.AddEx('Install Python',0,false);
  OptionPage.AddEx('Install GDAL',0,false);
  OptionPage.Values[0]:= not pythonInstalled;
  OptionPage.Values[1]:= not gdalInstalled;
end;

function checkInstall(index:integer): Boolean;
begin
  Result:=OptionPage.Values[index];
end;

function checkInstallPython(): Boolean;
begin
  Result:=checkInstall(0);
end;

function checkInstallGdal(): Boolean;
begin
  Result:=checkInstall(1);
end;

procedure CurStepChanged(CurStep: TSetupStep);
var
pip:string;
ResultCode: integer;
oldPath: string;
begin
  if CurStep = ssPostInstall then begin
    pip:=findPip();
    Log('pip found at '+pip);
    if FileExists(pip) then begin
       Exec(pip,'install "'+ExpandConstant('{tmp}\{#PillowWhl}')+'"','',SW_SHOW,ewWaitUntilTerminated, ResultCode);
       if ResultCode <> 0 then begin
         MsgBox('error during installing Pillow ',mbError, MB_OK);
       end;
       Exec(pip,'install "'+ExpandConstant('{tmp}\{#PySerial}')+'"','',SW_SHOW,ewWaitUntilTerminated, ResultCode);
       if ResultCode <> 0 then begin
         MsgBox('error during installing Pyserial ',mbError, MB_OK);
       end
    end else begin
      MsgBox('unable to find pip for python, cannot install Pillow/Pyserial ',mbError, MB_OK);
    end;
    if checkInstallGdal() then begin
      oldpath:='';
      RegQueryStringValue(HKEY_LOCAL_MACHINE,'SYSTEM\CurrentControlSet\Control\Session Manager\Environment',
        'Path',oldpath);
      if Pos('gdal',oldpath) < 1 then begin
        RegWriteExpandStringValue(HKEY_LOCAL_MACHINE,'SYSTEM\CurrentControlSet\Control\Session Manager\Environment',
          'Path',oldpath+';'+ExpandConstant('{app}\{#GdalDir}'));
      end;
    end;
    //add path
  end;
end;

//check if a feature was installed by us
function CheckFeature(Name:String;Key:String): Boolean;
var
  path: String;
  isInstalledByUs: string;
  dirpath: string;
  rkey: string;
begin
  Result:= False;
  rkey:=ExpandConstant('{#RegKey}');
  if RegQueryStringValue(HKEY_LOCAL_MACHINE,rkey,Key,isInstalledByUs) then begin
    if isInstalledByUs = 'true' then begin
      if RegQueryStringValue(HKEY_LOCAL_MACHINE, rkey,'InstallDir', path) then  begin
        dirpath:=path+'\'+Name;
        Result:=DirExists(dirpath);
      end;
    end;
  end;
end;

//Deinstall functions
procedure DeinstallFeature(fkey:String);
var
  ResultCode: Integer;
begin
    Exec('msiexec.exe', '/x '+fkey+' /qb', '', SW_SHOW,
     ewWaitUntilTerminated, ResultCode)
    Log('Deinstall for '+fkey+' ended with '+IntToStr(ResultCode));
end;

function InitializeUninstall(): Boolean;
begin
  Result:=true;
  uninstallPython:=checkFeature(ExpandConstant('{#PythonDir}'),ExpandConstant('{#KeyInstalledPython}'));
  uninstallGdal:=checkFeature(ExpandConstant('{#GdalDir}'),ExpandConstant('{#KeyInstalledGdal}'));
end;
//take the uninstall id from the properties of the MSI
//getmsiinfo.py library\python-2.7.10.msi "ProductCode"
//would be better to check for the python install dir...
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
  if CurUninstallStep = usPostUninstall then begin
    if uninstallPython then
    begin
      DeinstallFeature(ExpandConstant('{#PythonCode}'));
    end;
    if uninstallGdal then
    begin
      DeinstallFeature(ExpandConstant('{#GdalCode}'));
      DeinstallFeature(ExpandConstant('{#GdalPythonCode}'));
    end;
  end;
end;


Fixed patch for Office 2003

Fixed patch for Office 2003

#define ASSEMBLY_PATH ".\Selenium\bin\Release\Selenium.dll"
#define ASSEMBLY_VERSION GetFileVersion(ASSEMBLY_PATH)

#define AppName "Selenium"
#define AppID "{{0277FC34-FD1B-4616-BB19-1FDB7381B291}"
#define AppLongName "Selenium Basic"
#define AppPublisher "Florent BREHERET"
#define AppURL "https://github.com/florentbr/SeleniumBasic"
#define AppFolder "SeleniumBasic"
#define AppSetupFilename "SeleniumBasic-" + ASSEMBLY_VERSION

[Setup]

AppId={#AppID}
PrivilegesRequired=lowest
AppName={#AppLongName}
AppVersion={#ASSEMBLY_VERSION}
AppVerName={#AppLongName}
VersionInfoVersion={#ASSEMBLY_VERSION}
VersionInfoTextVersion={#ASSEMBLY_VERSION}
AppPublisher={#AppPublisher}
AppPublisherURL={#AppURL}
AppSupportURL={#AppURL}
AppUpdatesURL={#AppURL}
DisableDirPage=yes
DefaultDirName={localappdata}\{#AppFolder}
UsePreviousAppDir=yes
DefaultGroupName={#AppLongName}
DisableProgramGroupPage=yes
LicenseFile=.\LICENSE.txt
OutputDir="."
OutputBaseFilename={#AppSetupFilename}
;Compression=zip
Compression=lzma2
SolidCompression=yes
DirExistsWarning=no
ArchitecturesInstallIn64BitMode=x64

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

[CustomMessages]
MsgNETFrameworkNotInstalled=Microsoft .NET Framework 3.5 installation was Not detected.
MsgRegistryWriteFailure=Failed to register the library due to insufficient privileges.
MsgFileNotFound=File Not found: %1.
MsgCOMInvokeFailed=Installation failed. The installer was unable to call the registered library.

[Components]
Name: "pkg_core"; Description: ".Net core libraries"; Types: full compact custom; Flags: fixed;
Name: "pkg_doc"; Description: "Templates and examples"; Types: full compact custom;
Name: "pkg_cons"; Description: "Enhanced console runner for VBScript files"; Types: full compact custom;
Name: "pkg_ff"; Description: "WebDriver for Firefox"; Types: full custom;
Name: "pkg_cr"; Description: "WebDriver for Chrome"; Types: full custom;
Name: "pkg_op"; Description: "WebDriver for Opera"; Types: full custom;
Name: "pkg_ie"; Description: "WebDriver for Internet Explorer"; Types: full custom;
Name: "pkg_pjs"; Description: "WebDriver for PhantomJS (headless browser)"; Types: full custom;
Name: "pkg_ide"; Description: "SeleniumIDE plugin for Firefox"; Types: full custom;

[Files]
Source: "Selenium\bin\Release\Selenium.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: pkg_core;
Source: "Selenium\bin\Release\Selenium.pdb"; DestDir: "{app}"; Flags: ignoreversion; Components: pkg_core;
Source: "Selenium\bin\Release\Selenium32.tlb"; DestDir: "{app}"; Flags: ignoreversion; Components: pkg_core;
Source: "Selenium\bin\Release\Selenium64.tlb"; DestDir: "{app}"; Flags: ignoreversion; Components: pkg_core;

Source: "Selenium\bin\Help\Selenium.chm"; DestDir: "{app}"; Flags: ignoreversion; Components: pkg_core;

Source: "LICENSE.txt"; DestDir: "{app}"; Flags: ignoreversion overwritereadonly ; Attribs:readonly;
Source: "CHANGELOG.txt"; DestDir: "{app}"; Flags: ignoreversion overwritereadonly ; Attribs:readonly;

Source: "VbsConsole\bin\Release\vbsc.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: pkg_cons;

Source: "References\firefoxdriver.xpi"; DestDir: "{app}"; Flags: ignoreversion; Components: pkg_ff;
Source: "References\chromedriver.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: pkg_cr;
Source: "References\iedriver.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: pkg_ie;
Source: "References\operadriver.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: pkg_op;
Source: "References\phantomjs.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: pkg_pjs;

;Firefox extensions
Source: "FirefoxAddons\bin\extensions.xpi"; DestDir: "{app}"; Flags: ignoreversion; Components: pkg_ide;

Source: "Scripts\*.*" ; DestDir: "{app}\Scripts"; Flags: ignoreversion overwritereadonly; Attribs:readonly; Components: pkg_core;
Source: "Templates\*.*" ; DestDir: "{app}\Templates"; Flags: ignoreversion overwritereadonly; Attribs:readonly; Components: pkg_doc;
Source: "Examples\VBScript\*.vbs"; DestDir: "{app}\VBScript"; Flags: ignoreversion overwritereadonly; Attribs:readonly; Components: pkg_doc;
Source: "Examples\JavaScript\*.js"; DestDir: "{app}\JavaScript"; Flags: ignoreversion overwritereadonly; Attribs:readonly; Components: pkg_doc;
Source: "Examples\Excel\*.xlsm"; DestDir: "{app}\Excel"; Flags: ignoreversion overwritereadonly; Attribs:readonly; Components: pkg_doc;

;copy config file
Source: "References\exe.config" ; DestDir: "{sys}"; DestName: "wscript.exe.config"; Flags: ignoreversion uninsneveruninstall; Check: HasPrivileges;
Source: "References\exe.config" ; DestDir: "{sys}"; DestName: "cscript.exe.config"; Flags: ignoreversion uninsneveruninstall; Check: HasPrivileges;
Source: "References\exe.config" ; DestDir: "{syswow64}"; DestName: "wscript.exe.config"; Flags: ignoreversion uninsneveruninstall; Check: IsWin64 And HasPrivileges;
Source: "References\exe.config" ; DestDir: "{syswow64}"; DestName: "cscript.exe.config"; Flags: ignoreversion uninsneveruninstall; Check: IsWin64 And HasPrivileges;
Source: "References\exe.config" ; DestDir: "{code:GetAppFolder|excel.exe}"; DestName: "EXCEL.EXE.CONFIG"; Flags: ignoreversion uninsneveruninstall; Check: HasPrivileges And HasApp('excel.exe');
Source: "References\exe.config" ; DestDir: "{code:GetAppFolder|winword.exe}"; DestName: "WINWORD.EXE.CONFIG"; Flags: ignoreversion uninsneveruninstall; Check: HasPrivileges And HasApp('winword.exe');
Source: "References\exe.config" ; DestDir: "{code:GetAppFolder|msaccess.exe}"; DestName: "MSACCESS.EXE.CONFIG"; Flags: ignoreversion uninsneveruninstall; Check: HasPrivileges And HasApp('msaccess.exe');
Source: "References\exe.config" ; DestDir: "{code:GetAppFolder|outlook.exe}"; DestName: "OUTLOOK.EXE.CONFIG"; Flags: ignoreversion uninsneveruninstall; Check: HasPrivileges And HasApp('outlook.exe');

[Icons]
Name: "{group}\Project Home Page"; Filename: {#AppURL}; WorkingDir: "{app}";
Name: "{group}\Vbs Console"; Filename: "{app}\vbsc.exe"; WorkingDir: "{app}"; Components: pkg_cons;
Name: "{group}\Examples"; Filename: "{app}\Examples"; WorkingDir: "{app}";
Name: "{group}\Templates"; Filename: "{app}\Templates"; WorkingDir: "{app}";
Name: "{group}\RunCleaner"; Filename: "{app}\Scripts\RunCleaner.vbs"; WorkingDir: "{app}";
Name: "{group}\API documentation"; Filename: "{app}\Selenium.chm"; WorkingDir: "{app}";
Name: "{group}\ChangeLog"; Filename: "{app}\CHANGELOG.txt"; WorkingDir: "{app}";
Name: "{group}\Uninstall"; Filename: "{uninstallexe}"

Name: "{group}\Start Firefox"; Filename: "{app}\Scripts\StartFirefox.vbs"; WorkingDir: "{app}"; Components: pkg_ff;
Name: "{group}\Start Chrome"; Filename: "{app}\Scripts\StartChrome.vbs"; WorkingDir: "{app}"; Components: pkg_cr;
Name: "{group}\Start Chrome Debug"; Filename: "{app}\Scripts\StartChromeDebug.vbs"; WorkingDir: "{app}"; Components: pkg_cr;
Name: "{group}\Start IE"; Filename: "{app}\Scripts\StartInternetExplorer.vbs"; WorkingDir: "{app}"; Components: pkg_ie;
Name: "{group}\Start Opera"; Filename: "{app}\Scripts\StartOpera.vbs"; WorkingDir: "{app}"; Components: pkg_op;
Name: "{group}\Start PhantomJS"; Filename: "{app}\Scripts\StartPhantomJS.vbs"; WorkingDir: "{app}"; Components: pkg_pjs;

[Registry]

;Firefox plugins
;Root: HKCU; Subkey: "Software\Mozilla\Firefox\Extensions"; ValueName: "{{a6fd85ed-e919-4a43-a5af-8da18bda539f}"; ValueType: string; ValueData:"{app}\selenium-ide.xpi"; Flags: uninsdeletevalue; Components: pkg_ide;
;Root: HKCU; Subkey: "Software\Mozilla\Firefox\Extensions"; ValueName: "vbformatters@florent.breheret"; ValueType: string; ValueData:"{app}\vbformatters.xpi"; Flags: uninsdeletevalue; Components: pkg_ide;
;Root: HKCU; Subkey: "Software\Mozilla\Firefox\Extensions"; ValueName: "implicit-wait@florent.breheret"; ValueType: string; ValueData:"{app}\implicit-wait.xpi"; Flags: uninsdeletevalue; Components: pkg_ide;

;IE tweaks: Maintain a connection to the instance (for IE11)
Root: HKCU; Subkey: "SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE"; ValueName: "iexplore.exe"; ValueType: dword; ValueData: 0; Components: pkg_ie;

;IE tweaks: Restore default zoom level
Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\Zoom"; ValueName: "ZoomFactor"; Flags: dontcreatekey deletevalue; Components: pkg_ie;

;IE tweaks: Disable enhanced protected mode
Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\Main"; ValueName: "Isolation"; Flags: dontcreatekey deletevalue; Components: pkg_ie;
Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\Main"; ValueName: "Isolation64Bit";  Flags: dontcreatekey deletevalue; Check: IsWin64; Components: pkg_ie;

;IE tweaks: Disable autocomplete
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoComplete"; ValueName: "AutoSuggest"; ValueType: string; ValueData: "no"; Components: pkg_ie;
Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\Main"; ValueName: "Use FormSuggest"; ValueType: string; ValueData: "no"; Components: pkg_ie;
Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\Main"; ValueName: "FormSuggest Passwords"; ValueType: string; ValueData: "no"; Components: pkg_ie;
Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\Main"; ValueName: "FormSuggest PW Ask"; ValueType: string; ValueData: "no"; Components: pkg_ie;

;IE tweaks: Disable warn
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Internet Settings"; ValueName: "WarnonBadCertRecving"; ValueType: dword; ValueData: 0; Components: pkg_ie;
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Internet Settings"; ValueName: "WarnonZoneCrossing"; ValueType: dword; ValueData: 0; Components: pkg_ie;
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Internet Settings"; ValueName: "WarnOnPostRedirect"; ValueType: dword; ValueData: 0; Components: pkg_ie;

;IE tweaks: Disable Check for publisher's certificate revocation
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\WinTrust\Trust Providers\Software Publishing"; ValueName: "State"; ValueType: dword; ValueData: 146944; Components: pkg_ie;
;IE tweaks: Disable Check for server certificate revocation
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Internet Settings"; ValueName: "CertificateRevocation"; ValueType: dword; ValueData: 0; Components: pkg_ie;
;IE tweaks: Disable Check for signatures on downloaded programs
Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\Download"; ValueName: "CheckExeSignatures"; ValueType: string; ValueData: "no"; Components: pkg_ie;

;IE tweaks: Disable Check default browser
Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\Main"; ValueName: "Check_Associations"; ValueType: string; ValueData: "no"; Components: pkg_ie;

;IE tweaks: Disable accelerator button
Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\Activities"; ValueName: "NoActivities"; ValueType: dword; ValueData: 1; Components: pkg_ie;

;IE tweaks: Disable protected mode for all zones  Disable=3 Enable=0
Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\Main"; ValueName: "NoProtectedModeBanner"; ValueType: dword; ValueData: 1; Components: pkg_ie;
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\0"; ValueName: "2500"; ValueType: dword; ValueData: 3; Components: pkg_ie;
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\1"; ValueName: "2500"; ValueType: dword; ValueData: 3; Components: pkg_ie;
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\2"; ValueName: "2500"; ValueType: dword; ValueData: 3; Components: pkg_ie;
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3"; ValueName: "2500"; ValueType: dword; ValueData: 3; Components: pkg_ie;
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\4"; ValueName: "2500"; ValueType: dword; ValueData: 3; Components: pkg_ie;

;IE tweaks: Enable all cookies
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Internet Settings"; ValueName: "PrivacyAdvanced"; ValueType: dword; ValueData: 1; Components: pkg_ie;
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3"; ValueName: "1A10"; ValueType: dword; ValueData: 1; Components: pkg_ie;

;IE tweak: Allow HTTP Basic Authentication in url
Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_HTTP_USERNAME_PASSWORD_DISABLE"; ValueName: "iexplore.exe"; ValueType: dword; ValueData: 0; Components: pkg_ie;

;IE tweak: Turn off popup blocker
Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\New Windows"; ValueName: "PopupMgr"; ValueType: dword; ValueData: 0; Components: pkg_ie;

;IE tweak: Delete browsing history on exit
Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\Privacy"; ValueName: "ClearBrowsingHistoryOnExit"; ValueType: dword; ValueData: 1; Components: pkg_ie;

;File association for the console
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\App Paths\vbsc.exe"; ValueType: string; ValueData: "{app}\vbsc.exe"; Flags: deletekey uninsdeletekey; Components: pkg_cons;

Root: HKCU; Subkey: "Software\Classes\VBSFile\Shell\Debug"; ValueType: string; ValueData: "Debug"; Flags: deletekey uninsdeletekey;
Root: HKCU; Subkey: "Software\Classes\VBSFile\Shell\Debug\Command"; ValueType: expandsz; ValueData: """%SystemRoot%\System32\wscript.exe"" //D //X ""%1"" %*"; Components: pkg_cons;

Root: HKCU; Subkey: "Software\Classes\VBSFile\shell\runas"; ValueType: string; ValueName: "HasLUAShield"; ValueData: ""; Flags: deletekey uninsdeletekey;
Root: HKCU; Subkey: "Software\Classes\VBSFile\shell\runas\Command"; ValueType: expandsz; ValueData: """%SystemRoot%\System32\wscript.exe"" ""%1"" %*";

Root: HKCU; Subkey: "Software\Classes\VBSFile\Shell\RunExt"; ValueType: string; ValueData: "Run VBScript"; Flags: deletekey uninsdeletekey; Components: pkg_cons;
Root: HKCU; Subkey: "Software\Classes\VBSFile\Shell\RunExt\Command"; ValueType: string; ValueData: """{app}\vbsc.exe"" -i ""%1"" %*"; Components: pkg_cons;

Root: HKCU; Subkey: "Software\Classes\Directory\shell\RunExt"; ValueType: string; ValueData: "Run VBScripts"; Flags: deletekey uninsdeletekey; Components: pkg_cons;
Root: HKCU; Subkey: "Software\Classes\Directory\shell\RunExt\Command"; ValueType: string; ValueData: """{app}\vbsc.exe"" -i ""%1\*.vbs"""; Components: pkg_cons;

;Add excel trusted location for templates and examples
Root: HKCU; Subkey: "Software\Microsoft\Office\{code:GetOfficeVersion|Excel}.0\Excel\Security\Trusted Locations\Selenium1"; ValueName: "Path"; ValueType: String; ValueData: "{app}\Templates"; Flags: uninsdeletekey; Check: HasExcel;
Root: HKCU; Subkey: "Software\Microsoft\Office\{code:GetOfficeVersion|Excel}.0\Excel\Security\Trusted Locations\Selenium2"; ValueName: "Path"; ValueType: String; ValueData: "{app}\Examples"; Flags: uninsdeletekey; Check: HasExcel;
Root: HKCU; Subkey: "Software\Microsoft\Office\{code:GetOfficeVersion|Word}.0\Word\Security\Trusted Locations\Selenium1"; ValueName: "Path"; ValueType: String; ValueData: "{app}\Templates"; Flags: uninsdeletekey; Check: HasWord;
Root: HKCU; Subkey: "Software\Microsoft\Office\{code:GetOfficeVersion|Word}.0\Word\Security\Trusted Locations\Selenium2"; ValueName: "Path"; ValueType: String; ValueData: "{app}\Examples"; Flags: uninsdeletekey; Check: HasWord;

;Enable WScript host in case it's been disabled
Root: HKCU; Subkey: "Software\Microsoft\Windows Script Host\Settings"; ValueName: "Enabled"; ValueType: dword; ValueData: 1;

[Run]
;Filename: "{app}\RegNet.exe"; Parameters: "-r"; WorkingDir: {app}; Flags: waituntilterminated runascurrentuser runhidden; StatusMsg: "Register for COM interoperability";
Filename: "{code:GetAppPath|firefox.exe}"; Parameters: "-url ""{app}\extensions.xpi"""; WorkingDir: {app}; Flags: shellexec postinstall skipifsilent runascurrentuser; Components: pkg_ide; Check: HasFirefox; Description: "Install the Selenium IDE Addon for Firefox";

[UninstallRun]
;Filename: "{app}\RegNet.exe"; Parameters: "-u"; WorkingDir: {app}; Flags: waituntilterminated runascurrentuser runhidden; StatusMsg: "Unregister for COM interoperability";

[InstallDelete]
Type: filesandordirs; Name: "{localappdata}\Temp\Selenium"

[UninstallDelete]
Type: filesandordirs; Name: "{app}"
Type: filesandordirs; Name: "{localappdata}\Temp\Selenium"

[Code]

Function HasPrivileges(): Boolean;
  Begin
    Result := IsAdminLoggedOn Or IsPowerUserLoggedOn
  End;

Function GetAppPath(app: String): string;
  Begin
    RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\' + app, '', Result);
  End;

Function HasFirefox(): Boolean;
  Begin
    Result := FileExists(GetAppPath('firefox.exe'));
  End;

Function GetAppFolder(app: String): string;
  Begin
    Result := ExtractFileDir(GetAppPath(app));
  End;

Function HasApp(app: String): Boolean;
  Begin
    Result := GetAppPath(app) <> '';
  End;

Function GetOfficeVersion(app: String): String;
  Var ver: String; i: Integer;
  Begin
    If RegQueryStringValue(HKCR, app + '.Application\CurVer', '', ver) Then Begin
      For i := 1 To Length(ver) Do Begin
        If (ver[i] >= '0') And (ver[i] <= '9') Then
          Result := Result + ver[i];
      End;
    End;
  End;

Function HasExcel(): Boolean;
  Begin
    Result := RegKeyExists(HKCR, 'Excel.Application');
  End;

Function HasWord(): Boolean;
  Begin
    Result := RegKeyExists(HKCR, 'Word.Application');
  End;

Procedure _PatchOfficeFileVersion(Const subkey: String);
  Var name, value: String;
  Begin
    name := 'Maximum File Version Number';
    If RegQueryStringValue(HKLM, subkey, name, value) Then Begin
        RegWriteStringValue(HKLM, subkey, 'Maximum File Version', value);
        RegDeleteValue(HKLM, subkey, name);
    End
  End;

Procedure PatchOfficeFileVersion();
  Begin
    If Not HasPrivileges() Then Exit;
    //Excel 11
    _PatchOfficeFileVersion('SOFTWARE\Microsoft\.NETFramework\Policy\AppPatch\v4.0.30319.00000\excel.exe\{2CCAA9FE-6884-4AF2-99DD-5217B94115DF}');
    _PatchOfficeFileVersion('SOFTWARE\Microsoft\.NETFramework\Policy\AppPatch\v2.0.50727.00000\excel.exe\{2CCAA9FE-6884-4AF2-99DD-5217B94115DF}');
    //Word 11
    _PatchOfficeFileVersion('SOFTWARE\Microsoft\.NETFramework\Policy\AppPatch\v4.0.30319.00000\winword.exe\{2CCAA9FE-6884-4AF2-99DD-5217B94115DF}');
    _PatchOfficeFileVersion('SOFTWARE\Microsoft\.NETFramework\Policy\AppPatch\v2.0.50727.00000\winword.exe\{2CCAA9FE-6884-4AF2-99DD-5217B94115DF}');
  End;

Procedure AssertFrameworkPresent(Const version: String);
  Begin
    If Not RegKeyExists(HKLM,'SOFTWARE\Microsoft\NET Framework Setup\NDP\v' + version) Then
        RaiseException(ExpandConstant('{cm:MsgNETFrameworkNotInstalled}'));
  End;

Procedure AssertFilePresent(Const path: String);
  Begin
      If Not FileExists(path) Then
          RaiseException(ExpandConstant('{cm:MsgFileNotFound,' + path +'}'));
  End;

Function UninstallPrevious(const appid: String): Boolean;
  Var key, name, out_cmd: String; retcode: Integer;
  Begin
    key := 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' + ExpandConstant(appid) + '_is1';
    name := 'UninstallString';
    If Not RegQueryStringValue(HKCU, key, name, out_cmd) Then
      If Not RegQueryStringValue(HKLM, key, name, out_cmd) Then
         If Not RegQueryStringValue(HKCU32, key, name, out_cmd) Then
            RegQueryStringValue(HKLM32, key, name, out_cmd);
    If out_cmd <> '' Then
        Exec(RemoveQuotes(out_cmd), '/SILENT /NORESTART /SUPPRESSMSGBOXES', '', SW_SHOW, ewWaitUntilTerminated, retcode);
    Result := retcode = 0;
  End;

//---------------------------------------------------------------------------------------
// Registration
//---------------------------------------------------------------------------------------

type
  TNetLib = record
    Guid: String;
    FullName: String;
    Description: String;
    TypeVersion: String;
    Directory: String;
    PathDll: String;
    PathTlb32: String;
    PathTlb64: String;
    Runtime: String;
  end;

Procedure RegString(Const root: Integer; Const subkey, name, value: String);
  Begin
      Log('reg [' + subkey + '] "' + name + '"="' + value + '"');
      If Not RegWriteStringValue(root, subkey, name, value) Then
         RaiseException(ExpandConstant('{cm:MsgRegistryWriteFailure}'));
  End;

// Interface registration (32/64bits Independent) :
//
// HKCU\Software\Classes\Interface\{ interface guid }
//   ""=" interface name "
//   \ProxyStubClsid32
//     ""=" interface short name "
//   \TypeLib
//     ""="{ assembly guid }"
//   \Version
//     ""=" assembly type version "
//
Procedure RegInterface_(Const lib : TNetLib; Const root: Integer; Const guid, typename, proxyStub: String);
  Var key: String;
  Begin
    key := 'Software\Classes\Interface\' + guid;
    RegDeleteKeyIncludingSubkeys(root, key);
    If Not IsUninstaller Then Begin
      RegString(root, key                        , ''         , typename         );
      RegString(root, key + '\ProxyStubClsid32'  , ''         , proxyStub        );
      RegString(root, key + '\TypeLib'           , ''         , lib.Guid         );
      RegString(root, key + '\TypeLib'           , 'Version'  , lib.TypeVersion  );
    End
  End;

Procedure RegInterface(Const lib : TNetLib; Const guid, name, proxystub: String);
  Begin
    RegInterface_(lib, HKCU, guid, name, proxystub);
    If IsWin64 Then
      RegInterface_(lib, HKCU32, guid, name, proxystub);
  End;

// Enumeration registration (32/64bits Shared) :
//
// HKCU\Software\Classes\Record\{ record guid }]
//   ""="mscoree.dll"
//   "Class"="Selenium.Structures.Point"
//   "Assembly"="Selenium, Version=2.0.1.2, Culture=neutral, PublicKeyToken=null"
//   "RuntimeVersion"="v2.0.50727"
//   "CodeBase"="C:\...\SeleniumBasic\Selenium.dll"
//
Procedure RegRecord(Const lib : TNetLib; Const guid, typename: String);
  Var key: String;
  Begin
    key := 'Software\Classes\Record\' + guid;
    RegDeleteKeyIncludingSubkeys(HKCU, key);
    If Not IsUninstaller Then Begin
      RegString(HKCU, key, 'Class'           , typename     );
      RegString(HKCU, key, 'Assembly'        , lib.FullName );
      RegString(HKCU, key, 'RuntimeVersion'  , lib.Runtime  );
      RegString(HKCU, key, 'CodeBase'        , lib.PathDll  );
    End
  End;

// CLSID registration (32/64bits Independent) :
//
// Root\Software\Classes\CLSID\{ class guid }
//   ""="Selenium.WebDriver"
//   \InprocServer32
//     ""="C:\Windows\System32\mscoree.dll"
//     "Class"="Selenium.WebDriver"
//     "Assembly"="Selenium, Version=2.0.1.2, Culture=neutral, PublicKeyToken=null"
//     "RuntimeVersion"="v2.0.50727"
//     "CodeBase"="C:\...\SeleniumBasic\Selenium.dll"
//     "ThreadingModel"="Both"
//   \Implemented Categories\{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}
//     ""=""
//   \ProgId
//     ""="Selenium.WebDriver"
//   \VersionIndependentProgID
//     ""="Selenium.WebDriver"
//
Procedure RegClsid(Const lib : TNetLib; Const root: Integer; Const guid, progid, typename, sysdir: String);
  Var key, skey : String;
  Begin
    key := 'Software\Classes\CLSID\' + guid;
    RegDeleteKeyIncludingSubkeys(root, key);
    If Not IsUninstaller Then Begin
      RegString(root, key, '', typename);

      skey := key + '\InprocServer32';
      RegString(root, skey, ''               , ExpandConstant(sysdir) + '\mscoree.dll' );
      RegString(root, skey, 'Class'          , typename     );
      RegString(root, skey, 'Assembly'       , lib.FullName );
      RegString(root, skey, 'RuntimeVersion' , lib.Runtime  );
      RegString(root, skey, 'CodeBase'       , lib.PathDll  );
      RegString(root, skey, 'ThreadingModel' , 'Both'       );

      skey := key + '\Implemented Categories\{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}';
      RegString(root, skey, '', '');

      skey := key + '\ProgId';
      RegString(root, skey, '', progid);

      skey := key + '\VersionIndependentProgID';
      RegString(root, skey, '', progid);
    End
  End;

// Class registration (32/64bits Shared) :
//
// HKCU\Software\Classes\[progid]
//   ""=[progid]
//   \CLSID
//     ""=[class guid]
//
Procedure RegClass(Const lib : TNetLib; Const guid, progid, typename: String);
  Var key, sysdir: String;
  Begin
    key := 'Software\Classes\' + progid;
    RegDeleteKeyIncludingSubkeys(HKCU, key);
    If Not IsUninstaller Then Begin
      RegString(HKCU, key, '', progid);
      RegString(HKCU, key + '\CLSID', '', guid);
    End

    RegClsid(lib, HKCU, guid, progid, typename, '{sys}');
    If IsWin64 Then
      RegClsid(lib, HKCU32, guid, progid, typename, '{syswow64}');
  End;

// TypeLib registration (32/64bits Shared) :
//
// HKCU\Software\Classes\TypeLib\[assembly guid]
//   \2.0
//     ""="App Type Library"
//     \0\win32
//       ""="C:\...\App32.tlb"
//     \0\win64
//       ""="C:\...\App64.tlb"
//     \FLAGS
//       ""="0"
//     \HELPDIR
//       ""="C:\..."
//
Procedure RegTypeLib(Const lib : TNetLib);
  Var key, skey : String;
  Begin
    key := 'Software\Classes\TypeLib\' + lib.Guid;
    RegDeleteKeyIncludingSubkeys(HKCU, key);
    If Not IsUninstaller Then Begin
      skey := key + '\' + lib.TypeVersion;
      RegString(HKCU, skey, '', lib.Description);
      RegString(HKCU, skey + '\FLAGS'   , ''  , '0'           );
      RegString(HKCU, skey + '\HELPDIR' , ''  , lib.Directory );
      RegString(HKCU, skey + '\0\win32' , ''  , lib.PathTlb32 );
      If IsWin64 Then
        RegString(HKCU, skey + '\0\win64', '' , lib.PathTlb64 );
    End
  End;

Procedure RegisterAssembly();
  Var lib : TNetLib;
  Begin
    { Includes the file generated by gen-registration.ipy }
    #include 'SeleniumBasicSetup.pas'
  End;

//---------------------------------------------------------------------------------------
// Workflow
//---------------------------------------------------------------------------------------

Function InitializeSetup() : Boolean;
  Begin
      AssertFrameworkPresent('3.5');
      Result := True;
  End;

Procedure CurStepChanged(CurStep: TSetupStep);
  Begin
    If CurStep = ssInstall Then Begin
      UninstallPrevious('SeleniumWrapper');
      UninstallPrevious('{#AppId}');
    End Else If CurStep = ssPostInstall Then Begin
      RegisterAssembly();
      PatchOfficeFileVersion();
    End;
  End;

Procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
  Begin
    If CurUninstallStep = usUninstall  Then Begin
      RegisterAssembly(); //Only deletes the main keys
    End;
  End;

#define ASSEMBLY_PATH ".\Selenium\bin\Release\Selenium.dll"
#define ASSEMBLY_VERSION GetFileVersion(ASSEMBLY_PATH)

#define AppName "Selenium"
#define AppID "{{0277FC34-FD1B-4616-BB19-1FDB7381B291}"
#define AppLongName "Selenium Basic"
#define AppPublisher "Florent BREHERET"
#define AppURL "https://github.com/florentbr/SeleniumBasic"
#define AppFolder "SeleniumBasic"
#define AppSetupFilename "SeleniumBasic-" + ASSEMBLY_VERSION

[Setup]

AppId={#AppID}
PrivilegesRequired=lowest
AppName={#AppLongName}
AppVersion={#ASSEMBLY_VERSION}
AppVerName={#AppLongName}
VersionInfoVersion={#ASSEMBLY_VERSION}
VersionInfoTextVersion={#ASSEMBLY_VERSION}
AppPublisher={#AppPublisher}
AppPublisherURL={#AppURL}
AppSupportURL={#AppURL}
AppUpdatesURL={#AppURL}
DisableDirPage=yes
DefaultDirName={localappdata}\{#AppFolder}
UsePreviousAppDir=yes
DefaultGroupName={#AppLongName}
DisableProgramGroupPage=yes
LicenseFile=.\LICENSE.txt
OutputDir="."
OutputBaseFilename={#AppSetupFilename}
;Compression=zip
Compression=lzma2
SolidCompression=yes
DirExistsWarning=no
ArchitecturesInstallIn64BitMode=x64

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

[CustomMessages]
MsgNETFrameworkNotInstalled=Microsoft .NET Framework 3.5 installation was Not detected.
MsgRegistryWriteFailure=Failed to register the library due to insufficient privileges.
MsgFileNotFound=File Not found: %1.
MsgCOMInvokeFailed=Installation failed. The installer was unable to call the registered library.

[Components]
Name: "pkg_core"; Description: ".Net core libraries"; Types: full compact custom; Flags: fixed;
Name: "pkg_doc"; Description: "Templates and examples"; Types: full compact custom;
Name: "pkg_cons"; Description: "Enhanced console runner for VBScript files"; Types: full compact custom;
Name: "pkg_ff"; Description: "WebDriver for Firefox"; Types: full custom;
Name: "pkg_cr"; Description: "WebDriver for Chrome"; Types: full custom;
Name: "pkg_op"; Description: "WebDriver for Opera"; Types: full custom;
Name: "pkg_ie"; Description: "WebDriver for Internet Explorer"; Types: full custom;
Name: "pkg_pjs"; Description: "WebDriver for PhantomJS (headless browser)"; Types: full custom;
Name: "pkg_ide"; Description: "SeleniumIDE plugin for Firefox"; Types: full custom;

[Files]
Source: "Selenium\bin\Release\Selenium.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: pkg_core;
Source: "Selenium\bin\Release\Selenium.pdb"; DestDir: "{app}"; Flags: ignoreversion; Components: pkg_core;
Source: "Selenium\bin\Release\Selenium32.tlb"; DestDir: "{app}"; Flags: ignoreversion; Components: pkg_core;
Source: "Selenium\bin\Release\Selenium64.tlb"; DestDir: "{app}"; Flags: ignoreversion; Components: pkg_core;

Source: "Selenium\bin\Help\Selenium.chm"; DestDir: "{app}"; Flags: ignoreversion; Components: pkg_core;

Source: "LICENSE.txt"; DestDir: "{app}"; Flags: ignoreversion overwritereadonly ; Attribs:readonly;
Source: "CHANGELOG.txt"; DestDir: "{app}"; Flags: ignoreversion overwritereadonly ; Attribs:readonly;

Source: "VbsConsole\bin\Release\vbsc.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: pkg_cons;

Source: "References\firefoxdriver.xpi"; DestDir: "{app}"; Flags: ignoreversion; Components: pkg_ff;
Source: "References\chromedriver.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: pkg_cr;
Source: "References\iedriver.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: pkg_ie;
Source: "References\operadriver.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: pkg_op;
Source: "References\phantomjs.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: pkg_pjs;

;Firefox extensions
Source: "FirefoxAddons\bin\extensions.xpi"; DestDir: "{app}"; Flags: ignoreversion; Components: pkg_ide;

Source: "Scripts\*.*" ; DestDir: "{app}\Scripts"; Flags: ignoreversion overwritereadonly; Attribs:readonly; Components: pkg_core;
Source: "Templates\*.*" ; DestDir: "{app}\Templates"; Flags: ignoreversion overwritereadonly; Attribs:readonly; Components: pkg_doc;
Source: "Examples\VBScript\*.vbs"; DestDir: "{app}\VBScript"; Flags: ignoreversion overwritereadonly; Attribs:readonly; Components: pkg_doc;
Source: "Examples\JavaScript\*.js"; DestDir: "{app}\JavaScript"; Flags: ignoreversion overwritereadonly; Attribs:readonly; Components: pkg_doc;
Source: "Examples\Excel\*.xlsm"; DestDir: "{app}\Excel"; Flags: ignoreversion overwritereadonly; Attribs:readonly; Components: pkg_doc;

;copy config file
Source: "References\exe.config" ; DestDir: "{sys}"; DestName: "wscript.exe.config"; Flags: ignoreversion uninsneveruninstall; Check: HasPrivileges;
Source: "References\exe.config" ; DestDir: "{sys}"; DestName: "cscript.exe.config"; Flags: ignoreversion uninsneveruninstall; Check: HasPrivileges;
Source: "References\exe.config" ; DestDir: "{syswow64}"; DestName: "wscript.exe.config"; Flags: ignoreversion uninsneveruninstall; Check: IsWin64 And HasPrivileges;
Source: "References\exe.config" ; DestDir: "{syswow64}"; DestName: "cscript.exe.config"; Flags: ignoreversion uninsneveruninstall; Check: IsWin64 And HasPrivileges;
Source: "References\exe.config" ; DestDir: "{code:GetAppFolder|excel.exe}"; DestName: "EXCEL.EXE.CONFIG"; Flags: ignoreversion uninsneveruninstall; Check: HasPrivileges And HasApp('excel.exe');
Source: "References\exe.config" ; DestDir: "{code:GetAppFolder|winword.exe}"; DestName: "WINWORD.EXE.CONFIG"; Flags: ignoreversion uninsneveruninstall; Check: HasPrivileges And HasApp('winword.exe');
Source: "References\exe.config" ; DestDir: "{code:GetAppFolder|msaccess.exe}"; DestName: "MSACCESS.EXE.CONFIG"; Flags: ignoreversion uninsneveruninstall; Check: HasPrivileges And HasApp('msaccess.exe');
Source: "References\exe.config" ; DestDir: "{code:GetAppFolder|outlook.exe}"; DestName: "OUTLOOK.EXE.CONFIG"; Flags: ignoreversion uninsneveruninstall; Check: HasPrivileges And HasApp('outlook.exe');

[Icons]
Name: "{group}\Project Home Page"; Filename: {#AppURL}; WorkingDir: "{app}";
Name: "{group}\Vbs Console"; Filename: "{app}\vbsc.exe"; WorkingDir: "{app}"; Components: pkg_cons;
Name: "{group}\Examples"; Filename: "{app}\Examples"; WorkingDir: "{app}";
Name: "{group}\Templates"; Filename: "{app}\Templates"; WorkingDir: "{app}";
Name: "{group}\RunCleaner"; Filename: "{app}\Scripts\RunCleaner.vbs"; WorkingDir: "{app}";
Name: "{group}\API documentation"; Filename: "{app}\Selenium.chm"; WorkingDir: "{app}";
Name: "{group}\ChangeLog"; Filename: "{app}\CHANGELOG.txt"; WorkingDir: "{app}";
Name: "{group}\Uninstall"; Filename: "{uninstallexe}"

Name: "{group}\Start Firefox"; Filename: "{app}\Scripts\StartFirefox.vbs"; WorkingDir: "{app}"; Components: pkg_ff;
Name: "{group}\Start Chrome"; Filename: "{app}\Scripts\StartChrome.vbs"; WorkingDir: "{app}"; Components: pkg_cr;
Name: "{group}\Start Chrome Debug"; Filename: "{app}\Scripts\StartChromeDebug.vbs"; WorkingDir: "{app}"; Components: pkg_cr;
Name: "{group}\Start IE"; Filename: "{app}\Scripts\StartInternetExplorer.vbs"; WorkingDir: "{app}"; Components: pkg_ie;
Name: "{group}\Start Opera"; Filename: "{app}\Scripts\StartOpera.vbs"; WorkingDir: "{app}"; Components: pkg_op;
Name: "{group}\Start PhantomJS"; Filename: "{app}\Scripts\StartPhantomJS.vbs"; WorkingDir: "{app}"; Components: pkg_pjs;

[Registry]

;Firefox plugins
;Root: HKCU; Subkey: "Software\Mozilla\Firefox\Extensions"; ValueName: "{{a6fd85ed-e919-4a43-a5af-8da18bda539f}"; ValueType: string; ValueData:"{app}\selenium-ide.xpi"; Flags: uninsdeletevalue; Components: pkg_ide;
;Root: HKCU; Subkey: "Software\Mozilla\Firefox\Extensions"; ValueName: "vbformatters@florent.breheret"; ValueType: string; ValueData:"{app}\vbformatters.xpi"; Flags: uninsdeletevalue; Components: pkg_ide;
;Root: HKCU; Subkey: "Software\Mozilla\Firefox\Extensions"; ValueName: "implicit-wait@florent.breheret"; ValueType: string; ValueData:"{app}\implicit-wait.xpi"; Flags: uninsdeletevalue; Components: pkg_ide;
;Fix for KB948461 https://support.microsoft.com/en-us/kb/948461
Root: HKCR; Subkey: "Interface\{{000C0601-0000-0000-C000-000000000046}"; ValueType: string; ValueName: "";  ValueData: "Office .NET Framework Lockback Bypass Key"; Check: HasPrivileges And HasExcel2003orInf;

;Fix for KB907417 > delete key or add exe.config
Root: HKLM; Subkey: "SOFTWARE\Microsoft\.NETFramework\Policy\AppPatch\v2.0.50727.00000\excel.exe"; Flags: deletekey noerror; Check: HasPrivileges And HasExcel2003orInf;
Root: HKLM32; Subkey: "SOFTWARE\Microsoft\.NETFramework\Policy\AppPatch\v2.0.50727.00000\excel.exe"; Flags: deletekey noerror; Check: HasPrivileges And HasExcel2003orInf;

;IE tweaks: Maintain a connection to the instance (for IE11)
Root: HKCU; Subkey: "SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE"; ValueName: "iexplore.exe"; ValueType: dword; ValueData: 0; Components: pkg_ie;

;IE tweaks: Restore default zoom level
Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\Zoom"; ValueName: "ZoomFactor"; Flags: dontcreatekey deletevalue; Components: pkg_ie;

;IE tweaks: Disable enhanced protected mode
Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\Main"; ValueName: "Isolation"; Flags: dontcreatekey deletevalue; Components: pkg_ie;
Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\Main"; ValueName: "Isolation64Bit";  Flags: dontcreatekey deletevalue; Check: IsWin64; Components: pkg_ie;

;IE tweaks: Disable autocomplete
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoComplete"; ValueName: "AutoSuggest"; ValueType: string; ValueData: "no"; Components: pkg_ie;
Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\Main"; ValueName: "Use FormSuggest"; ValueType: string; ValueData: "no"; Components: pkg_ie;
Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\Main"; ValueName: "FormSuggest Passwords"; ValueType: string; ValueData: "no"; Components: pkg_ie;
Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\Main"; ValueName: "FormSuggest PW Ask"; ValueType: string; ValueData: "no"; Components: pkg_ie;

;IE tweaks: Disable warn
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Internet Settings"; ValueName: "WarnonBadCertRecving"; ValueType: dword; ValueData: 0; Components: pkg_ie;
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Internet Settings"; ValueName: "WarnonZoneCrossing"; ValueType: dword; ValueData: 0; Components: pkg_ie;
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Internet Settings"; ValueName: "WarnOnPostRedirect"; ValueType: dword; ValueData: 0; Components: pkg_ie;

;IE tweaks: Disable Check for publisher's certificate revocation
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\WinTrust\Trust Providers\Software Publishing"; ValueName: "State"; ValueType: dword; ValueData: 146944; Components: pkg_ie;
;IE tweaks: Disable Check for server certificate revocation
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Internet Settings"; ValueName: "CertificateRevocation"; ValueType: dword; ValueData: 0; Components: pkg_ie;
;IE tweaks: Disable Check for signatures on downloaded programs
Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\Download"; ValueName: "CheckExeSignatures"; ValueType: string; ValueData: "no"; Components: pkg_ie;

;IE tweaks: Disable Check default browser
Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\Main"; ValueName: "Check_Associations"; ValueType: string; ValueData: "no"; Components: pkg_ie;

;IE tweaks: Disable accelerator button
Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\Activities"; ValueName: "NoActivities"; ValueType: dword; ValueData: 1; Components: pkg_ie;

;IE tweaks: Disable protected mode for all zones  Disable=3 Enable=0
Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\Main"; ValueName: "NoProtectedModeBanner"; ValueType: dword; ValueData: 1; Components: pkg_ie;
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\0"; ValueName: "2500"; ValueType: dword; ValueData: 3; Components: pkg_ie;
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\1"; ValueName: "2500"; ValueType: dword; ValueData: 3; Components: pkg_ie;
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\2"; ValueName: "2500"; ValueType: dword; ValueData: 3; Components: pkg_ie;
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3"; ValueName: "2500"; ValueType: dword; ValueData: 3; Components: pkg_ie;
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\4"; ValueName: "2500"; ValueType: dword; ValueData: 3; Components: pkg_ie;

;IE tweaks: Enable all cookies
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Internet Settings"; ValueName: "PrivacyAdvanced"; ValueType: dword; ValueData: 1; Components: pkg_ie;
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3"; ValueName: "1A10"; ValueType: dword; ValueData: 1; Components: pkg_ie;

;IE tweak: Allow HTTP Basic Authentication in url
Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_HTTP_USERNAME_PASSWORD_DISABLE"; ValueName: "iexplore.exe"; ValueType: dword; ValueData: 0; Components: pkg_ie;

;IE tweak: Turn off popup blocker
Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\New Windows"; ValueName: "PopupMgr"; ValueType: dword; ValueData: 0; Components: pkg_ie;

;IE tweak: Delete browsing history on exit
Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\Privacy"; ValueName: "ClearBrowsingHistoryOnExit"; ValueType: dword; ValueData: 1; Components: pkg_ie;

;File association for the console
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\App Paths\vbsc.exe"; ValueType: string; ValueData: "{app}\vbsc.exe"; Flags: deletekey uninsdeletekey; Components: pkg_cons;

Root: HKCU; Subkey: "Software\Classes\VBSFile\Shell\Debug"; ValueType: string; ValueData: "Debug"; Flags: deletekey uninsdeletekey;
Root: HKCU; Subkey: "Software\Classes\VBSFile\Shell\Debug\Command"; ValueType: expandsz; ValueData: """%SystemRoot%\System32\wscript.exe"" //D //X ""%1"" %*"; Components: pkg_cons;

Root: HKCU; Subkey: "Software\Classes\VBSFile\shell\runas"; ValueType: string; ValueName: "HasLUAShield"; ValueData: ""; Flags: deletekey uninsdeletekey;
Root: HKCU; Subkey: "Software\Classes\VBSFile\shell\runas\Command"; ValueType: expandsz; ValueData: """%SystemRoot%\System32\wscript.exe"" ""%1"" %*";

Root: HKCU; Subkey: "Software\Classes\VBSFile\Shell\RunExt"; ValueType: string; ValueData: "Run VBScript"; Flags: deletekey uninsdeletekey; Components: pkg_cons;
Root: HKCU; Subkey: "Software\Classes\VBSFile\Shell\RunExt\Command"; ValueType: string; ValueData: """{app}\vbsc.exe"" -i ""%1"" %*"; Components: pkg_cons;

Root: HKCU; Subkey: "Software\Classes\Directory\shell\RunExt"; ValueType: string; ValueData: "Run VBScripts"; Flags: deletekey uninsdeletekey; Components: pkg_cons;
Root: HKCU; Subkey: "Software\Classes\Directory\shell\RunExt\Command"; ValueType: string; ValueData: """{app}\vbsc.exe"" -i ""%1\*.vbs"""; Components: pkg_cons;

;Add excel trusted location for templates and examples
Root: HKCU; Subkey: "Software\Microsoft\Office\{code:GetOfficeVersion|Excel}.0\Excel\Security\Trusted Locations\Selenium1"; ValueName: "Path"; ValueType: String; ValueData: "{app}\Templates"; Flags: uninsdeletekey; Check: HasExcel;
Root: HKCU; Subkey: "Software\Microsoft\Office\{code:GetOfficeVersion|Excel}.0\Excel\Security\Trusted Locations\Selenium2"; ValueName: "Path"; ValueType: String; ValueData: "{app}\Examples"; Flags: uninsdeletekey; Check: HasExcel;
Root: HKCU; Subkey: "Software\Microsoft\Office\{code:GetOfficeVersion|Word}.0\Word\Security\Trusted Locations\Selenium1"; ValueName: "Path"; ValueType: String; ValueData: "{app}\Templates"; Flags: uninsdeletekey; Check: HasWord;
Root: HKCU; Subkey: "Software\Microsoft\Office\{code:GetOfficeVersion|Word}.0\Word\Security\Trusted Locations\Selenium2"; ValueName: "Path"; ValueType: String; ValueData: "{app}\Examples"; Flags: uninsdeletekey; Check: HasWord;

;Enable WScript host in case it's been disabled
Root: HKCU; Subkey: "Software\Microsoft\Windows Script Host\Settings"; ValueName: "Enabled"; ValueType: dword; ValueData: 1;

[Run]
;Filename: "{app}\RegNet.exe"; Parameters: "-r"; WorkingDir: {app}; Flags: waituntilterminated runascurrentuser runhidden; StatusMsg: "Register for COM interoperability";
Filename: "{code:GetAppPath|firefox.exe}"; Parameters: "-url ""{app}\extensions.xpi"""; WorkingDir: {app}; Flags: shellexec postinstall skipifsilent runascurrentuser; Components: pkg_ide; Check: HasFirefox; Description: "Install the Selenium IDE Addon for Firefox";

[UninstallRun]
;Filename: "{app}\RegNet.exe"; Parameters: "-u"; WorkingDir: {app}; Flags: waituntilterminated runascurrentuser runhidden; StatusMsg: "Unregister for COM interoperability";

[InstallDelete]
Type: filesandordirs; Name: "{localappdata}\Temp\Selenium"

[UninstallDelete]
Type: filesandordirs; Name: "{app}"
Type: filesandordirs; Name: "{localappdata}\Temp\Selenium"

[Code]

Function HasPrivileges(): Boolean;
  Begin
    Result := IsAdminLoggedOn Or IsPowerUserLoggedOn
  End;

Function GetAppPath(app: String): string;
  Begin
    RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\' + app, '', Result);
  End;

Function HasFirefox(): Boolean;
  Begin
    Result := FileExists(GetAppPath('firefox.exe'));
  End;

Function GetAppFolder(app: String): string;
  Begin
    Result := ExtractFileDir(GetAppPath(app));
  End;

Function HasApp(app: String): Boolean;
  Begin
    Result := GetAppPath(app) <> '';
  End;

Function GetOfficeVersion(app: String): String;
  Var ver: String; i: Integer;
  Begin
    If RegQueryStringValue(HKCR, app + '.Application\CurVer', '', ver) Then Begin
      For i := 1 To Length(ver) Do Begin
        If (ver[i] >= '0') And (ver[i] <= '9') Then
          Result := Result + ver[i];
      End;
    End;
  End;

Function HasExcel(): Boolean;
  Begin
    Result := RegKeyExists(HKCR, 'Excel.Application');
  End;

Function HasWord(): Boolean;
  Begin
    Result := RegKeyExists(HKCR, 'Word.Application');
  End;

Function HasExcel2003orInf(): Boolean;
  Begin
    Result := StrToIntDef(GetOfficeVersion('Excel'), 0) < 12;
  End;

Procedure AssertFrameworkPresent(Const version: String);
  Begin
    If Not RegKeyExists(HKLM,'SOFTWARE\Microsoft\NET Framework Setup\NDP\v' + version) Then
        RaiseException(ExpandConstant('{cm:MsgNETFrameworkNotInstalled}'));
  End;

Procedure AssertFilePresent(Const path: String);
  Begin
      If Not FileExists(path) Then
          RaiseException(ExpandConstant('{cm:MsgFileNotFound,' + path +'}'));
  End;

Function UninstallPrevious(const appid: String): Boolean;
  Var key, name, out_cmd: String; retcode: Integer;
  Begin
    key := 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' + ExpandConstant(appid) + '_is1';
    name := 'UninstallString';
    If Not RegQueryStringValue(HKCU, key, name, out_cmd) Then
      If Not RegQueryStringValue(HKLM, key, name, out_cmd) Then
         If Not RegQueryStringValue(HKCU32, key, name, out_cmd) Then
            RegQueryStringValue(HKLM32, key, name, out_cmd);
    If out_cmd <> '' Then
        Exec(RemoveQuotes(out_cmd), '/SILENT /NORESTART /SUPPRESSMSGBOXES', '', SW_SHOW, ewWaitUntilTerminated, retcode);
    Result := retcode = 0;
  End;

//---------------------------------------------------------------------------------------
// Registration
//---------------------------------------------------------------------------------------

type
  TNetLib = record
    Guid: String;
    FullName: String;
    Description: String;
    TypeVersion: String;
    Directory: String;
    PathDll: String;
    PathTlb32: String;
    PathTlb64: String;
    Runtime: String;
  end;

Procedure RegString(Const root: Integer; Const subkey, name, value: String);
  Begin
      Log('reg [' + subkey + '] "' + name + '"="' + value + '"');
      If Not RegWriteStringValue(root, subkey, name, value) Then
         RaiseException(ExpandConstant('{cm:MsgRegistryWriteFailure}'));
  End;

// Interface registration (32/64bits Independent) :
//
// HKCU\Software\Classes\Interface\{ interface guid }
//   ""=" interface name "
//   \ProxyStubClsid32
//     ""=" interface short name "
//   \TypeLib
//     ""="{ assembly guid }"
//   \Version
//     ""=" assembly type version "
//
Procedure RegInterface_(Const lib : TNetLib; Const root: Integer; Const guid, typename, proxyStub: String);
  Var key: String;
  Begin
    key := 'Software\Classes\Interface\' + guid;
    RegDeleteKeyIncludingSubkeys(root, key);
    If Not IsUninstaller Then Begin
      RegString(root, key                        , ''         , typename         );
      RegString(root, key + '\ProxyStubClsid32'  , ''         , proxyStub        );
      RegString(root, key + '\TypeLib'           , ''         , lib.Guid         );
      RegString(root, key + '\TypeLib'           , 'Version'  , lib.TypeVersion  );
    End
  End;

Procedure RegInterface(Const lib : TNetLib; Const guid, name, proxystub: String);
  Begin
    RegInterface_(lib, HKCU, guid, name, proxystub);
    If IsWin64 Then
      RegInterface_(lib, HKCU32, guid, name, proxystub);
  End;

// Enumeration registration (32/64bits Shared) :
//
// HKCU\Software\Classes\Record\{ record guid }]
//   ""="mscoree.dll"
//   "Class"="Selenium.Structures.Point"
//   "Assembly"="Selenium, Version=2.0.1.2, Culture=neutral, PublicKeyToken=null"
//   "RuntimeVersion"="v2.0.50727"
//   "CodeBase"="C:\...\SeleniumBasic\Selenium.dll"
//
Procedure RegRecord(Const lib : TNetLib; Const guid, typename: String);
  Var key: String;
  Begin
    key := 'Software\Classes\Record\' + guid;
    RegDeleteKeyIncludingSubkeys(HKCU, key);
    If Not IsUninstaller Then Begin
      RegString(HKCU, key, 'Class'           , typename     );
      RegString(HKCU, key, 'Assembly'        , lib.FullName );
      RegString(HKCU, key, 'RuntimeVersion'  , lib.Runtime  );
      RegString(HKCU, key, 'CodeBase'        , lib.PathDll  );
    End
  End;

// CLSID registration (32/64bits Independent) :
//
// Root\Software\Classes\CLSID\{ class guid }
//   ""="Selenium.WebDriver"
//   \InprocServer32
//     ""="C:\Windows\System32\mscoree.dll"
//     "Class"="Selenium.WebDriver"
//     "Assembly"="Selenium, Version=2.0.1.2, Culture=neutral, PublicKeyToken=null"
//     "RuntimeVersion"="v2.0.50727"
//     "CodeBase"="C:\...\SeleniumBasic\Selenium.dll"
//     "ThreadingModel"="Both"
//   \Implemented Categories\{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}
//     ""=""
//   \ProgId
//     ""="Selenium.WebDriver"
//   \VersionIndependentProgID
//     ""="Selenium.WebDriver"
//
Procedure RegClsid(Const lib : TNetLib; Const root: Integer; Const guid, progid, typename, sysdir: String);
  Var key, skey : String;
  Begin
    key := 'Software\Classes\CLSID\' + guid;
    RegDeleteKeyIncludingSubkeys(root, key);
    If Not IsUninstaller Then Begin
      RegString(root, key, '', typename);

      skey := key + '\InprocServer32';
      RegString(root, skey, ''               , ExpandConstant(sysdir) + '\mscoree.dll' );
      RegString(root, skey, 'Class'          , typename     );
      RegString(root, skey, 'Assembly'       , lib.FullName );
      RegString(root, skey, 'RuntimeVersion' , lib.Runtime  );
      RegString(root, skey, 'CodeBase'       , lib.PathDll  );
      RegString(root, skey, 'ThreadingModel' , 'Both'       );

      skey := key + '\Implemented Categories\{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}';
      RegString(root, skey, '', '');

      skey := key + '\ProgId';
      RegString(root, skey, '', progid);

      skey := key + '\VersionIndependentProgID';
      RegString(root, skey, '', progid);
    End
  End;

// Class registration (32/64bits Shared) :
//
// HKCU\Software\Classes\[progid]
//   ""=[progid]
//   \CLSID
//     ""=[class guid]
//
Procedure RegClass(Const lib : TNetLib; Const guid, progid, typename: String);
  Var key, sysdir: String;
  Begin
    key := 'Software\Classes\' + progid;
    RegDeleteKeyIncludingSubkeys(HKCU, key);
    If Not IsUninstaller Then Begin
      RegString(HKCU, key, '', progid);
      RegString(HKCU, key + '\CLSID', '', guid);
    End

    RegClsid(lib, HKCU, guid, progid, typename, '{sys}');
    If IsWin64 Then
      RegClsid(lib, HKCU32, guid, progid, typename, '{syswow64}');
  End;

// TypeLib registration (32/64bits Shared) :
//
// HKCU\Software\Classes\TypeLib\[assembly guid]
//   \2.0
//     ""="App Type Library"
//     \0\win32
//       ""="C:\...\App32.tlb"
//     \0\win64
//       ""="C:\...\App64.tlb"
//     \FLAGS
//       ""="0"
//     \HELPDIR
//       ""="C:\..."
//
Procedure RegTypeLib(Const lib : TNetLib);
  Var key, skey : String;
  Begin
    key := 'Software\Classes\TypeLib\' + lib.Guid;
    RegDeleteKeyIncludingSubkeys(HKCU, key);
    If Not IsUninstaller Then Begin
      skey := key + '\' + lib.TypeVersion;
      RegString(HKCU, skey, '', lib.Description);
      RegString(HKCU, skey + '\FLAGS'   , ''  , '0'           );
      RegString(HKCU, skey + '\HELPDIR' , ''  , lib.Directory );
      RegString(HKCU, skey + '\0\win32' , ''  , lib.PathTlb32 );
      If IsWin64 Then
        RegString(HKCU, skey + '\0\win64', '' , lib.PathTlb64 );
    End
  End;

Procedure RegisterAssembly();
  Var lib : TNetLib;
  Begin
    { Includes the file generated by gen-registration.ipy }
    #include 'SeleniumBasicSetup.pas'
  End;

//---------------------------------------------------------------------------------------
// Workflow
//---------------------------------------------------------------------------------------

Function InitializeSetup() : Boolean;
  Begin
      AssertFrameworkPresent('3.5');
      Result := True;
  End;

Procedure CurStepChanged(CurStep: TSetupStep);
  Begin
    If CurStep = ssInstall Then Begin
      UninstallPrevious('SeleniumWrapper');
      UninstallPrevious('{#AppId}');
    End Else If CurStep = ssPostInstall Then Begin
      RegisterAssembly();
    End;
  End;

Procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
  Begin
    If CurUninstallStep = usUninstall  Then Begin
      RegisterAssembly(); //Only deletes the main keys
    End;
  End;


Changed the version number in winstall.iss to 0.5.1 ; this updates the Shotwell 0.5.1 release image.

[Setup]
AppName=Shotwell
AppPublisher=Yorba Foundation
AppPublisherURL=http://yorba.org
AppVerName=Shotwell 0.5.1
DefaultDirName={pf}\Shotwell
DefaultGroupName=Shotwell
LicenseFile=COPYING
OutputDir=.
SourceDir=..
Uninstallable=yes

[Icons]
Name: "{commonprograms}\{groupname}\Shotwell"; Filename: "{app}\bin\shotwell.exe"

[Files]
Source: "c:\MinGW\bin\freetype6.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\gdk-pixbuf-query-loaders.exe"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\intl.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\libatk-1.0-0.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\libcairo-2.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\libcroco-0.6-3.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\libexif-12.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\libexpat-1.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\libfontconfig-1.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\libgdk_pixbuf-2.0-0.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\libgdk-win32-2.0-0.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\libgio-2.0-0.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\libglib-2.0-0.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\libgmodule-2.0-0.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\libgobject-2.0-0.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\libgsf-1-114.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\libgthread-2.0-0.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\libgtk-win32-2.0-0.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\libjpeg-7.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\libpango-1.0-0.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\libpangocairo-1.0-0.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\libpangoft2-1.0-0.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\libpangowin32-1.0-0.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\libpng12-0.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\librsvg-2-2.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\libxml2-2.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\sqlite3.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\zlib1.dll"; DestDir: "{app}\bin"

Source: "c:\MinGW\lib\gtk-2.0\2.10.0\loaders\libpixbufloader-jpeg.dll"; DestDir: "{app}\lib\gtk-2.0\2.10.0\loaders"
Source: "c:\MinGW\lib\gtk-2.0\2.10.0\loaders\libpixbufloader-png.dll"; DestDir: "{app}\lib\gtk-2.0\2.10.0\loaders"
Source: "c:\MinGW\lib\gtk-2.0\2.10.0\loaders\svg_loader.dll"; DestDir: "{app}\lib\gtk-2.0\2.10.0\loaders"

Source: "icons\*"; DestDir: "{app}\share\shotwell\icons"
Source: "ui\*"; DestDir: "{app}\share\shotwell\ui"
Source: "shotwell.exe"; DestDir: "{app}\bin\"

[Run]
Filename: "cmd"; Parameters: "/c mkdir etc\gtk-2.0 & bin\gdk-pixbuf-query-loaders.exe > etc\gtk-2.0\gdk-pixbuf.loaders"; WorkingDir: "{app}"; Flags: runhidden

[UninstallDelete]
Type: files; Name: "{app}\etc\gtk-2.0\gdk-pixbuf.loaders"
Type: dirifempty; Name: "{app}\etc\gtk-2.0"
Type: dirifempty; Name: "{app}\etc"

[Setup]
AppName=Shotwell
AppPublisher=Yorba Foundation
AppPublisherURL=http://yorba.org
AppVerName=Shotwell 0.5.0+branch
DefaultDirName={pf}\Shotwell
DefaultGroupName=Shotwell
LicenseFile=COPYING
OutputDir=.
SourceDir=..
Uninstallable=yes

[Icons]
Name: "{commonprograms}\{groupname}\Shotwell"; Filename: "{app}\bin\shotwell.exe"

[Files]
Source: "c:\MinGW\bin\freetype6.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\gdk-pixbuf-query-loaders.exe"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\intl.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\libatk-1.0-0.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\libcairo-2.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\libcroco-0.6-3.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\libexif-12.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\libexpat-1.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\libfontconfig-1.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\libgdk_pixbuf-2.0-0.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\libgdk-win32-2.0-0.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\libgio-2.0-0.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\libglib-2.0-0.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\libgmodule-2.0-0.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\libgobject-2.0-0.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\libgsf-1-114.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\libgthread-2.0-0.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\libgtk-win32-2.0-0.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\libjpeg-7.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\libpango-1.0-0.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\libpangocairo-1.0-0.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\libpangoft2-1.0-0.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\libpangowin32-1.0-0.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\libpng12-0.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\librsvg-2-2.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\libxml2-2.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\sqlite3.dll"; DestDir: "{app}\bin"
Source: "c:\MinGW\bin\zlib1.dll"; DestDir: "{app}\bin"

Source: "c:\MinGW\lib\gtk-2.0\2.10.0\loaders\libpixbufloader-jpeg.dll"; DestDir: "{app}\lib\gtk-2.0\2.10.0\loaders"
Source: "c:\MinGW\lib\gtk-2.0\2.10.0\loaders\libpixbufloader-png.dll"; DestDir: "{app}\lib\gtk-2.0\2.10.0\loaders"
Source: "c:\MinGW\lib\gtk-2.0\2.10.0\loaders\svg_loader.dll"; DestDir: "{app}\lib\gtk-2.0\2.10.0\loaders"

Source: "icons\*"; DestDir: "{app}\share\shotwell\icons"
Source: "ui\*"; DestDir: "{app}\share\shotwell\ui"
Source: "shotwell.exe"; DestDir: "{app}\bin\"

[Run]
Filename: "cmd"; Parameters: "/c mkdir etc\gtk-2.0 & bin\gdk-pixbuf-query-loaders.exe > etc\gtk-2.0\gdk-pixbuf.loaders"; WorkingDir: "{app}"; Flags: runhidden

[UninstallDelete]
Type: files; Name: "{app}\etc\gtk-2.0\gdk-pixbuf.loaders"
Type: dirifempty; Name: "{app}\etc\gtk-2.0"
Type: dirifempty; Name: "{app}\etc"


changed name of LICENSE-File added 'show README'

#define MyAppName "Vigra 1.4"
#define MyAppVersion "1.4.1"
#define MyAppPublisher "Ullrich Kthe, University of Hamburg"
#define MyAppURL "http://kogs.informatik.uni-hamburg.de/~koethe/vigra/"
#define MySourcePath "C:\Users\koethe\src\vigra\current"
#define MyDocSourcePath "z:\vigra\current\doc"
#define RequiredVCVersion "7.1"

[Setup]
AppCopyright=Ullrich Kthe
AppName={#MyAppName}
AppVerName=Vigra {#MyAppVersion}
LicenseFile={#MySourcePath}\LICENSE.txt
ShowLanguageDialog=yes
AppSupportURL={#MyAppUrl}
AppVersion={#MyAppVersion}
DefaultDirName={reg:HKCU\Software\Microsoft\VisualStudio\7.1,VisualStudioProjectsLocation|{pf}}\{#MyAppName}
OutputBaseFilename=Setup-Vigra-{#MyAppVersion}
Compression=lzma
SolidCompression=true
AppID={#MyAppName}
OutputDir=C:\Users\koethe\src\vigra\current\WinSetup
InfoBeforeFile={#MySourcePath}\README.txt

[Files]
Source: {#MySourcePath}\LICENSE.txt; DestDir: {app}
Source: {#MySourcePath}\README.txt; DestDir: {app}
Source: {#MySourcePath}\include\vigra\*.hxx; DestDir: {app}\include\vigra
Source: {#MySourcePath}\include\vigra\*.h; DestDir: {app}\include\vigra
Source: {#MySourcePath}\src\*.cxx; DestDir: {app}\src; Flags: recursesubdirs
Source: {#MySourcePath}\src\*.hxx; DestDir: {app}\src; Flags: recursesubdirs
Source: {#MySourcePath}\src\*.vcproj; DestDir: {app}\src; Flags: recursesubdirs
Source: {#MySourcePath}\src\*.sln; DestDir: {app}\src
Source: {#MySourcePath}\src\examples\*.exe; DestDir: {app}\bin
Source: {#MySourcePath}\src\examples\*.gif; DestDir: {app}\src\examples
Source: {#MySourcePath}\test\*.cxx; DestDir: {app}\test; Flags: recursesubdirs
Source: {#MySourcePath}\test\*.hxx; DestDir: {app}\test; Flags: recursesubdirs
Source: {#MySourcePath}\test\*.gif; DestDir: {app}\test; Flags: recursesubdirs
Source: {#MySourcePath}\test\*.xv; DestDir: {app}\test; Flags: recursesubdirs
Source: {#MySourcePath}\test\*.vcproj; DestDir: {app}\test; Flags: recursesubdirs
Source: {#MySourcePath}\test\*.sln; DestDir: {app}\test
Source: {#MySourcePath}\test\testOrDelete.bat; DestDir: {app}\test
Source: {#MyDocSourcePath}\vigra\*; Excludes: CVS; DestDir: {app}\doc\vigra; Flags: recursesubdirs
Source: {#MySourcePath}\include\external\fftw3.h; DestDir: {app}\include\external
Source: {#MySourcePath}\include\external\jconfig.h; DestDir: {app}\include\external
Source: {#MySourcePath}\include\external\jmorecfg.h; DestDir: {app}\include\external
Source: {#MySourcePath}\include\external\jpeglib.h; DestDir: {app}\include\external
Source: {#MySourcePath}\include\external\png.h; DestDir: {app}\include\external
Source: {#MySourcePath}\include\external\pngconf.h; DestDir: {app}\include\external
Source: {#MySourcePath}\include\external\tiff.h; DestDir: {app}\include\external
Source: {#MySourcePath}\include\external\tiffconf.h; DestDir: {app}\include\external
Source: {#MySourcePath}\include\external\tiffio.h; DestDir: {app}\include\external
Source: {#MySourcePath}\include\external\tiffvers.h; DestDir: {app}\include\external
Source: {#MySourcePath}\include\external\zconf.h; DestDir: {app}\include\external
Source: {#MySourcePath}\include\external\zlib.h; DestDir: {app}\include\external
Source: {#MySourcePath}\lib\*.lib; DestDir: {app}\lib
Source: {#MySourcePath}\lib\*.dll; DestDir: {app}\bin

[UninstallDelete]
Type: filesandordirs; Name: {app}\src\impex\Release
Type: filesandordirs; Name: {app}\src\impex\Debug
Type: dirifempty; Name: {app}\src\impex

Type: filesandordirs; Name: {app}\src\examples\Release
Type: filesandordirs; Name: {app}\src\examples\Debug
Type: files; Name: {app}\src\examples\*.exe
Type: files; Name: {app}\src\examples\*.pdb
Type: dirifempty; Name: {app}\src\examples

Type: files; Name: {app}\src\*.ncb
Type: files; Name: {app}\src\*.suo
Type: dirifempty; Name: {app}\src

Type: filesandordirs; Name: {app}\test
Type: dirifempty; Name: {app}

[Code]
var
	VCPath: String;
	VCUserPath: String;

procedure CurStepChanged(CurStep: TSetupStep);
var
	Path: String;
begin
	if CurStep = ssPostInstall then
	begin
		RegQueryStringValue(HKCU, 'Environment', 'PATH', Path);
		Path := Path + ';' + ExpandConstant('{app}\bin');
		RegWriteStringValue(HKCU, 'Environment', 'PATH', Path);
	end;
end;

procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
	Path: String;
begin
	if CurUninstallStep = usPostUninstall then
	begin
		RegQueryStringValue(HKCU, 'Environment', 'PATH', Path);
		StringChange(Path,  ';' + ExpandConstant('{app}\bin'), '');
		RegWriteStringValue(HKCU, 'Environment', 'PATH', Path);
	end;
end;

procedure InitializeWizard();
begin
	if VCPath = '' then
		CreateOutputMsgPage(wpWelcome, 'Visual C++ {#RequiredVCVersion} not found.', '',
	     'Visual C++ {#RequiredVCVersion} could not be found on your computer. ' +
	     'You won''t be able to compile any programs using {#MyAppName}.');

	if VCUserPath <> '' then
		WizardForm.DirEdit.Text := VCUserPath + '\{#MyAppName}'
	else
		WizardForm.DirEdit.Text := ExpandConstant('{pf}\{#MyAppName}');
end;

function InitializeSetup(): Boolean;
begin
	// Look for Visual Studio 7.1
	VCPath := '';
	VCUserPath := '';
	if RegQueryStringValue(HKLM, 'Software\Microsoft\VisualStudio\{#RequiredVCVersion}\Setup\VC', 'ProductDir', VCPath) then
		RegQueryStringValue(HKCU, 'Software\Microsoft\VisualStudio\{#RequiredVCVersion}','VisualStudioProjectsLocation', VCUserPath);
	Result := True;
end;

#define MyAppName "Vigra 1.4"
#define MyAppVersion "1.4.1"
#define MyAppPublisher "Ullrich Kthe, University of Hamburg"
#define MyAppURL "http://kogs.informatik.uni-hamburg.de/~koethe/vigra/"
#define MySourcePath "C:\Users\koethe\src\vigra\current"
#define MyDocSourcePath "z:\vigra\current\doc"
#define RequiredVCVersion "7.1"

[Setup]
AppCopyright=Ullrich Kthe
AppName={#MyAppName}
AppVerName=Vigra {#MyAppVersion}
LicenseFile={#MySourcePath}\LICENSE
ShowLanguageDialog=yes
AppSupportURL={#MyAppUrl}
AppVersion={#MyAppVersion}
DefaultDirName={reg:HKCU\Software\Microsoft\VisualStudio\7.1,VisualStudioProjectsLocation|{pf}}\{#MyAppName}
OutputBaseFilename=Setup-Vigra-{#MyAppVersion}
Compression=lzma
SolidCompression=true
AppID={#MyAppName}
OutputDir=C:\Users\koethe\src\vigra\current\WinSetup

[Files]
Source: {#MySourcePath}\LICENSE.txt; DestDir: {app}
Source: {#MySourcePath}\README.txt; DestDir: {app}
Source: {#MySourcePath}\include\vigra\*.hxx; DestDir: {app}\include\vigra
Source: {#MySourcePath}\include\vigra\*.h; DestDir: {app}\include\vigra
Source: {#MySourcePath}\src\*.cxx; DestDir: {app}\src; Flags: recursesubdirs
Source: {#MySourcePath}\src\*.hxx; DestDir: {app}\src; Flags: recursesubdirs
Source: {#MySourcePath}\src\*.vcproj; DestDir: {app}\src; Flags: recursesubdirs
Source: {#MySourcePath}\src\*.sln; DestDir: {app}\src
Source: {#MySourcePath}\src\examples\*.exe; DestDir: {app}\bin
Source: {#MySourcePath}\src\examples\*.gif; DestDir: {app}\src\examples
Source: {#MySourcePath}\test\*.cxx; DestDir: {app}\test; Flags: recursesubdirs
Source: {#MySourcePath}\test\*.hxx; DestDir: {app}\test; Flags: recursesubdirs
Source: {#MySourcePath}\test\*.gif; DestDir: {app}\test; Flags: recursesubdirs
Source: {#MySourcePath}\test\*.xv; DestDir: {app}\test; Flags: recursesubdirs
Source: {#MySourcePath}\test\*.vcproj; DestDir: {app}\test; Flags: recursesubdirs
Source: {#MySourcePath}\test\*.sln; DestDir: {app}\test
Source: {#MySourcePath}\test\testOrDelete.bat; DestDir: {app}\test
Source: {#MyDocSourcePath}\vigra\*; Excludes: CVS; DestDir: {app}\doc\vigra; Flags: recursesubdirs
Source: {#MySourcePath}\include\external\fftw3.h; DestDir: {app}\include\external
Source: {#MySourcePath}\include\external\jconfig.h; DestDir: {app}\include\external
Source: {#MySourcePath}\include\external\jmorecfg.h; DestDir: {app}\include\external
Source: {#MySourcePath}\include\external\jpeglib.h; DestDir: {app}\include\external
Source: {#MySourcePath}\include\external\png.h; DestDir: {app}\include\external
Source: {#MySourcePath}\include\external\pngconf.h; DestDir: {app}\include\external
Source: {#MySourcePath}\include\external\tiff.h; DestDir: {app}\include\external
Source: {#MySourcePath}\include\external\tiffconf.h; DestDir: {app}\include\external
Source: {#MySourcePath}\include\external\tiffio.h; DestDir: {app}\include\external
Source: {#MySourcePath}\include\external\tiffvers.h; DestDir: {app}\include\external
Source: {#MySourcePath}\include\external\zconf.h; DestDir: {app}\include\external
Source: {#MySourcePath}\include\external\zlib.h; DestDir: {app}\include\external
Source: {#MySourcePath}\lib\*.lib; DestDir: {app}\lib
Source: {#MySourcePath}\lib\*.dll; DestDir: {app}\bin

[UninstallDelete]
Type: filesandordirs; Name: {app}\src\impex\Release
Type: filesandordirs; Name: {app}\src\impex\Debug
Type: dirifempty; Name: {app}\src\impex

Type: filesandordirs; Name: {app}\src\examples\Release
Type: filesandordirs; Name: {app}\src\examples\Debug
Type: files; Name: {app}\src\examples\*.exe
Type: files; Name: {app}\src\examples\*.pdb
Type: dirifempty; Name: {app}\src\examples

Type: files; Name: {app}\src\*.ncb
Type: files; Name: {app}\src\*.suo
Type: dirifempty; Name: {app}\src

Type: filesandordirs; Name: {app}\test
Type: dirifempty; Name: {app}

[Code]
var
	VCPath: String;
	VCUserPath: String;

procedure CurStepChanged(CurStep: TSetupStep);
var
	Path: String;
begin
	if CurStep = ssPostInstall then
	begin
		RegQueryStringValue(HKCU, 'Environment', 'PATH', Path);
		Path := Path + ';' + ExpandConstant('{app}\bin');
		RegWriteStringValue(HKCU, 'Environment', 'PATH', Path);
	end;
end;

procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
	Path: String;
begin
	if CurUninstallStep = usPostUninstall then
	begin
		RegQueryStringValue(HKCU, 'Environment', 'PATH', Path);
		StringChange(Path,  ';' + ExpandConstant('{app}\bin'), '');
		RegWriteStringValue(HKCU, 'Environment', 'PATH', Path);
	end;
end;

procedure InitializeWizard();
begin
	if VCPath = '' then
		CreateOutputMsgPage(wpWelcome, 'Visual C++ {#RequiredVCVersion} not found.', '',
	     'Visual C++ {#RequiredVCVersion} could not be found on your computer. ' +
	     'You won''t be able to compile any programs using {#MyAppName}.');

	if VCUserPath <> '' then
		WizardForm.DirEdit.Text := VCUserPath + '\{#MyAppName}'
	else
		WizardForm.DirEdit.Text := ExpandConstant('{pf}\{#MyAppName}');
end;

function InitializeSetup(): Boolean;
begin
	// Look for Visual Studio 7.1
	VCPath := '';
	VCUserPath := '';
	if RegQueryStringValue(HKLM, 'Software\Microsoft\VisualStudio\{#RequiredVCVersion}\Setup\VC', 'ProductDir', VCPath) then
		RegQueryStringValue(HKCU, 'Software\Microsoft\VisualStudio\{#RequiredVCVersion}','VisualStudioProjectsLocation', VCUserPath);
	Result := True;
end;


Update GFP-Install.iss

Update GFP-Install.iss

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

[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={{2318E9DF-8E1D-4E04-84D6-85098CFF854E}}
AppName=GreenForce-Player
AppVerName=GreenForce-Player 2.10
VersionInfoVersion=2.10
AppPublisher=RRSoftware
VersionInfoCopyright=(c) 2009-2018 RocketRider
AppPublisherURL=http://gfp.rrsoftware.de
AppSupportURL=http://gfp.rrsoftware.de
AppUpdatesURL=http://gfp.rrsoftware.de
DefaultDirName={pf}\GreenForce-Player
DefaultGroupName=GreenForce-Player
AllowNoIcons=yes
InfoBeforeFile=..\ReadmeEN.txt
;OutputDir=C:\Users\Admin\Desktop\Projects\PureBasic\GFP-Install
OutputBaseFilename=GFP-Setup-v2.10
SetupIconFile=Icon.ico
WizardSmallImageFile=Box.bmp
WizardImageFile=Logo_Gray.bmp
Compression=lzma2/ultra64
SolidCompression=yes
DisableWelcomePage=no

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "french"; MessagesFile: "compiler:Languages\French.isl"
Name: "german"; MessagesFile: "compiler:Languages\German.isl"; InfoBeforeFile: "..\ReadmeDE.txt"
Name: "dutch"; MessagesFile: "compiler:Languages\Dutch.isl"
Name: "greek"; MessagesFile: "compiler:Languages\Greek.isl"
Name: "italian"; MessagesFile: "compiler:Languages\Italian.isl"
Name: "portuguese"; MessagesFile: "compiler:Languages\Portuguese.isl"
Name: "russian"; MessagesFile: "compiler:Languages\Russian.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"

[Components]
Name: "core"; Description: "GreenForce-Player"; Types: full compact custom; Flags: fixed
Name: "sdk"; Description: "GreenForce-Player SDK files"; Types: full

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

[Files]
Source: "..\GreenForce-Player.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: core
Source: "..\GFP-SDK\*"; DestDir: "{app}\GFP-SDK\"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: sdk
Source: "..\Help\*"; DestDir: "{app}\Help\"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: core
Source: "..\Data\uninstall.ico"; DestDir: "{app}"; Flags: ignoreversion; Components: core
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\GreenForce-Player"; Filename: "{app}\GreenForce-Player.exe"; Components: core
Name: "{group}\GFPCrypt-GUI"; Filename: "{app}\GFP-SDK\GFPCrypt-GUI\GFPCrypt-GUI.exe"; Components: sdk
Name: "{group}\Documentation"; Filename: "{app}\Help\GFP-Documentation.html"; Components: core
Name: "{group}\FAQ"; Filename: "{app}\Help\FAQ.pdf"; Components: core
Name: "{group}\{cm:ProgramOnTheWeb,GreenForce-Player}"; Filename: "http://gfp.rrsoftware.de"; Components: core
Name: "{group}\{cm:UninstallProgram,GreenForce-Player}"; Filename: "{uninstallexe}"; IconFilename: "{app}\uninstall.ico"; Components: core
Name: "{commondesktop}\GreenForce-Player"; Filename: "{app}\GreenForce-Player.exe"; Tasks: desktopicon; Components: core
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\GreenForce-Player"; Filename: "{app}\GreenForce-Player.exe"; Tasks: quicklaunchicon; Components: core

[Run]
Filename: "{app}\GreenForce-Player.exe"; Parameters: "/codecdownload"; Flags: runascurrentuser waituntilterminated
Filename: "{app}\GreenForce-Player.exe"; Description: "{cm:LaunchProgram,GreenForce-Player}"; Flags: nowait postinstall skipifsilent

[UninstallRun]
Filename: "{app}\GreenForce-Player.exe"; Parameters: "/deletelavfilters"; Flags: runascurrentuser waituntilterminated

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

[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={{2318E9DF-8E1D-4E04-84D6-85098CFF854E}}
AppName=GreenForce-Player
AppVerName=GreenForce-Player 2.00
VersionInfoVersion=2.00
AppPublisher=RRSoftware
VersionInfoCopyright=(c) 2009-2017 RocketRider
AppPublisherURL=http://gfp.rrsoftware.de
AppSupportURL=http://gfp.rrsoftware.de
AppUpdatesURL=http://gfp.rrsoftware.de
DefaultDirName={pf}\GreenForce-Player
DefaultGroupName=GreenForce-Player
AllowNoIcons=yes
InfoBeforeFile=..\ReadmeEN.txt
;OutputDir=C:\Users\Admin\Desktop\Projects\PureBasic\GFP-Install
OutputBaseFilename=GFP-Setup-v2.00
SetupIconFile=Icon.ico
WizardSmallImageFile=Box.bmp
WizardImageFile=Logo_Gray.bmp
Compression=lzma2/ultra64
SolidCompression=yes
DisableWelcomePage=no

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "french"; MessagesFile: "compiler:Languages\French.isl"
Name: "german"; MessagesFile: "compiler:Languages\German.isl"; InfoBeforeFile: "..\ReadmeDE.txt"
Name: "dutch"; MessagesFile: "compiler:Languages\Dutch.isl"
Name: "greek"; MessagesFile: "compiler:Languages\Greek.isl"
Name: "italian"; MessagesFile: "compiler:Languages\Italian.isl"
Name: "portuguese"; MessagesFile: "compiler:Languages\Portuguese.isl"
Name: "russian"; MessagesFile: "compiler:Languages\Russian.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"

[Components]
Name: "core"; Description: "GreenForce-Player"; Types: full compact custom; Flags: fixed
Name: "sdk"; Description: "GreenForce-Player SDK files"; Types: full

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

[Files]
Source: "..\GreenForce-Player.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: core
Source: "..\GFP-SDK\*"; DestDir: "{app}\GFP-SDK\"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: sdk
Source: "..\Help\*"; DestDir: "{app}\Help\"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: core
Source: "..\Data\uninstall.ico"; DestDir: "{app}"; Flags: ignoreversion; Components: core
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\GreenForce-Player"; Filename: "{app}\GreenForce-Player.exe"; Components: core
Name: "{group}\GFPCrypt-GUI"; Filename: "{app}\GFP-SDK\GFPCrypt-GUI\GFPCrypt-GUI.exe"; Components: sdk
Name: "{group}\Documentation"; Filename: "{app}\Help\GFP-Documentation.html"; Components: core
Name: "{group}\FAQ"; Filename: "{app}\Help\FAQ.pdf"; Components: core
Name: "{group}\{cm:ProgramOnTheWeb,GreenForce-Player}"; Filename: "http://gfp.rrsoftware.de"; Components: core
Name: "{group}\{cm:UninstallProgram,GreenForce-Player}"; Filename: "{uninstallexe}"; IconFilename: "{app}\uninstall.ico"; Components: core
Name: "{commondesktop}\GreenForce-Player"; Filename: "{app}\GreenForce-Player.exe"; Tasks: desktopicon; Components: core
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\GreenForce-Player"; Filename: "{app}\GreenForce-Player.exe"; Tasks: quicklaunchicon; Components: core

[Run]
Filename: "{app}\GreenForce-Player.exe"; Parameters: "/codecdownload"; Flags: runascurrentuser waituntilterminated
Filename: "{app}\GreenForce-Player.exe"; Description: "{cm:LaunchProgram,GreenForce-Player}"; Flags: nowait postinstall skipifsilent

[UninstallRun]
Filename: "{app}\GreenForce-Player.exe"; Parameters: "/deletelavfilters"; Flags: runascurrentuser waituntilterminated