1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
|
[Setup]
AppName=.NET 2.0 Test Install
AppVerName=Test
AppVersion=Test Script
AppPublisher=SystemWidgets
MinVersion=0,5.01.2600
DefaultDirName={pf}\SystemWidgets
[Files]
Source: C:\Program Files\ISTool\isxdl.dll; DestDir: {tmp}; Flags: deleteafterinstall
var
dotnetRedistPath: string;
downloadNeeded: boolean;
dotNetNeeded: boolean;
memoDependenciesNeeded: string;
Version: TWindowsVersion;
procedure isxdl_AddFile(URL, Filename: PChar);
external 'isxdl_AddFile@files:isxdl.dll stdcall';
function isxdl_DownloadFiles(hWnd: Integer): Integer;
external 'isxdl_DownloadFiles@files:isxdl.dll stdcall';
function isxdl_SetOption(Option, Value: PChar): Integer;
external 'isxdl_SetOption@files:isxdl.dll stdcall';
const
dotnetRedistURL = 'http://download.microsoft.com/download/5/6/7/567758a3-759e-473e-bf8f-52154438565a/dotnetfx.exe';
//*********************************************************************************
// This is where all starts.
//*********************************************************************************
function InitializeSetup(): Boolean;
begin
Result := true;
dotNetNeeded := false;
GetWindowsVersionEx(Version);
//*********************************************************************************
// Check for the existance of .NET 2.0
//*********************************************************************************
if (not RegKeyExists(HKLM, 'Software\Microsoft\.NETFramework\policy\v2.0')) then
begin
dotNetNeeded := true;
if (not IsAdminLoggedOn()) then
begin
MsgBox('PainlessSVN Professional Beta 1 needs the Microsoft .NET Framework 2.0 to be installed by an Administrator', mbInformation, MB_OK);
Result := false;
end
else
begin
memoDependenciesNeeded := memoDependenciesNeeded + ' .NET Framework 2.0' #13;
dotnetRedistPath := ExpandConstant('{src}\dotnetfx.exe');
if not FileExists(dotnetRedistPath) then
begin
dotnetRedistPath := ExpandConstant('{tmp}\dotnetfx.exe');
if not FileExists(dotnetRedistPath) then
begin
isxdl_AddFile(dotnetRedistURL, dotnetRedistPath);
downloadNeeded := true;
end
end
SetIniString('install', 'dotnetRedist', dotnetRedistPath, ExpandConstant('{tmp}\dep.ini'));
end
end;
end;
function NextButtonClick(CurPage: Integer): Boolean;
var
hWnd: Integer;
ResultCode: Integer;
ResultXP: boolean;
Result2003: boolean;
begin
Result := true;
ResultXP := true;
Result2003 := true;
//*********************************************************************************
// Only run this at the "Ready To Install" wizard page.
//*********************************************************************************
if CurPage = wpReady then
begin
hWnd := StrToInt(ExpandConstant('{wizardhwnd}'));
// don't try to init isxdl if it's not needed because it will error on < ie 3
//*********************************************************************************
// Download the .NET 2.0 redistribution file.
//*********************************************************************************
if downloadNeeded and (dotNetNeeded = true) then
begin
isxdl_SetOption('label', 'Downloading Microsoft .NET Framework 2.0');
isxdl_SetOption('description', 'This program needs to install the Microsoft .NET Framework 2.0. Please wait while Setup is downloading extra files to your computer.');
if isxdl_DownloadFiles(hWnd) = 0 then Result := false;
end;
//*********************************************************************************
// Run the install file for .NET Framework 2.0. This is usually dotnetfx.exe
//*********************************************************************************
if (dotNetNeeded = true) then
begin
if Exec(ExpandConstant(dotnetRedistPath), '', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
begin
// handle success if necessary; ResultCode contains the exit code
if not (ResultCode = 0) then
begin
Result := false;
end
end
else
begin
// handle failure if necessary; ResultCode contains the error code
Result := false;
end
end;
end;
end;
//*********************************************************************************
// Updates the memo box shown right before the install actuall starts.
//*********************************************************************************
function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
var
s: string;
begin
if memoDependenciesNeeded <> '' then s := s + 'Dependencies that will be automatically downloaded And installed:' + NewLine + memoDependenciesNeeded + NewLine;
s := s + MemoDirInfo + NewLine + NewLine;
Result := s
end; |
Partager