Committing all changes before branching this version.

git-svn-id: f6be4fc6801212b6461a9a76948e7afa54479b7a@73083 142e9c35-602f-4880-9f37-ec48a24daa6a

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

[ISSI]
;; Include ALL languages
#define ISSI_Languages
;#define x64BitVersion

;; Create an About button in the Setup Wizard
#define ISSI_About  "{cm:issiAbout}"
;; Set date-time format and seperator
#define ISSI_Constants "YYMDHMS"
#define ISSI_ConstantsSeperator "."
;; Create a print button on the License page
#define ISSI_LicensePrint
; Add BeveledLabel message (leave empty for default "Inno Setup" value)
#define ISSI_BeveledLabel "MapWindow GIS"
#ifdef x64BitVersion
  #define ISSI_BeveledLabel ISSI_BeveledLabel + " 64 Bit"
#endif
;; Create a link to a web page in the Setup Wizard using multilingual custom messages:
#define ISSI_URL
#define ISSI_UrlText

; Include ISSI
#define ISSI_IncludePath "C:\dev\InstallationProjects\ISSI"
#include ISSI_IncludePath+"\_issi.isi"

#define MyAppName "MapWinGIS"
#define MyAppVersion "4.8.8.1"
#define MyAppPublisher "MapWindow GIS"
#define MyAppURL "http://www.mapwindow.org"
#ifdef x64BitVersion
  #define MyOutputBaseFilename "MapWinGIS-only-v4.8SR-64bit-installer"
#else
  #define MyOutputBaseFilename "MapWinGIS-only-v4.8.8SR-32bit-installer"
#endif
#define MySourcePath SourcePath

