|
| 1 | +;=========================================================================== |
| 2 | +;DVInstaller.iss |
| 3 | +;---------------------------------------------------------------------------- |
| 4 | +;Copyright (C) 2023 Intel Corporation |
| 5 | +;SPDX-License-Identifier: MIT |
| 6 | +;--------------------------------------------------------------------------*/ |
| 7 | + |
| 8 | +[Setup] |
| 9 | +; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications. |
| 10 | +; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) |
| 11 | +AppId={{769FF432-2F41-473A-B54D-183036E27F01} |
| 12 | +AppName=ZeroCopy |
| 13 | +AppVersion=1.0 |
| 14 | +AppPublisher=intel |
| 15 | +CreateAppDir=no |
| 16 | +AppPublisherURL="https://www.intel.com/ |
| 17 | +LicenseFile=EULA.txt |
| 18 | +OutputBaseFilename=ZeroCopyInstaller |
| 19 | +Compression=lzma |
| 20 | +SolidCompression=yes |
| 21 | +WizardStyle=modern |
| 22 | +AlwaysRestart=yes |
| 23 | +
|
| 24 | +Uninstallable=yes |
| 25 | +CreateUninstallRegKey=yes |
| 26 | +
|
| 27 | +UninstallFilesDir={app} |
| 28 | +
|
| 29 | +ArchitecturesAllowed=x64 |
| 30 | +ArchitecturesInstallIn64BitMode=x64 |
| 31 | +
|
| 32 | +;TO-DO list |
| 33 | +MissingRunOnceIdsWarning=no |
| 34 | +[Languages] |
| 35 | +Name: "english"; MessagesFile: "compiler:Default.isl" |
| 36 | +
|
| 37 | +[Files] |
| 38 | +
|
| 39 | +Source: "{#DvServer}\DVServer.cer"; DestDir: "{tmp}"; Flags: skipifsourcedoesntexist deleteafterinstall |
| 40 | +Source: "{#DvServer}\DVServerKMD.cer"; DestDir: "{tmp}"; Flags: skipifsourcedoesntexist deleteafterinstall |
| 41 | +Source: "{#DvServer}\DVEnabler.dll"; DestDir: "{tmp}"; Flags: deleteafterinstall |
| 42 | +Source: "{#DvServerUMD}\dvserver.cat"; DestDir: "{tmp}"; Flags: deleteafterinstall |
| 43 | +Source: "{#DvServerUMD}\DVServer.dll"; DestDir: "{tmp}"; Flags: deleteafterinstall |
| 44 | +Source: "{#DvServerUMD}\DVServer.inf"; DestDir: "{tmp}"; Flags: deleteafterinstall |
| 45 | +Source: "{#DvServerKMD}\dvserverkmd.cat"; DestDir: "{tmp}"; Flags: deleteafterinstall |
| 46 | +Source: "{#DvServerKMD}\DVServerKMD.inf"; DestDir: "{tmp}"; Flags: deleteafterinstall |
| 47 | +Source: "{#DvServerKMD}\DVServerKMD.sys"; DestDir: "{tmp}"; Flags: deleteafterinstall |
| 48 | +Source: "{#DvInstaller}\DVInstaller.exe"; DestDir: "{app}\DV"; Flags: uninsneveruninstall |
| 49 | +Source: "{#DvInstaller}\DVInstaller.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall |
| 50 | +Source: "{#DvInstallerlib}\DVInstallerLib.dll"; DestDir: "{tmp}"; Flags: dontcopy |
| 51 | +
|
| 52 | +[Run] |
| 53 | +
|
| 54 | +Filename: "{tmp}\DVInstaller.exe"; Parameters:{code:GetInstallParameter}; Flags:shellexec runasoriginaluser waituntilterminated; AfterInstall: DeleteTempFilesRestart |
| 55 | +
|
| 56 | +[UninstallRun] |
| 57 | +Filename: "{app}\DV\DVInstaller.exe"; Parameters:{code:GetUninstallParameter1}; Flags:shellexec waituntilterminated; |
| 58 | +[UninstallDelete] |
| 59 | +Type: filesandordirs; Name: "{app}\DV" |
| 60 | +
|
| 61 | +[Code] |
| 62 | +var |
| 63 | +pageOption : TInputOptionWizardPage; |
| 64 | +Installoption: Integer; |
| 65 | +InstalledVersion: Integer; |
| 66 | +ForceClose: Boolean; |
| 67 | +
|
| 68 | +
|
| 69 | +function GetSourceDir(Param: String): String; |
| 70 | +begin |
| 71 | + Result := ExpandConstant('{Param:dynamicfile}'); |
| 72 | +end; |
| 73 | +
|
| 74 | +function GetInstallParameter(Default:String): String; |
| 75 | +var |
| 76 | +cmdline: String; |
| 77 | +begin |
| 78 | + cmdline := '1'; |
| 79 | + if Installoption = 3 then |
| 80 | + cmdline := '3'; |
| 81 | + if Installoption = 4 then |
| 82 | + cmdline := '4'; |
| 83 | + Result := cmdline; |
| 84 | +end; |
| 85 | +
|
| 86 | +function GetUninstallParameter1(Default:String): String; |
| 87 | +var |
| 88 | +cmdline: String; |
| 89 | +begin |
| 90 | + cmdline := '2'; |
| 91 | + |
| 92 | + Result := cmdline; |
| 93 | +end; |
| 94 | +procedure DeleteTempFiles; |
| 95 | +begin |
| 96 | + DelTree(ExpandConstant('{tmp}'), True, True, True) |
| 97 | +end; |
| 98 | +
|
| 99 | +procedure DeleteTempFilesRestart; |
| 100 | +begin |
| 101 | + DeleteTempFiles |
| 102 | +end; |
| 103 | +
|
| 104 | +Procedure CreateScript; |
| 105 | +var |
| 106 | + BatchScriptPath: String; |
| 107 | + BatchScript: TStringList; |
| 108 | + begin |
| 109 | + BatchScriptpath := ExpandConstant('{tmp}\RunMainExe.bat'); |
| 110 | + BatchScript := TstringList.Create; |
| 111 | + BatchScript.Add(ExpandConstant('"{tmp}\integrateexe.exe"')); |
| 112 | + BatchScript.Add('if errorlevel 0 goto :DeleteTempFiles'); |
| 113 | + BatchScript.Add('goto :End'); |
| 114 | + BatchScript.Add(':DeleteTempFiles'); |
| 115 | + BatchScript.Add(ExpandConstant(' rmdir /s /q "{tmp}"')); |
| 116 | + BatchScript.Add(':End'); |
| 117 | + BatchScript.SaveToFile(BatchScriptpath) |
| 118 | + BatchScript.Free |
| 119 | + end; |
| 120 | +
|
| 121 | + function InitializeSetup: Boolean; |
| 122 | + begin |
| 123 | + CreateScript; |
| 124 | + Result :=True |
| 125 | + end; |
| 126 | + |
| 127 | +
|
| 128 | +function GetStringfromRegister(var major,minor,patch,build: Integer): Integer; |
| 129 | +external 'GetStringfromRegister@files:DVInstallerLib.dll cdecl'; |
| 130 | +
|
| 131 | +function UninstallNeedRestart(): Boolean; |
| 132 | +begin |
| 133 | + Result := True; |
| 134 | +end; |
| 135 | +
|
| 136 | +
|
| 137 | +procedure InitializeWizard(); |
| 138 | +var |
| 139 | +
|
| 140 | + major,minor,patch,build: Integer; |
| 141 | + VersionString: String; |
| 142 | + InstalledDriverVersion: String; |
| 143 | + |
| 144 | +begin |
| 145 | + InstalledVersion :=0; |
| 146 | + InstalledVersion := GetStringfromRegister(major,minor,patch,build); |
| 147 | + VersionString := Format('%d.%d.%d.%d ',[major,minor,patch,build]); |
| 148 | + Installoption := 1; |
| 149 | + if InstalledVersion = 1 then |
| 150 | + begin |
| 151 | + pageOption := CreateInputOptionPage( |
| 152 | + wpLicense, |
| 153 | + 'Driver installed Page', |
| 154 | + 'Select an option', |
| 155 | + VersionString + 'is installed please choose for clean install', |
| 156 | + True, False |
| 157 | + ); |
| 158 | + pageOption.Add('update'); |
| 159 | + pageOption.Add('uninstall'); |
| 160 | + InstalledDriverVersion := VersionString; |
| 161 | + end; |
| 162 | +end; |
| 163 | +
|
| 164 | +
|
| 165 | +function GetUninstallExe(): String; |
| 166 | +var |
| 167 | + unInstExePath: String; |
| 168 | + unInstallExeString: String; |
| 169 | +begin |
| 170 | + unInstExePath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting("AppId")}_is1'); |
| 171 | + unInstallExeString := ''; |
| 172 | + if not RegQueryStringValue(HKLM, unInstExePath, 'UninstallString', unInstallExeString) then |
| 173 | + RegQueryStringValue(HKCU, unInstExePath, 'UninstallString', unInstallExeString); |
| 174 | + Result := unInstallExeString; |
| 175 | +end; |
| 176 | +
|
| 177 | +procedure CancelButtonClick(CurPageID: Integer; var Cancel, Confirm: Boolean); |
| 178 | +begin |
| 179 | + Confirm:= not ForceClose; |
| 180 | +end; |
| 181 | +
|
| 182 | +function NextButtonClick(CurPageID: Integer): Boolean; |
| 183 | +var |
| 184 | + unInstallExeString: String; |
| 185 | + iResultCode: Integer; |
| 186 | +begin |
| 187 | + Result:=True; |
| 188 | + if InstalledVersion = 1 then |
| 189 | + if CurPageID = pageOption.ID then |
| 190 | + begin |
| 191 | + if pageOption.Values[0] then |
| 192 | + Installoption := 3; |
| 193 | + if pageOption.Values[1] then |
| 194 | + begin |
| 195 | + unInstallExeString := GetUninstallExe(); |
| 196 | + if unInstallExeString <> '' then |
| 197 | + begin |
| 198 | + unInstallExeString := RemoveQuotes(unInstallExeString); |
| 199 | + if Exec(unInstallExeString, '/SILENT' ,'', SW_HIDE, ewWaitUntilTerminated, iResultCode) then |
| 200 | + begin |
| 201 | + ForceClose:= True; |
| 202 | + WizardForm.Close; |
| 203 | + Installoption := 4; |
| 204 | + end; |
| 205 | + end; |
| 206 | + end; |
| 207 | + end; |
| 208 | +end; |
0 commit comments