[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={{4DA288CD-C016-4E9E-B9EA-89799F678A06}
PrivilegesRequired=poweruser
MinVersion=,5.1.2600sp1
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
AppCopyright=MapWindow development team
AppContact={#MyAppURL}
AppVerName={#MyAppVersion}
DefaultDirName=C:\dev\{#MyAppName}
DefaultGroupName={#MyAppName}
AllowNoIcons=true
LicenseFile=license.rtf
InfoBeforeFile=MapWindowNotes.rtf
OutputDir=C:\dev\MapWinGIS4Dev\Setup
#ifdef x64BitVersion
  SourceDir=C:\dev\MapWindow4Dev\Bin64
#else
  SourceDir=C:\dev\MapWindow4Dev\Bin
#endif
OutputBaseFilename={#MyOutputBaseFilename}
SetupIconFile=MapWindow.ico
Compression=lzma/Ultra
SolidCompression=true
InternalCompressLevel=Ultra
VersionInfoCompany=MapWindow Open Source Team [www.MapWindow.org]
VersionInfoCopyright=Mozilla Public License (MPL) 1.1
VersionInfoDescription=MapWindow GIS [www.MapWindow.org]
VersionInfoProductName={#MyAppName}
VersionInfoProductVersion={#MyAppVersion}
VersionInfoVersion={#MyAppVersion}
WizardImageFile= {#MySourcePath}WizImage-MW.bmp
WizardSmallImageFile= {#MySourcePath}WizSmallImage-MW.bmp
WizardImageStretch=false

[Languages]

[Files]
;C++ Distributables
#ifdef x64BitVersion
  Source: {#MySourcePath}vcfiles\vcredist_x64_2008.exe; DestDir: {tmp}; Flags: deleteafterinstall 64bit ignoreversion
  Source: msvcr90.dll; DestDir: {sys}; Flags: restartreplace 64bit uninsneveruninstall sharedfile
#else
  Source: {#MySourcePath}vcfiles\vcredist_x86_2008.exe; DestDir: {tmp}; Flags: deleteafterinstall 32bit ignoreversion
  Source: {#MySourcePath}vcfiles\msvcr90.dll; DestDir: {sys}; Flags: restartreplace 32bit uninsneveruninstall sharedfile
  Source: {#MySourcePath}vcfiles\msvcp90.dll; DestDir: {sys}; Flags: restartreplace 32bit uninsneveruninstall sharedfile
#endif

Source: netcdf.dll; DestDir: {app}; Flags: ignoreversion 32bit;
Source: lti_dsdk.dll; DestDir: {app}; Flags: ignoreversion 32bit;
Source: lti_lidar_dsdk.dll; DestDir: {app}; Flags: ignoreversion 32bit;
Source: NCScnet4.dll; DestDir: {app}; Flags: ignoreversion 32bit;
Source: NCSEcw4_RO.dll; DestDir: {app}; Flags: ignoreversion 32bit;
Source: NCSUtil4.dll; DestDir: {app}; Flags: ignoreversion 32bit;
Source: log4net.dll; DestDir: {app}; Flags: ignoreversion 32bit;
Source: tbb.dll; DestDir: {app}; Flags: ignoreversion 32bit;
Source: MapWindowNotes.rtf; DestDir: {app}; Flags: ignoreversion isreadme;
Source: MapWinGIS.ocx; DestDir: {app}; Flags: ignoreversion 32bit;
Source: stdole.dll; DestDir: {app}; Flags: ignoreversion 32bit;
Source: regMapWinGIS.cmd; DestDir: {app}; Flags: ignoreversion 32bit;
Source: SetEnv.exe; DestDir: {app}; Flags: ignoreversion 32bit;

;;Source: gdal18.dll; DestDir: {app}; Flags: ignoreversion 32bit;
;;Source: geos_c.dll; DestDir: {app}; Flags: ignoreversion 32bit;
;;Source: IndexSearching.dll; DestDir: {app}; Flags: ignoreversion 32bit;
;;Source: proj.dll; DestDir: {app}; Flags: ignoreversion 32bit;
;;Source: xerces-c_3.dll; DestDir: {app}; Flags: ignoreversion 32bit;

;; Use a custom cmd file, without notification:
Source: {#MySourcePath}regMapWinGIS.cmd; DestDir: {app}; Flags: ignoreversion
;; GDAL Projection files:
#include SourcePath + '\gdal_data.txt'
#include SourcePath + '\proj_nad.txt'

; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}"

[Run]
;Run some command files:
Filename: {app}\regMapWinGIS.cmd; WorkingDir: {app}; Flags: runhidden

[Dirs]
Name: {app}; Permissions: everyone-modify

[CustomMessages]
en.issiAbout=MapWindow Open Source Team [www.MapWindow.org]
nl.issiAbout=Ga voor Nederlandstalige ondersteuning naar www.mapwindow.nl.
en.issiUrl=http://www.mapwindow.org
nl.issiUrl=http://www.mapwindow.nl
en.issiUrlText={#MyAppName}
nl.issiUrlText=Nederlandse ondersteuning
en.RunSurvey=Take a very brief survey after your first use of MapWindow for a chance to win a T-Shirt?
nl.RunSurvey=Wil je een korte enqute doen nadat je MapWindow voor het eerst hebt gebruikt? Je kunt er een T-Shirt mee winnen
en.FoundPreviousVersion=Detected a previous version of MapWindow! It will be uninstalled
nl.FoundPreviousVersion=Er is een eerdere versie van MapWindow gevonden! Het zal worden gedenstalleerd

[Code]
function MsiQueryProductState(ProductCode: PAnsiChar): Integer;
external 'MsiQueryProductStateA@msi.dll stdcall';

const
  INSTALLLEVEL_MAXIMUM = $ffff;
	INSTALLSTATE_BADCONFIG = -6;
	INSTALLSTATE_INCOMPLETE = -5;
	INSTALLSTATE_SOURCEABSENT = -4;
	INSTALLSTATE_MOREDATA = -3;
	INSTALLSTATE_INVALIDARG = -2;      // An invalid parameter was passed to the function.
	INSTALLSTATE_UNKNOWN = -1;         // The product is neither advertised or installed.
	INSTALLSTATE_BROKEN = 0;
	INSTALLSTATE_ADVERTISED = 1;       // The product is advertised but not installed.
  INSTALLSTATE_ABSENT = 2;           // The product is installed for a different user.
	INSTALLSTATE_LOCAL = 3;
	INSTALLSTATE_SOURCE = 4;
  INSTALLSTATE_DEFAULT = 5;          // The product is installed for the current user.

  //Microsoft Visual C++ 2008 Redistributable - x86 9.0.30729.17: {9A25302D-30C0-39D9-BD6F-21E6EC160475}
const
	VCREDIST_X86 = '{9A25302D-30C0-39D9-BD6F-21E6EC160475}';
	VCREDIST_X64 = '{8220EEFE-38CD-377E-8595-13398D740ACE}';
  ErrorInstallVC = 'Error installing the VC++ redistributables!';

function IsDotNET35Detected(): boolean;
var
  NetSuccess: boolean;
  NetInstall: cardinal;
begin
  NetSuccess := RegQueryDWordValue(HKLM, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5', 'Install', NetInstall);
  Result := NetSuccess and (NetInstall = 1);
#ifdef Debug
  if Result then
		MsgBox('Found DotNET35', mbInformation, MB_OK);
#endif
end;

function IsMsiProductInstalled(const ProductId: string): boolean;
var
	queryResult: Integer;
begin
#ifdef Debug
	MsgBox('Checking for ' + ProductId, mbInformation, MB_OK);
#endif
	queryResult := MsiQueryProductState(ProductId);

#ifdef Debug
		MsgBox('MsiQueryProductState: ' + IntToStr(queryResult), mbInformation, MB_OK);
#endif

	Result := queryResult = INSTALLSTATE_DEFAULT;
end;

function NeedInstallVC8(): Boolean;
begin

  // Check reg key:
#ifdef x64BitVersion
	Result := not IsMsiProductInstalled(VCREDIST_X64);
#else
	Result := not IsMsiProductInstalled(VCREDIST_X86);
#endif

#ifdef Debug
  if Result then
  begin
		MsgBox('Could not find VCREDIST, will install', mbInformation, MB_OK);
	end
	else
	begin
		MsgBox('Found VCREDIST, no need to install', mbInformation, MB_OK);
	end;
#endif
end;

// Checks for a MapWinGIS ocx in the given classID. If it's found, it's unregistered and renamed,
// or, failing renaming, deleted.
procedure UnregisterMapWinGIS(clsname: String; Rename: Boolean);
var
  Path: String;
begin
  try
    if RegQueryStringValue(HKEY_CLASSES_ROOT, 'CLSID\' + clsname + '\InprocServer32', '', Path) then
    begin
      // Successfully read the value
      if Lowercase(ExtractFileName(Path)) = 'mapwingis.ocx' then
			begin
				try
					UnregisterServer(false, Path, false);
#ifdef Debug
					MsgBox('MapWinGIS is unregistered', mbInformation, MB_OK);
#endif
				except
				end;

				if Rename then
				begin
					try
						if not RenameFile(Path, ExtractFilePath(Path) + 'MapWinGIS.ocx.old') then
						begin
							DeleteFile(Path);
						end;
					except
					end;
				end
				else
				begin
					DeleteFile(Path);
				end;
			end;
    end;
  except
  end;
end;

function InstallDotNET(versionDotNET: string; file1: String; file2: String; urlFamilyID: String): Boolean;
var
	ExpectedLocalLocation: String;
	ErrorCode: Integer;
begin
	ExpectedLocalLocation := ExpandConstant('{src}') + '\' + file1;
	if not FileExists(ExpectedLocalLocation) then
		ExpectedLocalLocation := ExpandConstant('{src}') + '\' + file2;

	if FileExists(ExpectedLocalLocation) then
	begin
		ShellExec('open', ExpectedLocalLocation, '', '', SW_SHOW, ewNoWait, ErrorCode);
		Result := MsgBox('Ready to continue MapWindow installation?' #13#13 '(Click Yes after installing .Net Framework ' + versionDotNET + ')', mbConfirmation, MB_YESNO) = idYes;
	end
	else
	begin
		if MsgBox('The .Net Framework ' + versionDotNET + ' is required but was not found.' #13#13 'Open the web page for downloading .Net ' + versionDotNET + ' now?', mbConfirmation, MB_YESNO) = idYes	then
		begin
			ShellExec('open', 'http://www.microsoft.com/downloads/details.aspx?FamilyID=' + urlFamilyID, '', '', SW_SHOW, ewNoWait, ErrorCode)
			Result := MsgBox('Ready to continue MapWindow installation?' #13#13 '(Click Yes after installing .Net Framework ' + versionDotNET + ')', mbConfirmation, MB_YESNO) = idYes;
		end
		else
			Result := MsgBox('.Net ' + versionDotNET + ' Framework is required but was not found.' #13#13 'Continue MapWindow installation?', mbConfirmation, MB_YESNO) = idYes;
	end;
end;

function CheckDotNetVersions(): Boolean;
begin

  // v3.5
  Result := IsDotNET35Detected();
  if not Result then
  begin
    Result := InstallDotNET('v3.5', 'dotnetfx35.exe', 'dotnetfx_v3.5.exe', 'AB99342F-5D1A-413D-8319-81DA479AB0D7');
	end;
end;

function CheckForMWOCX(Rename: Boolean): Boolean;
var
  Names: TArrayOfString;
  I: Integer;
begin
	try
		if RegGetSubkeyNames(HKEY_CLASSES_ROOT, 'CLSID', Names) then
		begin
			for I := 0 to GetArrayLength(Names)-1 do
				UnregisterMapWinGIS(Names[I], Rename);
		end
		else
		begin
			// If user answers no, result is set to false and setup is halted.
			Result := MsgBox('An error has occurred while ensuring that you have no previous versions of MapWinGIS installed.' #13#13 'Please ensure that any old copies are properly uninstalled.' #13#13 'Continue installing anyway?', mbConfirmation, MB_YESNO) = idYes;
		end;
	except
	end;
end;

//Called during Setup's initialization. Return False to abort Setup, True otherwise.
function InitializeSetup(): Boolean;
var
  R1: Boolean;
  NeedToInstallVC: Boolean;
  InstalledSuccesfully: Boolean;
  ResultCode: Integer;
  vcredistFile: string;
begin
  R1 := True;

  // Check for .NET prerequisites
	Result := CheckDotNetVersions();
	if Result then
	begin
		// Check for old MapWinGIS.ocx'es that are registered; unregister them and rename them to .old
		R1 := CheckForMWOCX(true);

		if R1 then
		begin
			// Check for VC++
#ifdef x64BitVersion
			NeedToInstallVC := NeedInstallVC8;
      vcredistFile := 'vcredist_x64_2008.exe';
#else
			NeedToInstallVC := NeedInstallVC8;
      vcredistFile := 'vcredist_x86_2008.exe';
#endif
			if NeedToInstallVC then
			begin
				// Extracts the specified file from the [Files] section to a temporary directory:
				ExtractTemporaryFile(vcredistFile);
				InstalledSuccesfully := Exec(ExpandConstant('{tmp}\' + vcredistFile), '', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
				if not InstalledSuccesfully then
				begin
					MsgBox(ErrorInstallVC + SysErrorMessage(ResultCode), mbCriticalError, MB_OK);
					// Still need to install so stop installation:
					NeedToInstallVC := true;
				end;
			end
      else
      begin
        // Don't needed to install so set installed is true:
        InstalledSuccesfully := True;
      end;
		end;
	end;

  Result := Result And R1 And InstalledSuccesfully;
end;

procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
	if CurUninstallStep = usUninstall then
	begin
		// Check for old MapWinGIS.ocx'es that are registered; unregister them. Don't rename the ocx:
		// Because else the OCX stays shared and won't be deleted:
		CheckForMWOCX(false);
	end;
end;

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

[ISSI]
;; Include ALL languages
#define ISSI_Languages
;#define x64BitVersion

;; Create an About button in the Setup Wizard
#define ISSI_About  "{cm:issiAbout}"
;; Set date-time format and seperator
#define ISSI_Constants "YYMDHMS"
#define ISSI_ConstantsSeperator "."
;; Create a print button on the License page
#define ISSI_LicensePrint
; Add BeveledLabel message (leave empty for default "Inno Setup" value)
#define ISSI_BeveledLabel "MapWindow GIS"
#ifdef x64BitVersion
  #define ISSI_BeveledLabel ISSI_BeveledLabel + " 64 Bit"
#endif
;; Create a link to a web page in the Setup Wizard using multilingual custom messages:
#define ISSI_URL
#define ISSI_UrlText

; Include ISSI
#define ISSI_IncludePath "C:\dev\InstallationProjects\ISSI"
#include ISSI_IncludePath+"\_issi.isi"

#define MyAppName "MapWinGIS"
#define MyAppVersion "4.8.8.0"
#define MyAppPublisher "MapWindow GIS"
#define MyAppURL "http://www.mapwindow.org"
#ifdef x64BitVersion
  #define MyOutputBaseFilename "MapWinGIS-only-v4.8SR-64bit-installer"
#else
  #define MyOutputBaseFilename "MapWinGIS-only-v4.8.8RC1-32bit-installer"
#endif
#define MySourcePath SourcePath

[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={{4DA288CD-C016-4E9E-B9EA-89799F678A06}
PrivilegesRequired=poweruser
MinVersion=,5.1.2600sp1
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
AppCopyright=MapWindow development team
AppContact={#MyAppURL}
AppVerName={#MyAppVersion}
DefaultDirName=C:\dev\{#MyAppName}
DefaultGroupName={#MyAppName}
AllowNoIcons=true
LicenseFile=license.rtf
InfoBeforeFile=MapWindowNotes.rtf
OutputDir=C:\dev\MapWinGIS4Dev\Setup
#ifdef x64BitVersion
  SourceDir=C:\dev\MapWindow4Dev\Bin64
#else
  SourceDir=C:\dev\MapWindow4Dev\Bin
#endif
OutputBaseFilename={#MyOutputBaseFilename}
SetupIconFile=MapWindow.ico
Compression=lzma/Ultra
SolidCompression=true
InternalCompressLevel=Ultra
VersionInfoCompany=MapWindow Open Source Team [www.MapWindow.org]
VersionInfoCopyright=Mozilla Public License (MPL) 1.1
VersionInfoDescription=MapWindow GIS [www.MapWindow.org]
VersionInfoProductName={#MyAppName}
VersionInfoProductVersion={#MyAppVersion}
VersionInfoVersion={#MyAppVersion}
WizardImageFile= {#MySourcePath}WizImage-MW.bmp
WizardSmallImageFile= {#MySourcePath}WizSmallImage-MW.bmp
WizardImageStretch=false

[Languages]

[Files]
;C++ Distributables
#ifdef x64BitVersion
  Source: {#MySourcePath}vcfiles\vcredist_x64_2008.exe; DestDir: {tmp}; Flags: deleteafterinstall 64bit ignoreversion
  Source: msvcr90.dll; DestDir: {sys}; Flags: restartreplace 64bit uninsneveruninstall sharedfile
#else
  Source: {#MySourcePath}vcfiles\vcredist_x86_2008.exe; DestDir: {tmp}; Flags: deleteafterinstall 32bit ignoreversion
  Source: {#MySourcePath}vcfiles\msvcr90.dll; DestDir: {sys}; Flags: restartreplace 32bit uninsneveruninstall sharedfile
  Source: {#MySourcePath}vcfiles\msvcp90.dll; DestDir: {sys}; Flags: restartreplace 32bit uninsneveruninstall sharedfile
#endif

Source: netcdf.dll; DestDir: {app}; Flags: ignoreversion 32bit;
Source: lti_dsdk.dll; DestDir: {app}; Flags: ignoreversion 32bit;
Source: lti_lidar_dsdk.dll; DestDir: {app}; Flags: ignoreversion 32bit;
Source: NCScnet4.dll; DestDir: {app}; Flags: ignoreversion 32bit;
Source: NCSEcw4_RO.dll; DestDir: {app}; Flags: ignoreversion 32bit;
Source: NCSUtil4.dll; DestDir: {app}; Flags: ignoreversion 32bit;
Source: log4net.dll; DestDir: {app}; Flags: ignoreversion 32bit;
Source: tbb.dll; DestDir: {app}; Flags: ignoreversion 32bit;
Source: MapWindowNotes.rtf; DestDir: {app}; Flags: ignoreversion isreadme;
Source: MapWinGIS.ocx; DestDir: {app}; Flags: ignoreversion 32bit;
Source: stdole.dll; DestDir: {app}; Flags: ignoreversion 32bit;
Source: regMapWinGIS.cmd; DestDir: {app}; Flags: ignoreversion 32bit;
Source: SetEnv.exe; DestDir: {app}; Flags: ignoreversion 32bit;

;;Source: gdal18.dll; DestDir: {app}; Flags: ignoreversion 32bit;
;;Source: geos_c.dll; DestDir: {app}; Flags: ignoreversion 32bit;
;;Source: IndexSearching.dll; DestDir: {app}; Flags: ignoreversion 32bit;
;;Source: proj.dll; DestDir: {app}; Flags: ignoreversion 32bit;
;;Source: xerces-c_3.dll; DestDir: {app}; Flags: ignoreversion 32bit;

;; Use a custom cmd file, without notification:
Source: {#MySourcePath}regMapWinGIS.cmd; DestDir: {app}; Flags: ignoreversion
;; GDAL Projection files:
#include SourcePath + '\gdal_data.txt'
#include SourcePath + '\proj_nad.txt'

; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}"

[Run]
;Run some command files:
Filename: {app}\regMapWinGIS.cmd; WorkingDir: {app}; Flags: runhidden

[Dirs]
Name: {app}; Permissions: everyone-modify

[CustomMessages]
en.issiAbout=MapWindow Open Source Team [www.MapWindow.org]
nl.issiAbout=Ga voor Nederlandstalige ondersteuning naar www.mapwindow.nl.
en.issiUrl=http://www.mapwindow.org
nl.issiUrl=http://www.mapwindow.nl
en.issiUrlText={#MyAppName}
nl.issiUrlText=Nederlandse ondersteuning
en.RunSurvey=Take a very brief survey after your first use of MapWindow for a chance to win a T-Shirt?
nl.RunSurvey=Wil je een korte enqute doen nadat je MapWindow voor het eerst hebt gebruikt? Je kunt er een T-Shirt mee winnen
en.FoundPreviousVersion=Detected a previous version of MapWindow! It will be uninstalled
nl.FoundPreviousVersion=Er is een eerdere versie van MapWindow gevonden! Het zal worden gedenstalleerd

[Code]
function MsiQueryProductState(ProductCode: PAnsiChar): Integer;
external 'MsiQueryProductStateA@msi.dll stdcall';

const
  INSTALLLEVEL_MAXIMUM = $ffff;
	INSTALLSTATE_BADCONFIG = -6;
	INSTALLSTATE_INCOMPLETE = -5;
	INSTALLSTATE_SOURCEABSENT = -4;
	INSTALLSTATE_MOREDATA = -3;
	INSTALLSTATE_INVALIDARG = -2;      // An invalid parameter was passed to the function.
	INSTALLSTATE_UNKNOWN = -1;         // The product is neither advertised or installed.
	INSTALLSTATE_BROKEN = 0;
	INSTALLSTATE_ADVERTISED = 1;       // The product is advertised but not installed.
  INSTALLSTATE_ABSENT = 2;           // The product is installed for a different user.
	INSTALLSTATE_LOCAL = 3;
	INSTALLSTATE_SOURCE = 4;
  INSTALLSTATE_DEFAULT = 5;          // The product is installed for the current user.

  //Microsoft Visual C++ 2008 Redistributable - x86 9.0.30729.17: {9A25302D-30C0-39D9-BD6F-21E6EC160475}
const
	VCREDIST_X86 = '{9A25302D-30C0-39D9-BD6F-21E6EC160475}';
	VCREDIST_X64 = '{8220EEFE-38CD-377E-8595-13398D740ACE}';
  ErrorInstallVC = 'Error installing the VC++ redistributables!';

function IsDotNET35Detected(): boolean;
var
  NetSuccess: boolean;
  NetInstall: cardinal;
begin
  NetSuccess := RegQueryDWordValue(HKLM, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5', 'Install', NetInstall);
  Result := NetSuccess and (NetInstall = 1);
#ifdef Debug
  if Result then
		MsgBox('Found DotNET35', mbInformation, MB_OK);
#endif
end;

function IsMsiProductInstalled(const ProductId: string): boolean;
var
	queryResult: Integer;
begin
#ifdef Debug
	MsgBox('Checking for ' + ProductId, mbInformation, MB_OK);
#endif
	queryResult := MsiQueryProductState(ProductId);

#ifdef Debug
		MsgBox('MsiQueryProductState: ' + IntToStr(queryResult), mbInformation, MB_OK);
#endif

	Result := queryResult = INSTALLSTATE_DEFAULT;
end;

function NeedInstallVC8(): Boolean;
begin

  // Check reg key:
#ifdef x64BitVersion
	Result := not IsMsiProductInstalled(VCREDIST_X64);
#else
	Result := not IsMsiProductInstalled(VCREDIST_X86);
#endif

#ifdef Debug
  if Result then
  begin
		MsgBox('Could not find VCREDIST, will install', mbInformation, MB_OK);
	end
	else
	begin
		MsgBox('Found VCREDIST, no need to install', mbInformation, MB_OK);
	end;
#endif
end;

// Checks for a MapWinGIS ocx in the given classID. If it's found, it's unregistered and renamed,
// or, failing renaming, deleted.
procedure UnregisterMapWinGIS(clsname: String; Rename: Boolean);
var
  Path: String;
begin
  try
    if RegQueryStringValue(HKEY_CLASSES_ROOT, 'CLSID\' + clsname + '\InprocServer32', '', Path) then
    begin
      // Successfully read the value
      if Lowercase(ExtractFileName(Path)) = 'mapwingis.ocx' then
			begin
				try
					UnregisterServer(false, Path, false);
#ifdef Debug
					MsgBox('MapWinGIS is unregistered', mbInformation, MB_OK);
#endif
				except
				end;

				if Rename then
				begin
					try
						if not RenameFile(Path, ExtractFilePath(Path) + 'MapWinGIS.ocx.old') then
						begin
							DeleteFile(Path);
						end;
					except
					end;
				end
				else
				begin
					DeleteFile(Path);
				end;
			end;
    end;
  except
  end;
end;

function InstallDotNET(versionDotNET: string; file1: String; file2: String; urlFamilyID: String): Boolean;
var
	ExpectedLocalLocation: String;
	ErrorCode: Integer;
begin
	ExpectedLocalLocation := ExpandConstant('{src}') + '\' + file1;
	if not FileExists(ExpectedLocalLocation) then
		ExpectedLocalLocation := ExpandConstant('{src}') + '\' + file2;

	if FileExists(ExpectedLocalLocation) then
	begin
		ShellExec('open', ExpectedLocalLocation, '', '', SW_SHOW, ewNoWait, ErrorCode);
		Result := MsgBox('Ready to continue MapWindow installation?' #13#13 '(Click Yes after installing .Net Framework ' + versionDotNET + ')', mbConfirmation, MB_YESNO) = idYes;
	end
	else
	begin
		if MsgBox('The .Net Framework ' + versionDotNET + ' is required but was not found.' #13#13 'Open the web page for downloading .Net ' + versionDotNET + ' now?', mbConfirmation, MB_YESNO) = idYes	then
		begin
			ShellExec('open', 'http://www.microsoft.com/downloads/details.aspx?FamilyID=' + urlFamilyID, '', '', SW_SHOW, ewNoWait, ErrorCode)
			Result := MsgBox('Ready to continue MapWindow installation?' #13#13 '(Click Yes after installing .Net Framework ' + versionDotNET + ')', mbConfirmation, MB_YESNO) = idYes;
		end
		else
			Result := MsgBox('.Net ' + versionDotNET + ' Framework is required but was not found.' #13#13 'Continue MapWindow installation?', mbConfirmation, MB_YESNO) = idYes;
	end;
end;

function CheckDotNetVersions(): Boolean;
begin

  // v3.5
  Result := IsDotNET35Detected();
  if not Result then
  begin
    Result := InstallDotNET('v3.5', 'dotnetfx35.exe', 'dotnetfx_v3.5.exe', 'AB99342F-5D1A-413D-8319-81DA479AB0D7');
	end;
end;

function CheckForMWOCX(Rename: Boolean): Boolean;
var
  Names: TArrayOfString;
  I: Integer;
begin
	try
		if RegGetSubkeyNames(HKEY_CLASSES_ROOT, 'CLSID', Names) then
		begin
			for I := 0 to GetArrayLength(Names)-1 do
				UnregisterMapWinGIS(Names[I], Rename);
		end
		else
		begin
			// If user answers no, result is set to false and setup is halted.
			Result := MsgBox('An error has occurred while ensuring that you have no previous versions of MapWinGIS installed.' #13#13 'Please ensure that any old copies are properly uninstalled.' #13#13 'Continue installing anyway?', mbConfirmation, MB_YESNO) = idYes;
		end;
	except
	end;
end;

//Called during Setup's initialization. Return False to abort Setup, True otherwise.
function InitializeSetup(): Boolean;
var
  R1: Boolean;
  NeedToInstallVC: Boolean;
  InstalledSuccesfully: Boolean;
  ResultCode: Integer;
  vcredistFile: string;
begin
  R1 := True;

  // Check for .NET prerequisites
	Result := CheckDotNetVersions();
	if Result then
	begin
		// Check for old MapWinGIS.ocx'es that are registered; unregister them and rename them to .old
		R1 := CheckForMWOCX(true);

		if R1 then
		begin
			// Check for VC++
#ifdef x64BitVersion
			NeedToInstallVC := NeedInstallVC8;
      vcredistFile := 'vcredist_x64_2008.exe';
#else
			NeedToInstallVC := NeedInstallVC8;
      vcredistFile := 'vcredist_x86_2008.exe';
#endif
			if NeedToInstallVC then
			begin
				// Extracts the specified file from the [Files] section to a temporary directory:
				ExtractTemporaryFile(vcredistFile);
				InstalledSuccesfully := Exec(ExpandConstant('{tmp}\' + vcredistFile), '', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
				if not InstalledSuccesfully then
				begin
					MsgBox(ErrorInstallVC + SysErrorMessage(ResultCode), mbCriticalError, MB_OK);
					// Still need to install so stop installation:
					NeedToInstallVC := true;
				end;
			end
      else
      begin
        // Don't needed to install so set installed is true:
        InstalledSuccesfully := True;
      end;
		end;
	end;

  Result := Result And R1 And InstalledSuccesfully;
end;

procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
	if CurUninstallStep = usUninstall then
	begin
		// Check for old MapWinGIS.ocx'es that are registered; unregister them. Don't rename the ocx:
		// Because else the OCX stays shared and won't be deleted:
		CheckForMWOCX(false);
	end;
end;


Added a step to instructions for Windows release.

; Takes the topographica directory and makes a setup.exe out of it, as well
; as setting up file associations, uninstall information, etc.
;
; INSTRUCTIONS
; (1) copy msvcp71.dll & msvcr71.dl from the windows system32 dir (e.g c:\windows\system32\)
;     into the distribution's python_topo\ directory
; (1) adjust the paths marked *** to match those on your system
; (2) for testing, change 'lzma' to 'none' (unless you are really patient)
; (3) choose 'compile' from the 'build' menu
; (4) you should get a setup.exe file in a newly created 'Output' directory at the same level as topographica.iss.
; (5) test setup.exe on another copy of Windows (or lots of other copies...)
; (6) change 'lzma' back to 'none', repeat (3)
; (7) rename the resulting setup.exe to topographica-X.exe, where X is the version number
; (8) upload to sf.net
; (9) update sf.net Windows download page so that the primary file is the new version

[Setup]
AppName=Topographica
AppVerName=Topographica 0.9.6
AppPublisher=Topographica development team
AppPublisherURL=http://www.topographica.org
AppSupportURL=http://www.topographica.org
AppUpdatesURL=http://www.topographica.org
ChangesAssociations=Yes
DefaultDirName={pf}\Topographica
DefaultGroupName=Topographica
; ***
LicenseFile=C:\topographica.exe\topographica-0.9.6\distributions\topographica-0.9.6\COPYING.txt
; ***
InfoBeforeFile=C:\topographica.exe\topographica-0.9.6\distributions\topographica-0.9.6\README.txt
OutputBaseFilename=setup
; set to none when testing or you will be here a long time
Compression=lzma
SolidCompression=yes

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

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

[Files]
; ***
Source: "C:\topographica.exe\topographica-0.9.6\distributions\topographica-0.9.6\python_topo\msvcp71.dll"; DestDir: "{sys}"; Flags: onlyifdoesntexist uninsneveruninstall sharedfile
; ***
Source: "C:\topographica.exe\topographica-0.9.6\distributions\topographica-0.9.6\python_topo\msvcr71.dll"; DestDir: "{sys}"; Flags: onlyifdoesntexist uninsneveruninstall sharedfile
; ***
Source: "C:\topographica.exe\topographica-0.9.6\distributions\topographica-0.9.6\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs

[Icons]
Name: "{group}\Topographica"; Filename: "{app}\topographica.bat"; WorkingDir: "{app}"; Parameters: "-g"; IconFilename: "{app}\topographica.ico"
Name: "{group}\Uninstall Topographica"; Filename: "{uninstallexe}"
Name: "{userdesktop}\Topographica"; Filename: "{app}\topographica.bat"; WorkingDir: "{app}"; Parameters: "-g"; Tasks: desktopicon; IconFilename: "{app}\topographica.ico"

[Code]
// runs BEFORE anything else
function InitializeSetup(): Boolean;
begin
  // if msvcr71.dll and msvcp71.dll are missing, and user isn't admin/power, abort installation
  Result := FileExists(ExpandConstant('{sys}\msvcr71.dll')) AND FileExists(ExpandConstant('{sys}\msvcp71.dll'));
  if Result = False then
    if IsAdminLoggedOn() or IsPowerUserLoggedOn() then
      Result := True

  if Result = False then
    MsgBox('Your system is missing some Windows system files required for Topographica; for these to be added, the installation must be run as a Power User or Administrator.' #13#13 'Please re-run the Topographica installation as a user with sufficient privileges.', mbError, MB_OK);
end;

[Registry]
; add the .ty file type to the registry as TopographicaScript
Root: HKCR; Subkey: ".ty"; ValueType: string; ValueName: ""; ValueData: "TopographicaScript"; Flags: uninsdeletevalue

; TopographicaScript will display as "Topographica Script" to users
Root: HKCR; Subkey: "TopographicaScript"; ValueType: string; ValueName: ""; ValueData: "Topographica Script"; Flags: uninsdeletekey

; a TopographicaScript is associated with the topographica icon
Root: HKCR; Subkey: "TopographicaScript\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\topographica.ico"

; when a TopographicaScript is double clicked etc, this is what gets run
Root: HKCR; Subkey: "TopographicaScript\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\topographica.bat"" -g ""%1"""

; CEBHACKALERT: it would be nice also to associate the icon topographica.ico with topographica.bat, but I don't know
; how to do this.

[Run]
; Run the python script to create 'topographica' python script and topographica.bat
Filename: "{app}\python_topo\python.exe"; Parameters: "setup.py ""{app}"""; WorkingDir: "{app}"; Flags: runhidden

; User gets to choose to run Topographica after installation
Filename: "{app}\topographica.bat"; Parameters: "-g"; Description: "{cm:LaunchProgram,Topographica}"; Flags: shellexec postinstall skipifsilent

[UninstallDelete]
; Files that get created outside this installation script (e.g. by setup.py)
; that we don't want to leave around after uninstallation.
;
; User-created files do not get removed.
; (CEBHACKALERT this includes leaving behind .pyc files.)
; CEBHACKALERT: shouldn't delete any files modified by user.
Type: filesandordirs; Name: "{app}\python_topo"
Type: files; Name: "{app}\topographica"
Type: files; Name: "{app}\topographica.bat"

; Takes the topographica directory and makes a setup.exe out of it, as well
; as setting up file associations, uninstall information, etc.
;
; INSTRUCTIONS
; (1) copy msvcp71.dll & msvcr71.dl from the windows system32 dir (e.g c:\windows\system32\)
;     into the distribution's python_topo\ directory
; (1) adjust the paths marked *** to match those on your system
; (2) for testing, change 'lzma' to 'none' (unless you are really patient)
; (3) choose 'compile' from the 'build' menu
; (4) you should get a setup.exe file in a newly created 'Output' directory at the same level as topographica.iss.
; (5) test setup.exe on another copy of Windows (or lots of other copies...)
; (6) change 'lzma' back to 'none', repeat (3)
; (7) rename the resulting setup.exe to topographica-X.exe, where X is the version number
; (8) upload to sf.net

[Setup]
AppName=Topographica
AppVerName=Topographica 0.9.6
AppPublisher=Topographica development team
AppPublisherURL=http://www.topographica.org
AppSupportURL=http://www.topographica.org
AppUpdatesURL=http://www.topographica.org
ChangesAssociations=Yes
DefaultDirName={pf}\Topographica
DefaultGroupName=Topographica
; ***
LicenseFile=C:\topographica.exe\topographica-0.9.6\distributions\topographica-0.9.6\COPYING.txt
; ***
InfoBeforeFile=C:\topographica.exe\topographica-0.9.6\distributions\topographica-0.9.6\README.txt
OutputBaseFilename=setup
; set to none when testing or you will be here a long time
Compression=lzma
SolidCompression=yes

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

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

[Files]
; ***
Source: "C:\topographica.exe\topographica-0.9.6\distributions\topographica-0.9.6\python_topo\msvcp71.dll"; DestDir: "{sys}"; Flags: onlyifdoesntexist uninsneveruninstall sharedfile
; ***
Source: "C:\topographica.exe\topographica-0.9.6\distributions\topographica-0.9.6\python_topo\msvcr71.dll"; DestDir: "{sys}"; Flags: onlyifdoesntexist uninsneveruninstall sharedfile
; ***
Source: "C:\topographica.exe\topographica-0.9.6\distributions\topographica-0.9.6\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs

[Icons]
Name: "{group}\Topographica"; Filename: "{app}\topographica.bat"; WorkingDir: "{app}"; Parameters: "-g"; IconFilename: "{app}\topographica.ico"
Name: "{group}\Uninstall Topographica"; Filename: "{uninstallexe}"
Name: "{userdesktop}\Topographica"; Filename: "{app}\topographica.bat"; WorkingDir: "{app}"; Parameters: "-g"; Tasks: desktopicon; IconFilename: "{app}\topographica.ico"

[Code]
// runs BEFORE anything else
function InitializeSetup(): Boolean;
begin
  // if msvcr71.dll and msvcp71.dll are missing, and user isn't admin/power, abort installation
  Result := FileExists(ExpandConstant('{sys}\msvcr71.dll')) AND FileExists(ExpandConstant('{sys}\msvcp71.dll'));
  if Result = False then
    if IsAdminLoggedOn() or IsPowerUserLoggedOn() then
      Result := True

  if Result = False then
    MsgBox('Your system is missing some Windows system files required for Topographica; for these to be added, the installation must be run as a Power User or Administrator.' #13#13 'Please re-run the Topographica installation as a user with sufficient privileges.', mbError, MB_OK);
end;

[Registry]
; add the .ty file type to the registry as TopographicaScript
Root: HKCR; Subkey: ".ty"; ValueType: string; ValueName: ""; ValueData: "TopographicaScript"; Flags: uninsdeletevalue

; TopographicaScript will display as "Topographica Script" to users
Root: HKCR; Subkey: "TopographicaScript"; ValueType: string; ValueName: ""; ValueData: "Topographica Script"; Flags: uninsdeletekey

; a TopographicaScript is associated with the topographica icon
Root: HKCR; Subkey: "TopographicaScript\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\topographica.ico"

; when a TopographicaScript is double clicked etc, this is what gets run
Root: HKCR; Subkey: "TopographicaScript\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\topographica.bat"" -g ""%1"""

; CEBHACKALERT: it would be nice also to associate the icon topographica.ico with topographica.bat, but I don't know
; how to do this.

[Run]
; Run the python script to create 'topographica' python script and topographica.bat
Filename: "{app}\python_topo\python.exe"; Parameters: "setup.py ""{app}"""; WorkingDir: "{app}"; Flags: runhidden

; User gets to choose to run Topographica after installation
Filename: "{app}\topographica.bat"; Parameters: "-g"; Description: "{cm:LaunchProgram,Topographica}"; Flags: shellexec postinstall skipifsilent

[UninstallDelete]
; Files that get created outside this installation script (e.g. by setup.py)
; that we don't want to leave around after uninstallation.
;
; User-created files do not get removed.
; (CEBHACKALERT this includes leaving behind .pyc files.)
; CEBHACKALERT: shouldn't delete any files modified by user.
Type: filesandordirs; Name: "{app}\python_topo"
Type: files; Name: "{app}\topographica"
Type: files; Name: "{app}\topographica.bat"


Добавлена новая dll в инсталлятор

Добавлена новая dll в инсталлятор

#include <ISPPBuiltins.iss>
#define AppName "OneScript engine"
#define FSFriendlyName "OneScript"
#define MainExe "TestApp.exe"
#define ArtifactRoot "..\built\tmp"

#define VerMajor
#define VerMinor
#define VerRelease
#define Build

#ifndef Suffix
  #define Suffix "x86"
#endif

#if Suffix == "x64"
  #define Binaries="bin"
#else
  #define Binaries="bin32"
#endif

; duplicates ArtifactsRoot because ISPP can't resolve directives
#expr ParseVersion(ArtifactRoot + "\" + Binaries + "\ScriptEngine.dll",VerMajor,VerMinor,VerRelease,Build)

[Setup]
AppName={#AppName}
AppVersion={#VerMajor}.{#VerMinor}.{#VerRelease}
AppPublisher=1Script Team (Open Source)
DefaultDirName="{pf}\{#FSFriendlyName}"
DefaultGroupName="{#FSFriendlyName}"
OutputBaseFilename="OneScript-{#VerMajor}.{#VerMinor}.{#VerRelease}-{#Suffix}"
DisableProgramGroupPage=yes
UninstallDisplayIcon="{app}\bin\{#MainExe}"
Compression=lzma2
SolidCompression=yes
VersionInfoVersion={#VerMajor}.{#VerMinor}.{#VerRelease}.{#Build}
#if Suffix == "x64"
  ArchitecturesInstallIn64BitMode="x64"
#endif

[InstallDelete]
Type: files; Name: {app}\*.dll
Type: files; Name: {app}\*.exe
Type: files; Name: {app}\*.bat
Type: files; Name: {app}\*.cmd

[Types]
Name: "normal"; Description: "Стандартная установка"
Name: "custom"; Description: "Выборочная установка"; Flags: iscustom

[Components]
Name: "main"; Description: "Основные файлы"; Types: normal custom; Flags: fixed
Name: "isapi"; Description: "Обработчик HTTP-сервисов"; Types: normal custom;
Name: "stdlib"; Description: "Стандартная библиотека скриптов"; Types: normal custom;
Name: "testapp"; Description: "Тестовая консоль (TestApp)";
Name: "docs"; Description: "Документация по свойствам и методам (синтакс-помощник)";

[Files]
Source: "{#ArtifactRoot}\{#Binaries}\oscript.exe"; DestDir: "{app}\bin"; Components: main
Source: "{#ArtifactRoot}\{#Binaries}\ScriptEngine.HostedScript.dll"; DestDir: "{app}\bin"; Components: main
Source: "{#ArtifactRoot}\{#Binaries}\ScriptEngine.dll"; DestDir: "{app}\bin"; Components: main
Source: "{#ArtifactRoot}\{#Binaries}\OneScript.DebugProtocol.dll"; DestDir: "{app}\bin"; Components: main
Source: "{#ArtifactRoot}\{#Binaries}\OneScript.DebugServices.dll"; DestDir: "{app}\bin"; Components: main
Source: "{#ArtifactRoot}\{#Binaries}\OneScript.Language.dll"; DestDir: "{app}\bin"; Components: main
Source: "{#ArtifactRoot}\{#Binaries}\DotNetZip.dll"; DestDir: "{app}\bin"; Components: main
Source: "{#ArtifactRoot}\{#Binaries}\Newtonsoft.Json.dll"; DestDir: "{app}\bin"; Components: main
Source: "{#ArtifactRoot}\{#Binaries}\oscript.cfg"; DestDir: "{app}\bin"; Components: main; Flags: onlyifdoesntexist

Source: "{#ArtifactRoot}\examples\*"; DestDir: "{app}\examples"; Components: main

;isapi
Source: "{#ArtifactRoot}\{#Binaries}\ASPNETHandler.dll"; DestDir: "{app}\bin"; Components: isapi;

; testapp
Source: "{#ArtifactRoot}\{#Binaries}\TestApp.exe"; DestDir: "{app}\bin"; Components: testapp
Source: "{#ArtifactRoot}\{#Binaries}\ICSharpCode.AvalonEdit.dll"; DestDir: "{app}\bin"; Components: testapp

; библиотека
Source: "{#ArtifactRoot}\lib\*"; DestDir: "{app}\lib"; Components: stdlib; Flags: recursesubdirs
Source: "{#ArtifactRoot}\{#Binaries}\*.bat"; DestDir: "{app}\bin"; Components: stdlib

; документация
Source: "{#ArtifactRoot}\doc\*"; DestDir: "{app}\doc"; Components: docs; Flags: recursesubdirs

Source: "dotNetFx40_Full_setup.exe"; DestDir: {tmp}; Flags: deleteafterinstall; Check: not IsRequiredDotNetDetected

[Icons]
Name: "{group}\{#FSFriendlyName}"; Filename: "{app}\bin\{#MainExe}"

[Registry]
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};{app}\bin;"; Check: NeedsAddPath(ExpandConstant('{app}\bin'))

[Run]
Filename: {tmp}\dotNetFx40_Full_setup.exe; Parameters: "/q:a /c:""install /l /q"""; Check: not IsRequiredDotNetDetected; StatusMsg: Microsoft .NET Framework 4.0 is being installed. Please wait..
Filename: "{app}\bin\{#MainExe}"; Description: "Launch application"; Components: testapp; Flags: postinstall nowait skipifsilent unchecked

[Code]

#IFDEF UNICODE
  #DEFINE AW "W"
#ELSE
  #DEFINE AW "A"
#ENDIF
type
  INSTALLSTATE = Longint;
const
  INSTALLSTATE_INVALIDARG = -2;  // An invalid parameter was passed to the function.
  INSTALLSTATE_UNKNOWN = -1;     // The product is neither advertised or installed.
  INSTALLSTATE_ADVERTISED = 1;   // The product is advertised but not installed.
  INSTALLSTATE_ABSENT = 2;       // The product is installed for a different user.
  INSTALLSTATE_DEFAULT = 5;      // The product is installed for the current user.

  // Microsoft Visual C++ 2012 x86 Minimum Runtime - 11.0.61030.0 (Update 4)
  VC_2012_REDIST_MIN_UPD4_X86 = '{BD95A8CD-1D9F-35AD-981A-3E7925026EBB}';
  VC_2012_REDIST_MIN_UPD4_X64 = '{CF2BEA3C-26EA-32F8-AA9B-331F7E34BA97}';
  // Microsoft Visual C++ 2012 x86 Additional Runtime - 11.0.61030.0 (Update 4)
  VC_2012_REDIST_ADD_UPD4_X86 = '{B175520C-86A2-35A7-8619-86DC379688B9}';
  VC_2012_REDIST_ADD_UPD4_X64 = '{37B8F9C7-03FB-3253-8781-2517C99D7C00}';

function NeedsAddPath(Param: string): boolean;
var
  OrigPath: string;
begin
  if not RegQueryStringValue(HKEY_LOCAL_MACHINE,'SYSTEM\CurrentControlSet\Control\Session Manager\Environment', 'Path', OrigPath)
  then begin
    Result := True;
    exit;
  end;
  // look for the path with leading and trailing semicolon
  // Pos() returns 0 if not found
  Result := Pos(';' + UpperCase(Param) + ';', ';' + UpperCase(OrigPath) + ';') = 0;
  if Result = True then
     Result := Pos(';' + UpperCase(Param) + '\;', ';' + UpperCase(OrigPath) + ';') = 0;
end;

function IsDotNetDetected(version: string; service: cardinal): boolean;
// Indicates whether the specified version and service pack of the .NET Framework is installed.
//
// version -- Specify one of these strings for the required .NET Framework version:
//    'v1.1.4322'     .NET Framework 1.1
//    'v2.0.50727'    .NET Framework 2.0
//    'v3.0'          .NET Framework 3.0
//    'v3.5'          .NET Framework 3.5
//    'v4\Client'     .NET Framework 4.0 Client Profile
//    'v4\Full'       .NET Framework 4.0 Full Installation
//    'v4.5'          .NET Framework 4.5
//
// service -- Specify any non-negative integer for the required service pack level:
//    0               No service packs required
//    1, 2, etc.      Service pack 1, 2, etc. required
var
    key: string;
    install, release, serviceCount: cardinal;
    check45, success: boolean;
//var reqNetVer : string;
begin
    // .NET 4.5 installs as update to .NET 4.0 Full
    if version = 'v4.5' then begin
        version := 'v4\Full';
        check45 := true;
    end else
        check45 := false;

    // installation key group for all .NET versions
    key := 'SOFTWARE\Microsoft\NET Framework Setup\NDP\' + version;

    // .NET 3.0 uses value InstallSuccess in subkey Setup
    if Pos('v3.0', version) = 1 then begin
        success := RegQueryDWordValue(HKLM, key + '\Setup', 'InstallSuccess', install);
    end else begin
        success := RegQueryDWordValue(HKLM, key, 'Install', install);
    end;

    // .NET 4.0/4.5 uses value Servicing instead of SP
    if Pos('v4', version) = 1 then begin
        success := success and RegQueryDWordValue(HKLM, key, 'Servicing', serviceCount);
    end else begin
        success := success and RegQueryDWordValue(HKLM, key, 'SP', serviceCount);
    end;

    // .NET 4.5 uses additional value Release
    if check45 then begin
        success := success and RegQueryDWordValue(HKLM, key, 'Release', release);
        success := success and (release >= 378389);
    end;

    result := success and (install = 1) and (serviceCount >= service);
end;

function IsRequiredDotNetDetected(): Boolean;
begin
    result := IsDotNetDetected('v4\Full', 0);
end;

function InitializeSetup(): Boolean;
begin
    if not IsDotNetDetected('v4\Full', 0) then begin
        MsgBox('{#AppName} requires Microsoft .NET Framework 4.0 Client Profile.'#13#13
          'The installer will attempt to install it', mbInformation, MB_OK);
    end;

    result := true;
end;

#include <ISPPBuiltins.iss>
#define AppName "OneScript engine"
#define FSFriendlyName "OneScript"
#define MainExe "TestApp.exe"
#define ArtifactRoot "..\built\tmp"

#define VerMajor
#define VerMinor
#define VerRelease
#define Build

#ifndef Suffix
  #define Suffix "x86"
#endif

#if Suffix == "x64"
  #define Binaries="bin"
#else
  #define Binaries="bin32"
#endif

; duplicates ArtifactsRoot because ISPP can't resolve directives
#expr ParseVersion(ArtifactRoot + "\" + Binaries + "\ScriptEngine.dll",VerMajor,VerMinor,VerRelease,Build)

[Setup]
AppName={#AppName}
AppVersion={#VerMajor}.{#VerMinor}.{#VerRelease}
AppPublisher=1Script Team (Open Source)
DefaultDirName="{pf}\{#FSFriendlyName}"
DefaultGroupName="{#FSFriendlyName}"
OutputBaseFilename="OneScript-{#VerMajor}.{#VerMinor}.{#VerRelease}-{#Suffix}"
DisableProgramGroupPage=yes
UninstallDisplayIcon="{app}\bin\{#MainExe}"
Compression=lzma2
SolidCompression=yes
VersionInfoVersion={#VerMajor}.{#VerMinor}.{#VerRelease}.{#Build}
#if Suffix == "x64"
  ArchitecturesInstallIn64BitMode="x64"
#endif

[InstallDelete]
Type: files; Name: {app}\*.dll
Type: files; Name: {app}\*.exe
Type: files; Name: {app}\*.bat
Type: files; Name: {app}\*.cmd

[Types]
Name: "normal"; Description: "Стандартная установка"
Name: "custom"; Description: "Выборочная установка"; Flags: iscustom

[Components]
Name: "main"; Description: "Основные файлы"; Types: normal custom; Flags: fixed
Name: "isapi"; Description: "Обработчик HTTP-сервисов"; Types: normal custom;
Name: "stdlib"; Description: "Стандартная библиотека скриптов"; Types: normal custom;
Name: "testapp"; Description: "Тестовая консоль (TestApp)";
Name: "docs"; Description: "Документация по свойствам и методам (синтакс-помощник)";

[Files]
Source: "{#ArtifactRoot}\{#Binaries}\oscript.exe"; DestDir: "{app}\bin"; Components: main
Source: "{#ArtifactRoot}\{#Binaries}\ScriptEngine.HostedScript.dll"; DestDir: "{app}\bin"; Components: main
Source: "{#ArtifactRoot}\{#Binaries}\ScriptEngine.dll"; DestDir: "{app}\bin"; Components: main
Source: "{#ArtifactRoot}\{#Binaries}\OneScript.DebugProtocol.dll"; DestDir: "{app}\bin"; Components: main
Source: "{#ArtifactRoot}\{#Binaries}\OneScript.Language.dll"; DestDir: "{app}\bin"; Components: main
Source: "{#ArtifactRoot}\{#Binaries}\DotNetZip.dll"; DestDir: "{app}\bin"; Components: main
Source: "{#ArtifactRoot}\{#Binaries}\Newtonsoft.Json.dll"; DestDir: "{app}\bin"; Components: main
Source: "{#ArtifactRoot}\{#Binaries}\oscript.cfg"; DestDir: "{app}\bin"; Components: main; Flags: onlyifdoesntexist

Source: "{#ArtifactRoot}\examples\*"; DestDir: "{app}\examples"; Components: main

;isapi
Source: "{#ArtifactRoot}\{#Binaries}\ASPNETHandler.dll"; DestDir: "{app}\bin"; Components: isapi;

; testapp
Source: "{#ArtifactRoot}\{#Binaries}\TestApp.exe"; DestDir: "{app}\bin"; Components: testapp
Source: "{#ArtifactRoot}\{#Binaries}\ICSharpCode.AvalonEdit.dll"; DestDir: "{app}\bin"; Components: testapp

; библиотека
Source: "{#ArtifactRoot}\lib\*"; DestDir: "{app}\lib"; Components: stdlib; Flags: recursesubdirs
Source: "{#ArtifactRoot}\{#Binaries}\*.bat"; DestDir: "{app}\bin"; Components: stdlib

; документация
Source: "{#ArtifactRoot}\doc\*"; DestDir: "{app}\doc"; Components: docs; Flags: recursesubdirs

Source: "dotNetFx40_Full_setup.exe"; DestDir: {tmp}; Flags: deleteafterinstall; Check: not IsRequiredDotNetDetected

[Icons]
Name: "{group}\{#FSFriendlyName}"; Filename: "{app}\bin\{#MainExe}"

[Registry]
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};{app}\bin;"; Check: NeedsAddPath(ExpandConstant('{app}\bin'))

[Run]
Filename: {tmp}\dotNetFx40_Full_setup.exe; Parameters: "/q:a /c:""install /l /q"""; Check: not IsRequiredDotNetDetected; StatusMsg: Microsoft .NET Framework 4.0 is being installed. Please wait..
Filename: "{app}\bin\{#MainExe}"; Description: "Launch application"; Components: testapp; Flags: postinstall nowait skipifsilent unchecked

[Code]

#IFDEF UNICODE
  #DEFINE AW "W"
#ELSE
  #DEFINE AW "A"
#ENDIF
type
  INSTALLSTATE = Longint;
const
  INSTALLSTATE_INVALIDARG = -2;  // An invalid parameter was passed to the function.
  INSTALLSTATE_UNKNOWN = -1;     // The product is neither advertised or installed.
  INSTALLSTATE_ADVERTISED = 1;   // The product is advertised but not installed.
  INSTALLSTATE_ABSENT = 2;       // The product is installed for a different user.
  INSTALLSTATE_DEFAULT = 5;      // The product is installed for the current user.

  // Microsoft Visual C++ 2012 x86 Minimum Runtime - 11.0.61030.0 (Update 4)
  VC_2012_REDIST_MIN_UPD4_X86 = '{BD95A8CD-1D9F-35AD-981A-3E7925026EBB}';
  VC_2012_REDIST_MIN_UPD4_X64 = '{CF2BEA3C-26EA-32F8-AA9B-331F7E34BA97}';
  // Microsoft Visual C++ 2012 x86 Additional Runtime - 11.0.61030.0 (Update 4)
  VC_2012_REDIST_ADD_UPD4_X86 = '{B175520C-86A2-35A7-8619-86DC379688B9}';
  VC_2012_REDIST_ADD_UPD4_X64 = '{37B8F9C7-03FB-3253-8781-2517C99D7C00}';

function NeedsAddPath(Param: string): boolean;
var
  OrigPath: string;
begin
  if not RegQueryStringValue(HKEY_LOCAL_MACHINE,'SYSTEM\CurrentControlSet\Control\Session Manager\Environment', 'Path', OrigPath)
  then begin
    Result := True;
    exit;
  end;
  // look for the path with leading and trailing semicolon
  // Pos() returns 0 if not found
  Result := Pos(';' + UpperCase(Param) + ';', ';' + UpperCase(OrigPath) + ';') = 0;
  if Result = True then
     Result := Pos(';' + UpperCase(Param) + '\;', ';' + UpperCase(OrigPath) + ';') = 0;
end;

function IsDotNetDetected(version: string; service: cardinal): boolean;
// Indicates whether the specified version and service pack of the .NET Framework is installed.
//
// version -- Specify one of these strings for the required .NET Framework version:
//    'v1.1.4322'     .NET Framework 1.1
//    'v2.0.50727'    .NET Framework 2.0
//    'v3.0'          .NET Framework 3.0
//    'v3.5'          .NET Framework 3.5
//    'v4\Client'     .NET Framework 4.0 Client Profile
//    'v4\Full'       .NET Framework 4.0 Full Installation
//    'v4.5'          .NET Framework 4.5
//
// service -- Specify any non-negative integer for the required service pack level:
//    0               No service packs required
//    1, 2, etc.      Service pack 1, 2, etc. required
var
    key: string;
    install, release, serviceCount: cardinal;
    check45, success: boolean;
//var reqNetVer : string;
begin
    // .NET 4.5 installs as update to .NET 4.0 Full
    if version = 'v4.5' then begin
        version := 'v4\Full';
        check45 := true;
    end else
        check45 := false;

    // installation key group for all .NET versions
    key := 'SOFTWARE\Microsoft\NET Framework Setup\NDP\' + version;

    // .NET 3.0 uses value InstallSuccess in subkey Setup
    if Pos('v3.0', version) = 1 then begin
        success := RegQueryDWordValue(HKLM, key + '\Setup', 'InstallSuccess', install);
    end else begin
        success := RegQueryDWordValue(HKLM, key, 'Install', install);
    end;

    // .NET 4.0/4.5 uses value Servicing instead of SP
    if Pos('v4', version) = 1 then begin
        success := success and RegQueryDWordValue(HKLM, key, 'Servicing', serviceCount);
    end else begin
        success := success and RegQueryDWordValue(HKLM, key, 'SP', serviceCount);
    end;

    // .NET 4.5 uses additional value Release
    if check45 then begin
        success := success and RegQueryDWordValue(HKLM, key, 'Release', release);
        success := success and (release >= 378389);
    end;

    result := success and (install = 1) and (serviceCount >= service);
end;

function IsRequiredDotNetDetected(): Boolean;
begin
    result := IsDotNetDetected('v4\Full', 0);
end;

function InitializeSetup(): Boolean;
begin
    if not IsDotNetDetected('v4\Full', 0) then begin
        MsgBox('{#AppName} requires Microsoft .NET Framework 4.0 Client Profile.'#13#13
          'The installer will attempt to install it', mbInformation, MB_OK);
    end;

    result := true;
end;


Installer: - Remove cygwin runtime if exists; - Don't ask for Start Menu folder.

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

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

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

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

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

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

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

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

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

[Code]

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

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

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

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

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

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

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

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

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

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

[Code]

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

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


Just changing the text for the VSMenuKiller.exe when installing

; 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={{DE3A8FE7-5918-471A-BF59-84C2C3328CCF}
AppName=AutoTest.Net
AppVersion=1.3.1
AppVerName=AutoTest.Net 1.3.1
AppPublisher=AutoTest.Net
DefaultDirName={pf}\AutoTest.Net
DefaultGroupName=AutoTest.Net
LicenseFile=..\ReleaseBinaries\AutoTest.License.txt
OutputDir=..\ReleaseBinaries\Installer
OutputBaseFilename=AutoTest.Net-v1.3.1
Compression=lzma
SolidCompression=yes
Uninstallable=yes

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

[Files]
Source: "..\ReleaseBinaries\AutoTest.Messages.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\ReleaseBinaries\AutoTest.Core.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\ReleaseBinaries\AutoTest.config"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\ReleaseBinaries\AutoTest.UI.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\ReleaseBinaries\AutoTest.Console.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\ReleaseBinaries\AutoTest.License.txt"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\ReleaseBinaries\AutoTest.WinForms.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\ReleaseBinaries\README"; DestDir: "{app}"; Flags: ignoreversion

Source: "..\ReleaseBinaries\AutoTest.VS.Util.dll"; DestDir: "{app}"; Flags: ignoreversion;
Source: "..\ReleaseBinaries\AutoTest.VSAddin.dll"; DestDir: "{app}"; Flags: ignoreversion;
Source: "..\ReleaseBinaries\AutoTest.VSAddin2008.Addin"; DestDir: "{app}"; Flags: ignoreversion;
Source: "..\ReleaseBinaries\AutoTest.VSAddin2010.Addin"; DestDir: "{app}"; Flags: ignoreversion;
Source: "..\ReleaseBinaries\VSMenuKiller.exe"; DestDir: "{app}"; Flags: ignoreversion;

Source: "..\ReleaseBinaries\Icons\circleFAIL.png"; DestDir: "{app}\Icons"; Flags: ignoreversion
Source: "..\ReleaseBinaries\Icons\circleWAIL.png"; DestDir: "{app}\Icons"; Flags: ignoreversion
Source: "..\ReleaseBinaries\Icons\circleWIN.png"; DestDir: "{app}\Icons"; Flags: ignoreversion

Source: "..\ReleaseBinaries\AutoTest.TestRunner.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\ReleaseBinaries\AutoTest.TestRunner.v4.0.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\ReleaseBinaries\AutoTest.TestRunner.v4.0.exe.config"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\ReleaseBinaries\AutoTest.TestRunner.x86.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\ReleaseBinaries\AutoTest.TestRunner.x86.v4.0.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\ReleaseBinaries\AutoTest.TestRunner.x86.v4.0.exe.config"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\ReleaseBinaries\AutoTest.TestRunners.Shared.dll"; DestDir: "{app}"; Flags: ignoreversion

Source: "..\ReleaseBinaries\TestRunners\NUnit\AutoTest.TestRunners.NUnit.dll"; DestDir: "{app}\TestRunners\NUnit"; Flags: ignoreversion
Source: "..\ReleaseBinaries\TestRunners\NUnit\nunit.core.dll"; DestDir: "{app}\TestRunners\NUnit"; Flags: ignoreversion
Source: "..\ReleaseBinaries\TestRunners\NUnit\nunit.core.interfaces.dll"; DestDir: "{app}\TestRunners\NUnit"; Flags: ignoreversion
Source: "..\ReleaseBinaries\TestRunners\NUnit\nunit.util.dll"; DestDir: "{app}\TestRunners\NUnit"; Flags: ignoreversion

Source: "..\ReleaseBinaries\TestRunners\XUnit\AutoTest.TestRunners.XUnit.dll"; DestDir: "{app}\TestRunners\XUnit"; Flags: ignoreversion
Source: "..\ReleaseBinaries\TestRunners\XUnit\xunit.runner.utility.dll"; DestDir: "{app}\TestRunners\XUnit"; Flags: ignoreversion

Source: "..\ReleaseBinaries\TestRunners\MSTest\AutoTest.TestRunners.MSTest.dll"; DestDir: "{app}\TestRunners\MSTest"; Flags: ignoreversion
Source: "..\ReleaseBinaries\TestRunners\MSTest\celer.Core.dll"; DestDir: "{app}\TestRunners\MSTest"; Flags: ignoreversion

Source: "..\ReleaseBinaries\TestRunners\MSpec\AutoTest.TestRunners.MSpec.dll"; DestDir: "{app}\TestRunners\MSpec"; Flags: ignoreversion
Source: "..\ReleaseBinaries\TestRunners\MSpec\Machine.Specifications.dll"; DestDir: "{app}\TestRunners\MSpec"; Flags: ignoreversion

Source: "..\ReleaseBinaries\TestRunners\MSpec4\AutoTest.TestRunners.MSpec4.dll"; DestDir: "{app}\TestRunners\MSpec4"; Flags: ignoreversion
Source: "..\ReleaseBinaries\TestRunners\MSpec4\Machine.Specifications.dll"; DestDir: "{app}\TestRunners\MSpec4"; Flags: ignoreversion

Source: "..\ReleaseBinaries\TestRunners\MbUnit\AutoTest.TestRunners.MbUnit.dll"; DestDir: "{app}\TestRunners\MbUnit"; Flags: ignoreversion
Source: "..\ReleaseBinaries\TestRunners\MbUnit\Gallio.dll"; DestDir: "{app}\TestRunners\MbUnit"; Flags: ignoreversion
Source: "..\ReleaseBinaries\TestRunners\MbUnit\Gallio.XmlSerializers.dll"; DestDir: "{app}\TestRunners\MbUnit"; Flags: ignoreversion
Source: "..\ReleaseBinaries\TestRunners\MbUnit\mbunit.config"; DestDir: "{app}\TestRunners\MbUnit"; Flags: ignoreversion

Source: "..\ReleaseBinaries\Castle.Core.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\ReleaseBinaries\Castle.Facilities.Logging.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\ReleaseBinaries\Castle.license.txt"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\ReleaseBinaries\Castle.Windsor.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\ReleaseBinaries\Mono.Cecil.dll"; DestDir: "{app}"; Flags: ignoreversion

Source: "..\src\AutoTest.Core\AutoTest.config.template.VS"; DestDir: "{app}"; Flags: ignoreversion

; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\{cm:UninstallProgram,AutoTest.Net}"; Filename: "{uninstallexe}"

[Registry]
Root: HKLM; Subkey: "SOFTWARE\Microsoft\VisualStudio\10.0"; ValueType: string; ValueName: ""; ValueData: "AutomationOptions";
Root: HKLM; Subkey: "SOFTWARE\Microsoft\VisualStudio\10.0\AutomationOptions"; ValueType: string; ValueName: ""; ValueData: "LookInFolders";
Root: HKLM; Subkey: "SOFTWARE\Microsoft\VisualStudio\10.0\AutomationOptions\LookInFolders"; ValueType: string; ValueName: "{app}"; ValueData: ""; Flags: uninsdeletevalue
Root: HKLM; Subkey: "SOFTWARE\Microsoft\VisualStudio\9.0"; ValueType: string; ValueName: ""; ValueData: "AutomationOptions";
Root: HKLM; Subkey: "SOFTWARE\Microsoft\VisualStudio\9.0\AutomationOptions"; ValueType: string; ValueName: ""; ValueData: "LookInFolders";
Root: HKLM; Subkey: "SOFTWARE\Microsoft\VisualStudio\9.0\AutomationOptions\LookInFolders"; ValueType: string; ValueName: "{app}"; ValueData: ""; Flags: uninsdeletevalue

[Run]
Filename:"{reg:HKLM\SOFTWARE\Microsoft\.NETFramework,InstallRoot}\{reg:HKCR\CLSID\{{61b3e12b-3586-3a58-a497-7ed7c4c794b9%7D\InprocServer32\2.0.0.0,RuntimeVersion}\RegAsm.exe"; Parameters: /codebase AutoTest.VSAddin.dll;WorkingDir: {app}; StatusMsg: "Registeringcontrols ..."; Flags: runhidden;
Filename:"{app}\VSMenuKiller.exe"; Parameters: VisualStudio.DTE.10.0 MenuBar AutoTest.Net;WorkingDir: {app}; StatusMsg: "Installing 2010 addin ..."; Flags: runhidden;
Filename:"{app}\VSMenuKiller.exe"; Parameters: VisualStudio.DTE.9.0 MenuBar AutoTest.Net;WorkingDir: {app}; StatusMsg: "Installing 2008 addin ..."; Flags: runhidden;

[UninstallRun]
Filename:"{app}\VSMenuKiller.exe"; Parameters: VisualStudio.DTE.10.0 MenuBar AutoTest.Net;WorkingDir: {app}; StatusMsg: "Removing 2010 addin ..."; Flags: runhidden;
Filename:"{app}\VSMenuKiller.exe"; Parameters: VisualStudio.DTE.9.0 MenuBar AutoTest.Net;WorkingDir: {app}; StatusMsg: "Removing 2008 addin ..."; Flags: runhidden;
Filename:"{reg:HKLM\SOFTWARE\Microsoft\.NETFramework,InstallRoot}\{reg:HKCR\CLSID\{{61b3e12b-3586-3a58-a497-7ed7c4c794b9%7D\InprocServer32\2.0.0.0,RuntimeVersion}\RegAsm.exe"; Parameters: /unregister AutoTest.VSAddin.dll; WorkingDir: {app}; StatusMsg: "Unregisteringcontrols ..."; Flags: runhidden;

[Code]

; 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={{DE3A8FE7-5918-471A-BF59-84C2C3328CCF}
AppName=AutoTest.Net
AppVersion=1.3.1
AppVerName=AutoTest.Net 1.3.1
AppPublisher=AutoTest.Net
DefaultDirName={pf}\AutoTest.Net
DefaultGroupName=AutoTest.Net
LicenseFile=..\ReleaseBinaries\AutoTest.License.txt
OutputDir=..\ReleaseBinaries\Installer
OutputBaseFilename=AutoTest.Net-v1.3.1
Compression=lzma
SolidCompression=yes
Uninstallable=yes

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

[Files]
Source: "..\ReleaseBinaries\AutoTest.Messages.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\ReleaseBinaries\AutoTest.Core.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\ReleaseBinaries\AutoTest.config"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\ReleaseBinaries\AutoTest.UI.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\ReleaseBinaries\AutoTest.Console.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\ReleaseBinaries\AutoTest.License.txt"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\ReleaseBinaries\AutoTest.WinForms.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\ReleaseBinaries\README"; DestDir: "{app}"; Flags: ignoreversion

Source: "..\ReleaseBinaries\AutoTest.VS.Util.dll"; DestDir: "{app}"; Flags: ignoreversion;
Source: "..\ReleaseBinaries\AutoTest.VSAddin.dll"; DestDir: "{app}"; Flags: ignoreversion;
Source: "..\ReleaseBinaries\AutoTest.VSAddin2008.Addin"; DestDir: "{app}"; Flags: ignoreversion;
Source: "..\ReleaseBinaries\AutoTest.VSAddin2010.Addin"; DestDir: "{app}"; Flags: ignoreversion;
Source: "..\ReleaseBinaries\VSMenuKiller.exe"; DestDir: "{app}"; Flags: ignoreversion;

Source: "..\ReleaseBinaries\Icons\circleFAIL.png"; DestDir: "{app}\Icons"; Flags: ignoreversion
Source: "..\ReleaseBinaries\Icons\circleWAIL.png"; DestDir: "{app}\Icons"; Flags: ignoreversion
Source: "..\ReleaseBinaries\Icons\circleWIN.png"; DestDir: "{app}\Icons"; Flags: ignoreversion

Source: "..\ReleaseBinaries\AutoTest.TestRunner.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\ReleaseBinaries\AutoTest.TestRunner.v4.0.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\ReleaseBinaries\AutoTest.TestRunner.v4.0.exe.config"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\ReleaseBinaries\AutoTest.TestRunner.x86.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\ReleaseBinaries\AutoTest.TestRunner.x86.v4.0.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\ReleaseBinaries\AutoTest.TestRunner.x86.v4.0.exe.config"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\ReleaseBinaries\AutoTest.TestRunners.Shared.dll"; DestDir: "{app}"; Flags: ignoreversion

Source: "..\ReleaseBinaries\TestRunners\NUnit\AutoTest.TestRunners.NUnit.dll"; DestDir: "{app}\TestRunners\NUnit"; Flags: ignoreversion
Source: "..\ReleaseBinaries\TestRunners\NUnit\nunit.core.dll"; DestDir: "{app}\TestRunners\NUnit"; Flags: ignoreversion
Source: "..\ReleaseBinaries\TestRunners\NUnit\nunit.core.interfaces.dll"; DestDir: "{app}\TestRunners\NUnit"; Flags: ignoreversion
Source: "..\ReleaseBinaries\TestRunners\NUnit\nunit.util.dll"; DestDir: "{app}\TestRunners\NUnit"; Flags: ignoreversion

Source: "..\ReleaseBinaries\TestRunners\XUnit\AutoTest.TestRunners.XUnit.dll"; DestDir: "{app}\TestRunners\XUnit"; Flags: ignoreversion
Source: "..\ReleaseBinaries\TestRunners\XUnit\xunit.runner.utility.dll"; DestDir: "{app}\TestRunners\XUnit"; Flags: ignoreversion

Source: "..\ReleaseBinaries\TestRunners\MSTest\AutoTest.TestRunners.MSTest.dll"; DestDir: "{app}\TestRunners\MSTest"; Flags: ignoreversion
Source: "..\ReleaseBinaries\TestRunners\MSTest\celer.Core.dll"; DestDir: "{app}\TestRunners\MSTest"; Flags: ignoreversion

Source: "..\ReleaseBinaries\TestRunners\MSpec\AutoTest.TestRunners.MSpec.dll"; DestDir: "{app}\TestRunners\MSpec"; Flags: ignoreversion
Source: "..\ReleaseBinaries\TestRunners\MSpec\Machine.Specifications.dll"; DestDir: "{app}\TestRunners\MSpec"; Flags: ignoreversion

Source: "..\ReleaseBinaries\TestRunners\MSpec4\AutoTest.TestRunners.MSpec4.dll"; DestDir: "{app}\TestRunners\MSpec4"; Flags: ignoreversion
Source: "..\ReleaseBinaries\TestRunners\MSpec4\Machine.Specifications.dll"; DestDir: "{app}\TestRunners\MSpec4"; Flags: ignoreversion

Source: "..\ReleaseBinaries\TestRunners\MbUnit\AutoTest.TestRunners.MbUnit.dll"; DestDir: "{app}\TestRunners\MbUnit"; Flags: ignoreversion
Source: "..\ReleaseBinaries\TestRunners\MbUnit\Gallio.dll"; DestDir: "{app}\TestRunners\MbUnit"; Flags: ignoreversion
Source: "..\ReleaseBinaries\TestRunners\MbUnit\Gallio.XmlSerializers.dll"; DestDir: "{app}\TestRunners\MbUnit"; Flags: ignoreversion
Source: "..\ReleaseBinaries\TestRunners\MbUnit\mbunit.config"; DestDir: "{app}\TestRunners\MbUnit"; Flags: ignoreversion

Source: "..\ReleaseBinaries\Castle.Core.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\ReleaseBinaries\Castle.Facilities.Logging.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\ReleaseBinaries\Castle.license.txt"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\ReleaseBinaries\Castle.Windsor.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\ReleaseBinaries\Mono.Cecil.dll"; DestDir: "{app}"; Flags: ignoreversion

Source: "..\src\AutoTest.Core\AutoTest.config.template.VS"; DestDir: "{app}"; Flags: ignoreversion

; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\{cm:UninstallProgram,AutoTest.Net}"; Filename: "{uninstallexe}"

[Registry]
Root: HKLM; Subkey: "SOFTWARE\Microsoft\VisualStudio\10.0"; ValueType: string; ValueName: ""; ValueData: "AutomationOptions";
Root: HKLM; Subkey: "SOFTWARE\Microsoft\VisualStudio\10.0\AutomationOptions"; ValueType: string; ValueName: ""; ValueData: "LookInFolders";
Root: HKLM; Subkey: "SOFTWARE\Microsoft\VisualStudio\10.0\AutomationOptions\LookInFolders"; ValueType: string; ValueName: "{app}"; ValueData: ""; Flags: uninsdeletevalue
Root: HKLM; Subkey: "SOFTWARE\Microsoft\VisualStudio\9.0"; ValueType: string; ValueName: ""; ValueData: "AutomationOptions";
Root: HKLM; Subkey: "SOFTWARE\Microsoft\VisualStudio\9.0\AutomationOptions"; ValueType: string; ValueName: ""; ValueData: "LookInFolders";
Root: HKLM; Subkey: "SOFTWARE\Microsoft\VisualStudio\9.0\AutomationOptions\LookInFolders"; ValueType: string; ValueName: "{app}"; ValueData: ""; Flags: uninsdeletevalue

[Run]
Filename:"{reg:HKLM\SOFTWARE\Microsoft\.NETFramework,InstallRoot}\{reg:HKCR\CLSID\{{61b3e12b-3586-3a58-a497-7ed7c4c794b9%7D\InprocServer32\2.0.0.0,RuntimeVersion}\RegAsm.exe"; Parameters: /codebase AutoTest.VSAddin.dll;WorkingDir: {app}; StatusMsg: "Registeringcontrols ..."; Flags: runhidden;
Filename:"{app}\VSMenuKiller.exe"; Parameters: VisualStudio.DTE.10.0 MenuBar AutoTest.Net;WorkingDir: {app}; StatusMsg: "Removing 2010 addin ..."; Flags: runhidden;
Filename:"{app}\VSMenuKiller.exe"; Parameters: VisualStudio.DTE.9.0 MenuBar AutoTest.Net;WorkingDir: {app}; StatusMsg: "Removing 2008 addin ..."; Flags: runhidden;

[UninstallRun]
Filename:"{app}\VSMenuKiller.exe"; Parameters: VisualStudio.DTE.10.0 MenuBar AutoTest.Net;WorkingDir: {app}; StatusMsg: "Removing 2010 addin ..."; Flags: runhidden;
Filename:"{app}\VSMenuKiller.exe"; Parameters: VisualStudio.DTE.9.0 MenuBar AutoTest.Net;WorkingDir: {app}; StatusMsg: "Removing 2008 addin ..."; Flags: runhidden;
Filename:"{reg:HKLM\SOFTWARE\Microsoft\.NETFramework,InstallRoot}\{reg:HKCR\CLSID\{{61b3e12b-3586-3a58-a497-7ed7c4c794b9%7D\InprocServer32\2.0.0.0,RuntimeVersion}\RegAsm.exe"; Parameters: /unregister AutoTest.VSAddin.dll; WorkingDir: {app}; StatusMsg: "Unregisteringcontrols ..."; Flags: runhidden;

[Code]


change file association: still need update the generator according to this file

; Script generated by the Inno Setup Script Wizard

; and local_config.py located in this directory.
 ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
[Setup]

ChangesAssociations=yes
AppName=SansView
AppVerName=SansView-1.9.2dev_JUN
AppPublisher=(c) 2009, University of Tennessee
AppPublisherURL=http://danse.chem.utk.edu
AppSupportURL=http://danse.chem.utk.edu
AppUpdatesURL=http://danse.chem.utk.edu
ChangesEnvironment=true
DefaultDirName={pf}\SansView-Dev
DefaultGroupName=DANSE\SansView-1.9.2dev_JUN
DisableProgramGroupPage=yes
LicenseFile=license.txt
OutputBaseFilename=setupSansView
SetupIconFile=images\ball.ico
Compression=lzma
SolidCompression=yes
PrivilegesRequired=none

[Registry]
Root: HKCR;	Subkey: ".txt\openwithlist\SansView.exe"; Flags: uninsdeletekey noerror
Root: HKCR;	Subkey: ".xml\openwithlist\SansView.exe"; Flags: uninsdeletekey noerror
Root: HKCR;	Subkey: ".tif\openwithlist\SansView.exe"; Flags: uninsdeletekey noerror
Root: HKCR;	Subkey: ".tiff\openwithlist\SansView.exe"; Flags: uninsdeletekey noerror
Root: HKCR;	Subkey: ".asc\openwithlist\SansView.exe"; Flags: uninsdeletekey noerror
Root: HKCR;	Subkey: ".dat\openwithlist\SansView.exe"; Flags: uninsdeletekey noerror
Root: HKCR;	Subkey: ".sans\openwithlist\SansView.exe"; Flags: uninsdeletekey noerror
Root: HKCR; Subkey: "applications\SansView.exe\shell\open\command";	ValueType: string; ValueName: "";	ValueData: """{app}\SansView.exe""  ""%1""" ; Flags: uninsdeletevalue noerror
Root: HKCU;	Subkey: "Software\Classes\.txt\OpenWithList\SansView.exe"; Flags: uninsdeletekey noerror
Root: HKCU;	Subkey: "Software\Classes\.xml\openwithlist\SansView.exe"; Flags: uninsdeletekey noerror
Root: HKCU;	Subkey: "Software\Classes\.asc\openwithlist\SansView.exe"; Flags: uninsdeletekey noerror
Root: HKCU;	Subkey: "Software\Classes\.dat\openwithlist\SansView.exe"; Flags: uninsdeletekey noerror
Root: HKCU;	Subkey: "Software\Classes\.tif\openwithlist\SansView.exe"; Flags: uninsdeletekey noerror
Root: HKCU;	Subkey: "Software\Classes\.tiff\openwithlist\SansView.exe"; Flags: uninsdeletekey noerror
Root: HKCU;	Subkey: "Software\Classes\.sans\openwithlist\SansView.exe"; Flags: uninsdeletekey noerror
Root: HKCU; Subkey: "Software\Classes\applications\SansView.exe\shell\open\command";	ValueType: string; ValueName: "";	ValueData: """{app}\SansView.exe""  ""%1""" ; Flags: uninsdeletevalue noerror
Root: HKCR;	Subkey: ".svs";	ValueType: string;	ValueName: "";	ValueData: "{app}\SansView.exe";	 Flags: uninsdeletevalue
Root: HKCR;	Subkey: ".fitv"; ValueType: string;	ValueName: "";	ValueData: "{app}\SansView.exe";	 Flags: uninsdeletevalue
Root: HKCR;	Subkey: ".inv";	ValueType: string;	ValueName: "";	ValueData: "{app}\SansView.exe";	 Flags: uninsdeletevalue
Root: HKCR;	Subkey: ".prv";	ValueType: string;	ValueName: "";	ValueData: "{app}\SansView.exe";	 Flags: uninsdeletevalue
Root: HKCR; Subkey: "{app}\SansView.exe"; ValueType: string; ValueName: ""; ValueData: "SansView File"; Flags: uninsdeletekey
Root: HKCR; Subkey: "{app}\SansView.exe\shell\open\command";	ValueType: string; ValueName: "";	ValueData: """{app}\SansView.exe""  ""%1""" ; Flags: uninsdeletevalue noerror
Root: HKCR; Subkey: "{app}\images\ball.ico";	ValueType: string; ValueName: "";	ValueData: "{app}\SansView.exe,0"
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment";	ValueType: expandsz; ValueName: "SANSVIEWPATH";	ValueData: "{app}";	 Flags: uninsdeletevalue
; Write to PATH (below) is disabled; need more work
;Root: HKCU; Subkey: "Environment";	ValueType: expandsz; ValueName: "PATH";	ValueData: "%SANSVIEWPATH%;{olddata}";	 Check: NeedsAddPath()

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

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

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

[Icons]
Name: "{group}\SansView";	Filename: "{app}\SansView.exe";	WorkingDir: "{app}"
Name: "{group}\{cm:UninstallProgram, SansView}";	 Filename: "{uninstallexe}"
Name: "{commondesktop}\SansView";	Filename: "{app}\SansView.exe";	Tasks: desktopicon; WorkingDir: "{app}"
;Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\SansView"; Filename: "{app}\SansView.exe"

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

[Code]
function NeedsAddPath(): boolean;
var
  oldpath: string;
  newpath: string;
  pathArr:    TArrayOfString;
  i:        Integer;
begin
  RegQueryStringValue(HKEY_CURRENT_USER,'Environment','PATH', oldpath)
  oldpath := oldpath + ';';
  newpath := '%SANSVIEWPATH%';
  i := 0;
  while (Pos(';', oldpath) > 0) do begin
    SetArrayLength(pathArr, i+1);
    pathArr[i] := Copy(oldpath, 0, Pos(';', oldpath)-1);
    oldpath := Copy(oldpath, Pos(';', oldpath)+1, Length(oldpath));
    i := i + 1;
    // Check if current directory matches app dir
    if newpath = pathArr[i-1]
    then begin
      Result := False;
      exit;
    end;
  end;
  Result := True;
end;

; Script generated by the Inno Setup Script Wizard

; and local_config.py located in this directory.
 ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
[Setup]

ChangesAssociations=yes
AppName=SansView
AppVerName=SansView-1.9.2dev_JUN
AppPublisher=(c) 2009, University of Tennessee
AppPublisherURL=http://danse.chem.utk.edu
AppSupportURL=http://danse.chem.utk.edu
AppUpdatesURL=http://danse.chem.utk.edu
ChangesEnvironment=true
DefaultDirName={pf}\SansView-Dev
DefaultGroupName=DANSE\SansView-1.9.2dev_JUN
DisableProgramGroupPage=yes
LicenseFile=license.txt
OutputBaseFilename=setupSansView
SetupIconFile=images\ball.ico
Compression=lzma
SolidCompression=yes
PrivilegesRequired=none

[Registry]
Root: HKCR;	Subkey: ".xml";	ValueType: string;	ValueName: "";	ValueData: "{app}\SansView.exe";	 Flags: uninsdeletevalue
Root: HKCR;	Subkey: ".asc";	ValueType: string;	ValueName: "";	ValueData: "{app}\SansView.exe";	 Flags: uninsdeletevalue
Root: HKCR;	Subkey: ".dat";	ValueType: string;	ValueName: "";	ValueData: "{app}\SansView.exe";	 Flags: uninsdeletevalue
Root: HKCR;	Subkey: ".tif";	ValueType: string;	ValueName: "";	ValueData: "{app}\SansView.exe";	 Flags: uninsdeletevalue
Root: HKCR;	Subkey: ".tiff";	ValueType: string;	ValueName: "";	ValueData: "{app}\SansView.exe";	 Flags: uninsdeletevalue
Root: HKCR;	Subkey: ".sans";	ValueType: string;	ValueName: "";	ValueData: "{app}\SansView.exe";	 Flags: uninsdeletevalue
Root: HKCR;	Subkey: ".svs";	ValueType: string;	ValueName: "";	ValueData: "{app}\SansView.exe";	 Flags: uninsdeletevalue
Root: HKCR;	Subkey: ".fitv";	ValueType: string;	ValueName: "";	ValueData: "{app}\SansView.exe";	 Flags: uninsdeletevalue
Root: HKCR;	Subkey: ".inv";	ValueType: string;	ValueName: "";	ValueData: "{app}\SansView.exe";	 Flags: uninsdeletevalue
Root: HKCR;	Subkey: ".prv";	ValueType: string;	ValueName: "";	ValueData: "{app}\SansView.exe";	 Flags: uninsdeletevalue
Root: HKCR; Subkey: "{app}\images\ball.ico";	ValueType: string; ValueName: "";	ValueData: "{app}\SansView.exe,0"
Root: HKCR; Subkey: "{app}\SansView.exe\shell\open\command";	ValueType: string; ValueName: "";	ValueData: """{app}\SansView.exe""  ""%1"""
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment";	ValueType: expandsz; ValueName: "SANSVIEWPATH";	ValueData: "{app}";	 Flags: uninsdeletevalue
; Write to PATH (below) is disabled; need more work
;Root: HKCU; Subkey: "Environment";	ValueType: expandsz; ValueName: "PATH";	ValueData: "%SANSVIEWPATH%;{olddata}";	 Check: NeedsAddPath()

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

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

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

[Icons]
Name: "{group}\SansView";	Filename: "{app}\SansView.exe";	WorkingDir: "{app}"
Name: "{group}\{cm:UninstallProgram, SansView}";	 Filename: "{uninstallexe}"
Name: "{commondesktop}\SansView-1.9.2dev_JUN";	Filename: "{app}\SansView.exe";	Tasks: desktopicon; WorkingDir: "{app}"

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

[Code]
function NeedsAddPath(): boolean;
var
  oldpath: string;
  newpath: string;
  pathArr:    TArrayOfString;
  i:        Integer;
begin
  RegQueryStringValue(HKEY_CURRENT_USER,'Environment','PATH', oldpath)
  oldpath := oldpath + ';';
  newpath := '%SANSVIEWPATH%';
  i := 0;
  while (Pos(';', oldpath) > 0) do begin
    SetArrayLength(pathArr, i+1);
    pathArr[i] := Copy(oldpath, 0, Pos(';', oldpath)-1);
    oldpath := Copy(oldpath, Pos(';', oldpath)+1, Length(oldpath));
    i := i + 1;
    // Check if current directory matches app dir
    if newpath = pathArr[i-1]
    then begin
      Result := False;
      exit;
    end;
  end;
  Result := True;
end;