David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 1 | # NSIS Script for creating the Windows Vulkan RT installer. |
| 2 | # |
David Pinedo | 1e368f7 | 2016-02-04 17:04:44 -0700 | [diff] [blame] | 3 | # Copyright (c) 2015-2016 The Khronos Group Inc. |
| 4 | # Copyright (c) 2015-2016 Valve Corporation |
| 5 | # Copyright (c) 2015-2016 LunarG, Inc. |
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 6 | # |
Jon Ashburn | 3ebf125 | 2016-04-19 11:30:31 -0600 | [diff] [blame] | 7 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | # you may not use this file except in compliance with the License. |
| 9 | # You may obtain a copy of the License at |
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 10 | # |
Jon Ashburn | 3ebf125 | 2016-04-19 11:30:31 -0600 | [diff] [blame] | 11 | # http://www.apache.org/licenses/LICENSE-2.0 |
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 12 | # |
Jon Ashburn | 3ebf125 | 2016-04-19 11:30:31 -0600 | [diff] [blame] | 13 | # Unless required by applicable law or agreed to in writing, software |
| 14 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | # See the License for the specific language governing permissions and |
| 17 | # limitations under the License. |
David Pinedo | 1e368f7 | 2016-02-04 17:04:44 -0700 | [diff] [blame] | 18 | # |
| 19 | # Author: David Pinedo <david@LunarG.com> |
| 20 | # Author: Mark Young <mark@LunarG.com> |
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 21 | # |
| 22 | |
| 23 | |
| 24 | # Version information |
David Pinedo | 3bdbe5d | 2016-01-12 16:14:53 -0700 | [diff] [blame] | 25 | # Set VERSION_BUILDNO to: |
David Pinedo | 657bd74 | 2016-05-05 13:52:37 -0600 | [diff] [blame] | 26 | # x.devbuild.z for development builds |
David Pinedo | 3bdbe5d | 2016-01-12 16:14:53 -0700 | [diff] [blame] | 27 | # x for releases |
| 28 | # |
Lenny Komow | bc37ec2 | 2016-11-03 15:43:59 -0600 | [diff] [blame] | 29 | |
| 30 | # Set the default name to "Vulkan", but allow this to be overriden |
| 31 | !ifndef APINAME |
| 32 | !define APINAME "Vulkan" |
Lenny Komow | 307f0e5 | 2016-11-07 15:20:54 -0700 | [diff] [blame] | 33 | !define APILOWER "vulkan" |
Lenny Komow | bc37ec2 | 2016-11-03 15:43:59 -0600 | [diff] [blame] | 34 | !endif |
| 35 | |
Lenny Komow | bc37ec2 | 2016-11-03 15:43:59 -0600 | [diff] [blame] | 36 | !define PRODUCTNAME "${APINAME}RT" |
| 37 | |
Lenny Komow | 841d97a | 2016-08-04 10:32:27 -0600 | [diff] [blame] | 38 | !ifndef HIDE_VERSION |
| 39 | !define VERSION_ABI_MAJOR "1" |
| 40 | !define VERSION_API_MAJOR "1" |
| 41 | !define VERSION_MINOR "0" |
| 42 | !define VERSION_PATCH "12" |
| 43 | !define VERSION_BUILDNO "0.devbuild.1" |
| 44 | !endif |
| 45 | !ifndef HIDE_PUBLISHER |
| 46 | !define PUBLISHER "YourCompany, Inc." |
| 47 | !endif |
David Pinedo | 3bdbe5d | 2016-01-12 16:14:53 -0700 | [diff] [blame] | 48 | #!define VERSION_BUILDNO "0" |
| 49 | !define PRODUCTVERSION "${VERSION_API_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.${VERSION_BUILDNO}" |
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 50 | |
David Pinedo | e8e5203 | 2016-01-06 09:59:58 -0700 | [diff] [blame] | 51 | # Includes |
| 52 | !include LogicLib.nsh |
| 53 | |
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 54 | # This number is determined by doing an install, and then from Windows Explorer, |
| 55 | # doing a "Properties" on the install directory. Add to this the size of the |
| 56 | # files installed to C:\Windows\System32. And then add a little bit more. |
David Pinedo | 94e29b7 | 2016-01-04 16:38:15 -0700 | [diff] [blame] | 57 | # The units are 1K bytes. |
David Pinedo | 261d978 | 2016-02-03 13:38:40 -0700 | [diff] [blame] | 58 | !define ESTIMATEDSIZE "1700" |
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 59 | |
Mark Young | f1bdefc | 2016-01-29 16:09:29 -0700 | [diff] [blame] | 60 | # This is used for the error message if a problem occurs during install. |
| 61 | !define errorMessage1 "Installation of ${PRODUCTNAME} failed!$\r$\n" |
David Pinedo | e80978b | 2016-02-13 14:06:55 -0700 | [diff] [blame] | 62 | !define errorMessage1un "Uninstall of ${PRODUCTNAME} failed!$\r$\n" |
Mark Young | f1bdefc | 2016-01-29 16:09:29 -0700 | [diff] [blame] | 63 | !define errorMessage2 "Uninstalling any installed items and exiting.$\r$\n" |
| 64 | |
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 65 | # Set the icon |
David Pinedo | f79938f | 2016-02-02 16:10:39 -0700 | [diff] [blame] | 66 | !define ICOFILE "V.ico" |
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 67 | Icon ${ICOFILE} |
| 68 | UninstallIcon ${ICOFILE} |
| 69 | WindowIcon off |
| 70 | |
David Pinedo | 5925ba0 | 2016-03-03 21:25:45 -0700 | [diff] [blame] | 71 | # If /DUNINSTALLER was specified, Create the uinstaller |
| 72 | !ifdef UNINSTALLER |
| 73 | !echo "Creating RT uninstaller...." |
| 74 | OutFile "$%TEMP%\tempinstaller.exe" |
| 75 | SetCompress off |
| 76 | !else |
| 77 | !echo "Creating RT installer...." |
| 78 | |
| 79 | # Define name of installer |
Lenny Komow | bc37ec2 | 2016-11-03 15:43:59 -0600 | [diff] [blame] | 80 | OutFile "${PRODUCTNAME}-${PRODUCTVERSION}-Installer.exe" |
David Pinedo | 5925ba0 | 2016-03-03 21:25:45 -0700 | [diff] [blame] | 81 | SetCompressor /SOLID lzma |
| 82 | |
| 83 | !endif |
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 84 | |
| 85 | # Define default installation directory |
Mark Young | 4b8b548 | 2016-01-15 15:09:39 -0700 | [diff] [blame] | 86 | InstallDir "$PROGRAMFILES\${PRODUCTNAME}\${PRODUCTVERSION}" |
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 87 | |
David Pinedo | 32eb2ec | 2016-02-09 09:15:34 -0700 | [diff] [blame] | 88 | # Version string used in file names |
David Pinedo | e8e5203 | 2016-01-06 09:59:58 -0700 | [diff] [blame] | 89 | Var FileVersion |
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 90 | |
David Pinedo | 32eb2ec | 2016-02-09 09:15:34 -0700 | [diff] [blame] | 91 | # Directory RT was installed to. |
| 92 | # The uninstaller can't just use $INSTDIR because it is set to the |
| 93 | # directory the uninstaller exe file is located in. |
David Pinedo | 5925ba0 | 2016-03-03 21:25:45 -0700 | [diff] [blame] | 94 | !ifdef UNINSTALLER |
David Pinedo | 32eb2ec | 2016-02-09 09:15:34 -0700 | [diff] [blame] | 95 | Var IDir |
David Pinedo | 5925ba0 | 2016-03-03 21:25:45 -0700 | [diff] [blame] | 96 | !endif |
David Pinedo | 32eb2ec | 2016-02-09 09:15:34 -0700 | [diff] [blame] | 97 | |
David Pinedo | 9d09277 | 2016-02-09 14:44:05 -0700 | [diff] [blame] | 98 | # Install count |
| 99 | Var IC |
| 100 | |
David Pinedo | e8e5203 | 2016-01-06 09:59:58 -0700 | [diff] [blame] | 101 | ############################################# |
| 102 | # StrRep - string replace |
| 103 | |
| 104 | !define StrRep "!insertmacro StrRep" |
| 105 | !macro StrRep output string old new |
| 106 | Push `${string}` |
| 107 | Push `${old}` |
| 108 | Push `${new}` |
| 109 | !ifdef __UNINSTALL__ |
| 110 | Call un.StrRep |
| 111 | !else |
| 112 | Call StrRep |
| 113 | !endif |
| 114 | Pop ${output} |
| 115 | !macroend |
| 116 | |
| 117 | !macro Func_StrRep un |
| 118 | Function ${un}StrRep |
| 119 | Exch $R2 ;new |
| 120 | Exch 1 |
| 121 | Exch $R1 ;old |
| 122 | Exch 2 |
| 123 | Exch $R0 ;string |
| 124 | Push $R3 |
| 125 | Push $R4 |
| 126 | Push $R5 |
| 127 | Push $R6 |
| 128 | Push $R7 |
| 129 | Push $R8 |
| 130 | Push $R9 |
| 131 | |
| 132 | StrCpy $R3 0 |
| 133 | StrLen $R4 $R1 |
| 134 | StrLen $R6 $R0 |
| 135 | StrLen $R9 $R2 |
| 136 | loop: |
| 137 | StrCpy $R5 $R0 $R4 $R3 |
| 138 | StrCmp $R5 $R1 found |
| 139 | StrCmp $R3 $R6 done |
| 140 | IntOp $R3 $R3 + 1 ;move offset by 1 to check the next character |
| 141 | Goto loop |
| 142 | found: |
| 143 | StrCpy $R5 $R0 $R3 |
| 144 | IntOp $R8 $R3 + $R4 |
| 145 | StrCpy $R7 $R0 "" $R8 |
| 146 | StrCpy $R0 $R5$R2$R7 |
| 147 | StrLen $R6 $R0 |
| 148 | IntOp $R3 $R3 + $R9 ;move offset by length of the replacement string |
| 149 | Goto loop |
| 150 | done: |
| 151 | |
| 152 | Pop $R9 |
| 153 | Pop $R8 |
| 154 | Pop $R7 |
| 155 | Pop $R6 |
| 156 | Pop $R5 |
| 157 | Pop $R4 |
| 158 | Pop $R3 |
| 159 | Push $R0 |
| 160 | Push $R1 |
| 161 | Pop $R0 |
| 162 | Pop $R1 |
| 163 | Pop $R0 |
| 164 | Pop $R2 |
| 165 | Exch $R1 |
| 166 | FunctionEnd |
| 167 | !macroend |
| 168 | !insertmacro Func_StrRep "" |
| 169 | !insertmacro Func_StrRep "un." |
| 170 | |
| 171 | ############################################# |
| 172 | # x64 macros |
| 173 | |
| 174 | !define IsWow64 `"" IsWow64 ""` |
| 175 | !macro _IsWow64 _a _b _t _f |
| 176 | !insertmacro _LOGICLIB_TEMP |
| 177 | System::Call kernel32::GetCurrentProcess()p.s |
| 178 | System::Call kernel32::IsWow64Process(ps,*i0s) |
| 179 | Pop $_LOGICLIB_TEMP |
| 180 | !insertmacro _!= $_LOGICLIB_TEMP 0 `${_t}` `${_f}` |
| 181 | !macroend |
| 182 | |
| 183 | !define RunningX64 `"" RunningX64 ""` |
| 184 | !macro _RunningX64 _a _b _t _f |
| 185 | !if ${NSIS_PTR_SIZE} > 4 |
| 186 | !insertmacro LogicLib_JumpToBranch `${_t}` `${_f}` |
| 187 | !else |
| 188 | !insertmacro _IsWow64 `${_a}` `${_b}` `${_t}` `${_f}` |
| 189 | !endif |
| 190 | !macroend |
| 191 | |
| 192 | !define DisableX64FSRedirection "!insertmacro DisableX64FSRedirection" |
| 193 | !macro DisableX64FSRedirection |
| 194 | System::Call kernel32::Wow64EnableWow64FsRedirection(i0) |
| 195 | !macroend |
| 196 | |
| 197 | !define EnableX64FSRedirection "!insertmacro EnableX64FSRedirection" |
| 198 | !macro EnableX64FSRedirection |
| 199 | System::Call kernel32::Wow64EnableWow64FsRedirection(i1) |
| 200 | !macroend |
| 201 | |
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 202 | |
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 203 | # Need admin to write to C:\Windows\System32 and install dir |
| 204 | RequestExecutionLevel admin |
| 205 | |
Mark Young | f1bdefc | 2016-01-29 16:09:29 -0700 | [diff] [blame] | 206 | Function .onInit |
David Pinedo | 1e368f7 | 2016-02-04 17:04:44 -0700 | [diff] [blame] | 207 | |
David Pinedo | 5925ba0 | 2016-03-03 21:25:45 -0700 | [diff] [blame] | 208 | !ifdef UNINSTALLER |
| 209 | ; Write out the uinstaller and quit |
| 210 | WriteUninstaller "$%TEMP%\Uninstall${PRODUCTNAME}.exe" |
| 211 | Quit |
| 212 | !endif |
| 213 | |
Mark Young | f1bdefc | 2016-01-29 16:09:29 -0700 | [diff] [blame] | 214 | FunctionEnd |
| 215 | |
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 216 | AddBrandingImage left 150 |
| 217 | Caption "${PRODUCTNAME} ${PRODUCTVERSION} Setup" |
| 218 | Name "${PRODUCTNAME} ${PRODUCTVERSION}" |
David Pinedo | 41eb93f | 2016-01-29 12:20:49 -0700 | [diff] [blame] | 219 | LIcenseData "VULKANRT_LICENSE.rtf" |
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 220 | Page custom brandimage "" ": Brand Image" |
David Pinedo | 41eb93f | 2016-01-29 12:20:49 -0700 | [diff] [blame] | 221 | Page license |
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 222 | Page directory |
| 223 | Page instfiles |
| 224 | UninstallCaption "\${PRODUCTNAME} ${PRODUCTVERSION} Uninstall" |
| 225 | UninstallText "This wizard will uninstall ${PRODUCTNAME} ${PRODUCTVERSION} from your computer. Click Uninstall to start the uninstallation." |
| 226 | UninstPage custom un.brandimage "" ": Brand Image" |
| 227 | UninstPage uninstConfirm |
| 228 | UninstPage instFiles |
| 229 | |
David Pinedo | 3797633 | 2016-02-10 16:20:45 -0700 | [diff] [blame] | 230 | # File Properties |
| 231 | VIProductVersion "${PRODUCTVERSION}" |
Lenny Komow | bc37ec2 | 2016-11-03 15:43:59 -0600 | [diff] [blame] | 232 | VIAddVersionKey "ProductName" "${APINAME} Runtime" |
David Pinedo | 3797633 | 2016-02-10 16:20:45 -0700 | [diff] [blame] | 233 | VIAddVersionKey "FileVersion" "${PRODUCTVERSION}" |
| 234 | VIAddVersionKey "ProductVersion" "${PRODUCTVERSION}" |
David Pinedo | 3797633 | 2016-02-10 16:20:45 -0700 | [diff] [blame] | 235 | VIAddVersionKey "LegalCopyright" "" |
| 236 | |
David Pinedo | e1af1b0 | 2016-04-08 16:33:29 -0600 | [diff] [blame] | 237 | !ifdef UNINSTALLER |
Lenny Komow | bc37ec2 | 2016-11-03 15:43:59 -0600 | [diff] [blame] | 238 | VIAddVersionKey "FileDescription" "${APINAME} Runtime Uninstaller" |
David Pinedo | e1af1b0 | 2016-04-08 16:33:29 -0600 | [diff] [blame] | 239 | !else |
Lenny Komow | bc37ec2 | 2016-11-03 15:43:59 -0600 | [diff] [blame] | 240 | VIAddVersionKey "FileDescription" "${APINAME} Runtime Installer" |
David Pinedo | e1af1b0 | 2016-04-08 16:33:29 -0600 | [diff] [blame] | 241 | !endif |
| 242 | |
David Pinedo | 19fc396 | 2016-06-07 09:35:56 -0600 | [diff] [blame] | 243 | |
Lenny Komow | 769b9df | 2016-08-12 13:26:20 -0600 | [diff] [blame] | 244 | # Function to run ConfigureRT program. |
David Pinedo | 19fc396 | 2016-06-07 09:35:56 -0600 | [diff] [blame] | 245 | # Return value is in $0 - 0 is success, all else is failure. |
| 246 | !macro ConfigLayersAndVulkanDLL un |
| 247 | Function ${un}ConfigLayersAndVulkanDLL |
Lenny Komow | 769b9df | 2016-08-12 13:26:20 -0600 | [diff] [blame] | 248 | |
| 249 | # Execute the configuration program |
Lenny Komow | caa3ab8 | 2016-11-04 10:38:39 -0600 | [diff] [blame] | 250 | nsExec::ExecToStack 'ConfigureRT.exe --abi-major ${VERSION_ABI_MAJOR} --api-name ${APINAME}' |
Lenny Komow | 4443fe8 | 2016-08-31 10:41:19 -0600 | [diff] [blame] | 251 | Delete "$TEMP\VulkanRT\configure_rt.log" |
Lenny Komow | 769b9df | 2016-08-12 13:26:20 -0600 | [diff] [blame] | 252 | Rename "configure_rt.log" "$TEMP\VulkanRT\configure_rt.log" |
| 253 | pop $0 |
| 254 | |
| 255 | # Ignore errors. If something went wrong, the return value will indicate it. |
David Pinedo | d1282e5 | 2016-06-10 11:37:44 -0600 | [diff] [blame] | 256 | ClearErrors |
| 257 | |
David Pinedo | 19fc396 | 2016-06-07 09:35:56 -0600 | [diff] [blame] | 258 | FunctionEnd |
| 259 | !macroend |
| 260 | !insertmacro ConfigLayersAndVulkanDLL "" |
| 261 | !insertmacro ConfigLayersAndVulkanDLL "un." |
| 262 | |
| 263 | |
Lenny Komow | 769b9df | 2016-08-12 13:26:20 -0600 | [diff] [blame] | 264 | # Function to run diagnostics if ConfigureRT program failed. |
| 265 | # On entry $0, contains the return value from ConfigureRT.exe. It shouldn't be changed. |
David Pinedo | 19fc396 | 2016-06-07 09:35:56 -0600 | [diff] [blame] | 266 | !macro DiagConfigLayersAndVulkanDLL un |
Lenny Komow | 769b9df | 2016-08-12 13:26:20 -0600 | [diff] [blame] | 267 | Function ${un}DiagConfigLayersAndVulkanDLL |
| 268 | # Report the failure |
| 269 | LogText "ConfigureRT.exe failed with return code $0" |
| 270 | |
David Pinedo | d1282e5 | 2016-06-10 11:37:44 -0600 | [diff] [blame] | 271 | # Ignore errors |
| 272 | ClearErrors |
| 273 | |
David Pinedo | 19fc396 | 2016-06-07 09:35:56 -0600 | [diff] [blame] | 274 | FunctionEnd |
| 275 | !macroend |
| 276 | !insertmacro DiagConfigLayersAndVulkanDLL "" |
| 277 | !insertmacro DiagConfigLayersAndVulkanDLL "un." |
| 278 | |
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 279 | # Start default section |
| 280 | Section |
| 281 | |
David Pinedo | ef68bbe | 2016-03-29 13:46:12 -0600 | [diff] [blame] | 282 | # Turn on logging |
| 283 | LogSet on |
| 284 | |
Mark Young | a8557b8 | 2016-01-15 16:01:46 -0700 | [diff] [blame] | 285 | # If running on a 64-bit OS machine, disable registry re-direct since we're running as a 32-bit executable. |
Mark Young | dd9eca7 | 2016-01-15 14:11:32 -0700 | [diff] [blame] | 286 | ${If} ${RunningX64} |
Mark Young | f1bdefc | 2016-01-29 16:09:29 -0700 | [diff] [blame] | 287 | |
Mark Young | dd9eca7 | 2016-01-15 14:11:32 -0700 | [diff] [blame] | 288 | ${DisableX64FSRedirection} |
| 289 | SetRegView 64 |
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 290 | |
Mark Young | 4b8b548 | 2016-01-15 15:09:39 -0700 | [diff] [blame] | 291 | ${Endif} |
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 292 | |
David Pinedo | 7f44f4f | 2016-03-18 13:15:27 -0600 | [diff] [blame] | 293 | # Create our temp directory, with minimal permissions |
David Pinedo | 19fc396 | 2016-06-07 09:35:56 -0600 | [diff] [blame] | 294 | RmDir /R "$TEMP\VulkanRT" |
| 295 | SetOutPath "$TEMP\VulkanRT" |
| 296 | AccessControl::DisableFileInheritance $TEMP\VulkanRT |
| 297 | AccessControl::SetFileOwner $TEMP\VulkanRT "Administrators" |
| 298 | AccessControl::ClearOnFile $TEMP\VulkanRT "Administrators" "FullAccess" |
| 299 | AccessControl::SetOnFile $TEMP\VulkanRT "SYSTEM" "FullAccess" |
| 300 | AccessControl::GrantOnFile $TEMP\VulkanRT "Everyone" "ListDirectory" |
| 301 | AccessControl::GrantOnFile $TEMP\VulkanRT "Everyone" "GenericExecute" |
| 302 | AccessControl::GrantOnFile $TEMP\VulkanRT "Everyone" "GenericRead" |
| 303 | AccessControl::GrantOnFile $TEMP\VulkanRT "Everyone" "ReadAttributes" |
David Pinedo | 7f44f4f | 2016-03-18 13:15:27 -0600 | [diff] [blame] | 304 | StrCpy $1 10 |
| 305 | Call CheckForError |
| 306 | |
| 307 | # Check the registry to see if we are already installed |
David Pinedo | 5580597 | 2016-02-08 12:20:11 -0700 | [diff] [blame] | 308 | ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "InstallDir" |
David Pinedo | 6ab257c | 2016-02-10 11:03:29 -0700 | [diff] [blame] | 309 | |
| 310 | # If the registry entry isn't there, it will throw an error as well as return a blank value. So, clear the errors. |
| 311 | ${If} ${Errors} |
| 312 | |
| 313 | # Nothing else to do since there is no previous install |
| 314 | ClearErrors |
| 315 | |
| 316 | ${Else} |
| 317 | |
| 318 | # Use the previous install directory, so we don't have to keep tracking every possible runtime install. |
| 319 | strcmp $INSTDIR $0 notinstalled |
| 320 | |
| 321 | ${If} $0 != "" |
Lenny Komow | bc37ec2 | 2016-11-03 15:43:59 -0600 | [diff] [blame] | 322 | MessageBox MB_OK "The Windows ${APINAME} Runtime is already installed to $0. It will be re-installed to the same folder." /SD IDOK |
David Pinedo | 6ab257c | 2016-02-10 11:03:29 -0700 | [diff] [blame] | 323 | Strcpy $INSTDIR $0 |
| 324 | ${Endif} |
| 325 | |
| 326 | notinstalled: |
| 327 | |
| 328 | ${EndIf} |
David Pinedo | 5580597 | 2016-02-08 12:20:11 -0700 | [diff] [blame] | 329 | |
Mark Young | f1bdefc | 2016-01-29 16:09:29 -0700 | [diff] [blame] | 330 | SetOutPath "$INSTDIR" |
David Pinedo | 7f44f4f | 2016-03-18 13:15:27 -0600 | [diff] [blame] | 331 | AccessControl::DisableFileInheritance $INSTDIR |
| 332 | AccessControl::SetFileOwner $INSTDIR "Administrators" |
| 333 | AccessControl::ClearOnFile $INSTDIR "Administrators" "FullAccess" |
| 334 | AccessControl::SetOnFile $INSTDIR "SYSTEM" "FullAccess" |
| 335 | AccessControl::GrantOnFile $INSTDIR "Everyone" "ListDirectory" |
| 336 | AccessControl::GrantOnFile $INSTDIR "Everyone" "GenericExecute" |
| 337 | AccessControl::GrantOnFile $INSTDIR "Everyone" "GenericRead" |
| 338 | AccessControl::GrantOnFile $INSTDIR "Everyone" "ReadAttributes" |
Mark Young | f1bdefc | 2016-01-29 16:09:29 -0700 | [diff] [blame] | 339 | File ${ICOFILE} |
| 340 | File VULKANRT_LICENSE.RTF |
David Pinedo | b5d98a9 | 2016-04-19 13:36:49 -0600 | [diff] [blame] | 341 | File /oname=LICENSE.txt ..\COPYRIGHT.txt |
Lenny Komow | 769b9df | 2016-08-12 13:26:20 -0600 | [diff] [blame] | 342 | File Release\ConfigureRT.exe |
David Pinedo | 7f44f4f | 2016-03-18 13:15:27 -0600 | [diff] [blame] | 343 | StrCpy $1 15 |
David Pinedo | 6ab257c | 2016-02-10 11:03:29 -0700 | [diff] [blame] | 344 | Call CheckForError |
Mark Young | f1bdefc | 2016-01-29 16:09:29 -0700 | [diff] [blame] | 345 | |
David Pinedo | 5925ba0 | 2016-03-03 21:25:45 -0700 | [diff] [blame] | 346 | # Add the signed uninstaller |
| 347 | !ifndef UNINSTALLER |
| 348 | SetOutPath $INSTDIR |
| 349 | File "Uninstall${PRODUCTNAME}.exe" |
| 350 | !endif |
| 351 | |
David Pinedo | 7f44f4f | 2016-03-18 13:15:27 -0600 | [diff] [blame] | 352 | StrCpy $1 20 |
David Pinedo | 6ab257c | 2016-02-10 11:03:29 -0700 | [diff] [blame] | 353 | Call CheckForError |
Mark Young | f1bdefc | 2016-01-29 16:09:29 -0700 | [diff] [blame] | 354 | |
| 355 | # Reference count the number of times we have been installed. |
David Pinedo | 9d09277 | 2016-02-09 14:44:05 -0700 | [diff] [blame] | 356 | # The reference count is stored in the registry value InstallCount |
Mark Young | f1bdefc | 2016-01-29 16:09:29 -0700 | [diff] [blame] | 357 | ReadRegDword $1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "InstallCount" |
| 358 | IntOp $1 $1 + 1 |
David Pinedo | 9d09277 | 2016-02-09 14:44:05 -0700 | [diff] [blame] | 359 | StrCpy $IC $1 |
| 360 | |
| 361 | # We need to create a new folder for each install. Since we are using counted installs, |
| 362 | # an uninstall when the count is greater than one would result in the install |
| 363 | # count being decremented and nothing being removed. But Windows Add/Remove Programs |
| 364 | # generates a warning Window if the install dir for a package that is removed is not |
| 365 | # deleted. So we create a unique folder for each counted install. |
| 366 | # We fudge it a little and only create one folder, and rename it after each |
| 367 | # install/uninstall. |
| 368 | |
| 369 | # Create the install instance folder. We rename the install instance folder if it already exists. |
| 370 | # Then copy the uninstaller to it. |
| 371 | ${If} $IC > 2 |
| 372 | IntOp $1 $IC - 1 |
| 373 | Rename "$INSTDIR\Instance_$1" "$INSTDIR\Instance_$IC" |
| 374 | CopyFiles /SILENT "$INSTDIR\Uninstall${PRODUCTNAME}.exe" "$INSTDIR\Instance_$IC" |
| 375 | ${ElseIf} $IC = 2 |
| 376 | CreateDirectory "$INSTDIR\Instance_$IC" |
| 377 | CopyFiles /SILENT "$INSTDIR\Uninstall${PRODUCTNAME}.exe" "$INSTDIR\Instance_$IC" |
| 378 | ${EndIf} |
| 379 | |
David Pinedo | 1e368f7 | 2016-02-04 17:04:44 -0700 | [diff] [blame] | 380 | |
Mark Young | f1bdefc | 2016-01-29 16:09:29 -0700 | [diff] [blame] | 381 | # If the registry entry isn't there, it will throw an error as well as return a blank value. So, clear the errors. |
| 382 | ${If} ${Errors} |
| 383 | ClearErrors |
| 384 | ${EndIf} |
| 385 | |
Mark Young | f1bdefc | 2016-01-29 16:09:29 -0700 | [diff] [blame] | 386 | # Modify registry for Programs and Features |
Lenny Komow | bc37ec2 | 2016-11-03 15:43:59 -0600 | [diff] [blame] | 387 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "DisplayName" "${APINAME} Run Time Libraries ${PRODUCTVERSION}" |
Mark Young | f1bdefc | 2016-01-29 16:09:29 -0700 | [diff] [blame] | 388 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "UninstallString" "$INSTDIR\Uninstall${PRODUCTNAME}.exe" |
David Pinedo | 5580597 | 2016-02-08 12:20:11 -0700 | [diff] [blame] | 389 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "Publisher" "${PUBLISHER}" |
Mark Young | f1bdefc | 2016-01-29 16:09:29 -0700 | [diff] [blame] | 390 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "DisplayVersion" "${PRODUCTVERSION}" |
| 391 | WriteRegDword HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "EstimatedSize" ${ESTIMATEDSIZE} |
| 392 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "DisplayIcon" "$\"$INSTDIR\${ICOFILE}$\"" |
David Pinedo | 5580597 | 2016-02-08 12:20:11 -0700 | [diff] [blame] | 393 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "InstallDir" "$INSTDIR" |
David Pinedo | 9d09277 | 2016-02-09 14:44:05 -0700 | [diff] [blame] | 394 | WriteRegDword HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "InstallCount" $IC |
| 395 | |
| 396 | ${If} $IC > 1 |
Lenny Komow | bc37ec2 | 2016-11-03 15:43:59 -0600 | [diff] [blame] | 397 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}-$IC" "DisplayName" "${APINAME} Run Time Libraries ${PRODUCTVERSION}" |
David Pinedo | 9d09277 | 2016-02-09 14:44:05 -0700 | [diff] [blame] | 398 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}-$IC" "UninstallString" "$INSTDIR\Instance_$IC\Uninstall${PRODUCTNAME}.exe" |
| 399 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}-$IC" "Publisher" "${PUBLISHER}" |
| 400 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}-$IC" "DisplayVersion" "${PRODUCTVERSION}" |
| 401 | WriteRegDword HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}-$IC" "EstimatedSize" ${ESTIMATEDSIZE} |
| 402 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}-$IC" "DisplayIcon" "$\"$INSTDIR\${ICOFILE}$\"" |
| 403 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}-$IC" "InstallDir" "$INSTDIR\Instance_$IC" |
| 404 | WriteRegDword HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}-$IC" "InstallCount" $IC |
| 405 | ${EndIf} |
| 406 | |
| 407 | # Set SystemComponent to 1 for those instances that are not to be visible to Add/Remove Programs. |
| 408 | # Set SystemComponent to 0 for the instance that is to be visible to Add/Remove Programs. |
| 409 | ${If} $IC > 2 |
| 410 | IntOp $1 $IC - 1 |
| 411 | WriteRegDword HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}-$IC" "SystemComponent" 0 |
| 412 | WriteRegDword HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}-$1" "SystemComponent" 1 |
| 413 | ${ElseIf} $IC = 2 |
| 414 | WriteRegDword HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}-$IC" "SystemComponent" 0 |
| 415 | WriteRegDword HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "SystemComponent" 1 |
| 416 | ${Else} |
| 417 | WriteRegDword HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "SystemComponent" 0 |
| 418 | ${EndIf} |
| 419 | |
David Pinedo | 7f44f4f | 2016-03-18 13:15:27 -0600 | [diff] [blame] | 420 | StrCpy $1 25 |
David Pinedo | 6ab257c | 2016-02-10 11:03:29 -0700 | [diff] [blame] | 421 | Call CheckForError |
Mark Young | f1bdefc | 2016-01-29 16:09:29 -0700 | [diff] [blame] | 422 | |
Mark Young | 4b8b548 | 2016-01-15 15:09:39 -0700 | [diff] [blame] | 423 | # Set up version number for file names |
| 424 | ${StrRep} $0 ${VERSION_BUILDNO} "." "-" |
| 425 | StrCpy $FileVersion ${VERSION_ABI_MAJOR}-${VERSION_API_MAJOR}-${VERSION_MINOR}-${VERSION_PATCH}-$0 |
| 426 | |
David Pinedo | f2c7ed9 | 2016-03-29 16:29:00 -0600 | [diff] [blame] | 427 | # Complete remove the Vulkan Start Menu. Prior version of the Vulkan RT |
| 428 | # created Start Menu items, we don't do that anymore. |
David Pinedo | cf29063 | 2016-03-03 12:36:24 -0700 | [diff] [blame] | 429 | SetShellVarContext all |
David Pinedo | f2c7ed9 | 2016-03-29 16:29:00 -0600 | [diff] [blame] | 430 | RmDir /R "$SMPROGRAMS\Vulkan" |
David Pinedo | cf29063 | 2016-03-03 12:36:24 -0700 | [diff] [blame] | 431 | ClearErrors |
| 432 | |
Mark Young | 4b8b548 | 2016-01-15 15:09:39 -0700 | [diff] [blame] | 433 | # If running on a 64-bit OS machine |
| 434 | ${If} ${RunningX64} |
Mark Young | f1bdefc | 2016-01-29 16:09:29 -0700 | [diff] [blame] | 435 | |
Mark Young | dd9eca7 | 2016-01-15 14:11:32 -0700 | [diff] [blame] | 436 | # 32-bit DLLs/EXEs destined for SysWOW64 |
| 437 | ########################################## |
| 438 | SetOutPath $WINDIR\SysWow64 |
Lenny Komow | 307f0e5 | 2016-11-07 15:20:54 -0700 | [diff] [blame] | 439 | File /oname=${APILOWER}-$FileVersion.dll ..\build32\loader\Release\${APILOWER}-${VERSION_ABI_MAJOR}.dll |
| 440 | File /oname=${APILOWER}info-$FileVersion.exe ..\build32\demos\Release\${APILOWER}info.exe |
David Pinedo | 7f44f4f | 2016-03-18 13:15:27 -0600 | [diff] [blame] | 441 | StrCpy $1 30 |
David Pinedo | 6ab257c | 2016-02-10 11:03:29 -0700 | [diff] [blame] | 442 | Call CheckForError |
Mark Young | f1bdefc | 2016-01-29 16:09:29 -0700 | [diff] [blame] | 443 | |
Mark Young | dd9eca7 | 2016-01-15 14:11:32 -0700 | [diff] [blame] | 444 | # 64-bit DLLs/EXEs |
| 445 | ########################################## |
| 446 | SetOutPath $WINDIR\System32 |
Lenny Komow | 307f0e5 | 2016-11-07 15:20:54 -0700 | [diff] [blame] | 447 | File /oname=${APILOWER}-$FileVersion.dll ..\build\loader\Release\${APILOWER}-${VERSION_ABI_MAJOR}.dll |
David Pinedo | 7f44f4f | 2016-03-18 13:15:27 -0600 | [diff] [blame] | 448 | StrCpy $1 35 |
David Pinedo | 6ab257c | 2016-02-10 11:03:29 -0700 | [diff] [blame] | 449 | Call CheckForError |
Mark Young | dd9eca7 | 2016-01-15 14:11:32 -0700 | [diff] [blame] | 450 | |
| 451 | # vulkaninfo.exe |
Lenny Komow | 307f0e5 | 2016-11-07 15:20:54 -0700 | [diff] [blame] | 452 | File /oname=${APILOWER}info-$FileVersion.exe ..\build\demos\Release\${APILOWER}info.exe |
Mark Young | dd9eca7 | 2016-01-15 14:11:32 -0700 | [diff] [blame] | 453 | SetOutPath "$INSTDIR" |
Lenny Komow | be93725 | 2016-11-10 18:36:05 -0700 | [diff] [blame] | 454 | File /oname=${APILOWER}info.exe ..\build\demos\Release\${APILOWER}info.exe |
Lenny Komow | 307f0e5 | 2016-11-07 15:20:54 -0700 | [diff] [blame] | 455 | File /oname=${APILOWER}info32.exe ..\build32\demos\Release\${APILOWER}info.exe |
David Pinedo | 7f44f4f | 2016-03-18 13:15:27 -0600 | [diff] [blame] | 456 | StrCpy $1 40 |
David Pinedo | 6ab257c | 2016-02-10 11:03:29 -0700 | [diff] [blame] | 457 | Call CheckForError |
Mark Young | dd9eca7 | 2016-01-15 14:11:32 -0700 | [diff] [blame] | 458 | |
Mark Young | dd9eca7 | 2016-01-15 14:11:32 -0700 | [diff] [blame] | 459 | # Else, running on a 32-bit OS machine |
| 460 | ${Else} |
Mark Young | f1bdefc | 2016-01-29 16:09:29 -0700 | [diff] [blame] | 461 | |
Mark Young | 4b8b548 | 2016-01-15 15:09:39 -0700 | [diff] [blame] | 462 | # 32-bit DLLs/EXEs destined for SysWOW64 |
| 463 | ########################################## |
| 464 | SetOutPath $WINDIR\System32 |
Lenny Komow | 307f0e5 | 2016-11-07 15:20:54 -0700 | [diff] [blame] | 465 | File /oname=${APILOWER}-$FileVersion.dll ..\build32\loader\Release\${APILOWER}-${VERSION_ABI_MAJOR}.dll |
David Pinedo | 7f44f4f | 2016-03-18 13:15:27 -0600 | [diff] [blame] | 466 | StrCpy $1 50 |
David Pinedo | 6ab257c | 2016-02-10 11:03:29 -0700 | [diff] [blame] | 467 | Call CheckForError |
Mark Young | 4b8b548 | 2016-01-15 15:09:39 -0700 | [diff] [blame] | 468 | |
| 469 | # vulkaninfo.exe |
Lenny Komow | 307f0e5 | 2016-11-07 15:20:54 -0700 | [diff] [blame] | 470 | File /oname=${APILOWER}info-$FileVersion.exe ..\build32\demos\Release\${APILOWER}info.exe |
Mark Young | 4b8b548 | 2016-01-15 15:09:39 -0700 | [diff] [blame] | 471 | SetOutPath "$INSTDIR" |
Lenny Komow | 307f0e5 | 2016-11-07 15:20:54 -0700 | [diff] [blame] | 472 | File /oname=${APILOWER}info ..\build32\demos\Release\${APILOWER}info.exe |
David Pinedo | 7f44f4f | 2016-03-18 13:15:27 -0600 | [diff] [blame] | 473 | StrCpy $1 55 |
David Pinedo | 6ab257c | 2016-02-10 11:03:29 -0700 | [diff] [blame] | 474 | Call CheckForError |
Mark Young | 4b8b548 | 2016-01-15 15:09:39 -0700 | [diff] [blame] | 475 | |
Mark Young | dd9eca7 | 2016-01-15 14:11:32 -0700 | [diff] [blame] | 476 | ${Endif} |
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 477 | |
Lenny Komow | 769b9df | 2016-08-12 13:26:20 -0600 | [diff] [blame] | 478 | # Run the ConfigureRT program to copy the most recent version of |
David Pinedo | 19fc396 | 2016-06-07 09:35:56 -0600 | [diff] [blame] | 479 | # vulkan-<abimajor>-*.dll to vulkan-<abimajor>.dll, and to set up layer registry |
| 480 | # entries to use layers from the corresponding SDK |
David Pinedo | 1d6bb4e | 2016-06-08 16:30:06 -0600 | [diff] [blame] | 481 | SetOutPath "$INSTDIR" |
David Pinedo | 19fc396 | 2016-06-07 09:35:56 -0600 | [diff] [blame] | 482 | Call ConfigLayersAndVulkanDLL |
| 483 | ${If} $0 != 0 |
David Pinedo | 1d6bb4e | 2016-06-08 16:30:06 -0600 | [diff] [blame] | 484 | SetOutPath "$INSTDIR" |
David Pinedo | 19fc396 | 2016-06-07 09:35:56 -0600 | [diff] [blame] | 485 | Call DiagConfigLayersAndVulkanDLL |
David Pinedo | 1d1d577 | 2016-06-09 16:12:44 -0600 | [diff] [blame] | 486 | |
Lenny Komow | 769b9df | 2016-08-12 13:26:20 -0600 | [diff] [blame] | 487 | # The program failed, and we don't know why. |
David Pinedo | 1d1d577 | 2016-06-09 16:12:44 -0600 | [diff] [blame] | 488 | # Simply configure system to use our loader and vulkaninfo. |
Lenny Komow | d8b4f6b | 2016-08-31 09:45:46 -0600 | [diff] [blame] | 489 | MessageBox MB_OK "Warning!$\n$\nConfigureRT program called by VulkanRT Installer failed with error $0. This may result in an incomplete installation.$\n$\nWill configure system with Vulkan $FileVersion." /SD IDOK |
David Pinedo | 1d1d577 | 2016-06-09 16:12:44 -0600 | [diff] [blame] | 490 | ${If} ${RunningX64} |
Lenny Komow | 307f0e5 | 2016-11-07 15:20:54 -0700 | [diff] [blame] | 491 | Delete $WINDIR\SysWow64\${APILOWER}-${VERSION_ABI_MAJOR}.dll |
| 492 | Delete $WINDIR\SysWow64\${APILOWER}info.exe |
| 493 | CopyFiles /SILENT $WINDIR\SysWow64\${APILOWER}-$FileVersion.dll $WINDIR\SysWow64\${APILOWER}-${VERSION_ABI_MAJOR}.dll |
| 494 | CopyFiles /SILENT $WINDIR\SysWow64\${APILOWER}info-$FileVersion.exe $WINDIR\SysWow64\${APILOWER}info.exe |
David Pinedo | 1d1d577 | 2016-06-09 16:12:44 -0600 | [diff] [blame] | 495 | ${Endif} |
Lenny Komow | 307f0e5 | 2016-11-07 15:20:54 -0700 | [diff] [blame] | 496 | Delete $WINDIR\System32\${APILOWER}-${VERSION_ABI_MAJOR}.dll |
| 497 | Delete $WINDIR\System32\${APILOWER}info.exe |
| 498 | CopyFiles /SILENT $WINDIR\System32\${APILOWER}-$FileVersion.dll $WINDIR\System32\${APILOWER}-${VERSION_ABI_MAJOR}.dll |
| 499 | CopyFiles /SILENT $WINDIR\System32\${APILOWER}info-$FileVersion.exe $WINDIR\System32\${APILOWER}info.exe |
David Pinedo | 1d1d577 | 2016-06-09 16:12:44 -0600 | [diff] [blame] | 500 | ClearErrors |
David Pinedo | 19fc396 | 2016-06-07 09:35:56 -0600 | [diff] [blame] | 501 | ${Endif} |
David Pinedo | 1d1d577 | 2016-06-09 16:12:44 -0600 | [diff] [blame] | 502 | StrCpy $1 60 |
David Pinedo | 19fc396 | 2016-06-07 09:35:56 -0600 | [diff] [blame] | 503 | Call CheckForError |
| 504 | |
Lenny Komow | 769b9df | 2016-08-12 13:26:20 -0600 | [diff] [blame] | 505 | # We are done using ConfigureRT.exe, delete it. It will be re-installed |
Mark Young | f1bdefc | 2016-01-29 16:09:29 -0700 | [diff] [blame] | 506 | # by the uninstaller when it needs to be run again during uninstall. |
Lenny Komow | 769b9df | 2016-08-12 13:26:20 -0600 | [diff] [blame] | 507 | Delete ConfigureRT.exe |
Mark Young | 4b8b548 | 2016-01-15 15:09:39 -0700 | [diff] [blame] | 508 | |
David Pinedo | ef68bbe | 2016-03-29 13:46:12 -0600 | [diff] [blame] | 509 | # Finish logging and move log file to TEMP dir |
| 510 | LogSet off |
David Pinedo | 19fc396 | 2016-06-07 09:35:56 -0600 | [diff] [blame] | 511 | Rename "$INSTDIR\install.log" "$TEMP\VulkanRT\installer.log" |
David Pinedo | ef68bbe | 2016-03-29 13:46:12 -0600 | [diff] [blame] | 512 | |
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 513 | SectionEnd |
| 514 | |
| 515 | # Uninstaller section start |
David Pinedo | 5925ba0 | 2016-03-03 21:25:45 -0700 | [diff] [blame] | 516 | !ifdef UNINSTALLER |
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 517 | Section "uninstall" |
David Pinedo | 3fc22bf | 2016-04-05 16:40:08 -0600 | [diff] [blame] | 518 | # Turn on logging |
David Pinedo | 19fc396 | 2016-06-07 09:35:56 -0600 | [diff] [blame] | 519 | SetOutPath "$TEMP\VulkanRT" |
| 520 | StrCpy $INSTDIR "$TEMP\VulkanRT" |
David Pinedo | 3fc22bf | 2016-04-05 16:40:08 -0600 | [diff] [blame] | 521 | LogSet on |
| 522 | |
Mark Young | a8557b8 | 2016-01-15 16:01:46 -0700 | [diff] [blame] | 523 | # If running on a 64-bit OS machine, disable registry re-direct since we're running as a 32-bit executable. |
Mark Young | dd9eca7 | 2016-01-15 14:11:32 -0700 | [diff] [blame] | 524 | ${If} ${RunningX64} |
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 525 | |
Mark Young | dd9eca7 | 2016-01-15 14:11:32 -0700 | [diff] [blame] | 526 | ${DisableX64FSRedirection} |
| 527 | SetRegView 64 |
Mark Young | f1bdefc | 2016-01-29 16:09:29 -0700 | [diff] [blame] | 528 | |
Mark Young | 4b8b548 | 2016-01-15 15:09:39 -0700 | [diff] [blame] | 529 | ${Endif} |
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 530 | |
David Pinedo | 32eb2ec | 2016-02-09 09:15:34 -0700 | [diff] [blame] | 531 | # Look up the install dir and remove files from that directory. |
David Pinedo | 32eb2ec | 2016-02-09 09:15:34 -0700 | [diff] [blame] | 532 | ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "InstallDir" |
David Pinedo | 9d09277 | 2016-02-09 14:44:05 -0700 | [diff] [blame] | 533 | StrCpy $IDir $0 |
David Pinedo | 32eb2ec | 2016-02-09 09:15:34 -0700 | [diff] [blame] | 534 | |
David Pinedo | 1d6bb4e | 2016-06-08 16:30:06 -0600 | [diff] [blame] | 535 | StrCpy $1 65 |
David Pinedo | 6ab257c | 2016-02-10 11:03:29 -0700 | [diff] [blame] | 536 | Call un.CheckForError |
| 537 | |
David Pinedo | 32eb2ec | 2016-02-09 09:15:34 -0700 | [diff] [blame] | 538 | SetOutPath "$IDir" |
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 539 | |
Mark Young | 4b8b548 | 2016-01-15 15:09:39 -0700 | [diff] [blame] | 540 | # Set up version number for file names |
| 541 | ${StrRep} $0 ${VERSION_BUILDNO} "." "-" |
| 542 | StrCpy $FileVersion ${VERSION_ABI_MAJOR}-${VERSION_API_MAJOR}-${VERSION_MINOR}-${VERSION_PATCH}-$0 |
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 543 | |
Mark Young | 4b8b548 | 2016-01-15 15:09:39 -0700 | [diff] [blame] | 544 | # Decrement the number of times we have been installed. |
David Pinedo | 9d09277 | 2016-02-09 14:44:05 -0700 | [diff] [blame] | 545 | ReadRegDword $IC HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "InstallCount" |
| 546 | IntOp $1 $IC - 1 |
David Pinedo | b4d7f6a | 2016-01-27 14:15:25 -0700 | [diff] [blame] | 547 | WriteRegDword HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "InstallCount" $1 |
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 548 | |
David Pinedo | 9d09277 | 2016-02-09 14:44:05 -0700 | [diff] [blame] | 549 | # Rename the install dir for this instance if is not the last uninstall |
| 550 | ${If} $IC > 2 |
| 551 | IntOp $1 $IC - 1 |
| 552 | Rename "$IDir\Instance_$IC" "$IDir\Instance_$1" |
| 553 | ${ElseIf} $IC = 2 |
David Pinedo | 5925ba0 | 2016-03-03 21:25:45 -0700 | [diff] [blame] | 554 | Delete /REBOOTOK "$IDir\Instance_$IC\Uninstall${PRODUCTNAME}.exe" |
David Pinedo | 9d09277 | 2016-02-09 14:44:05 -0700 | [diff] [blame] | 555 | Rmdir /REBOOTOK "$IDir\Instance_$IC" |
| 556 | ${Endif} |
David Pinedo | 1d6bb4e | 2016-06-08 16:30:06 -0600 | [diff] [blame] | 557 | StrCpy $1 70 |
| 558 | Call un.CheckForError |
David Pinedo | 9d09277 | 2016-02-09 14:44:05 -0700 | [diff] [blame] | 559 | |
| 560 | # Modify registry for Programs and Features |
David Pinedo | cf29063 | 2016-03-03 12:36:24 -0700 | [diff] [blame] | 561 | |
| 562 | ${If} $IC > 1 |
| 563 | DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}-$IC" |
| 564 | ${EndIf} |
David Pinedo | 9d09277 | 2016-02-09 14:44:05 -0700 | [diff] [blame] | 565 | ${If} $IC > 2 |
| 566 | IntOp $IC $IC - 1 |
| 567 | WriteRegDword HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}-$IC" "SystemComponent" 0 |
| 568 | ${ElseIf} $IC = 2 |
| 569 | WriteRegDword HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "SystemComponent" 0 |
| 570 | ${Else} |
| 571 | # Last uninstall |
| 572 | IntOp $IC $IC - 1 |
| 573 | DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" |
| 574 | ${EndIf} |
David Pinedo | 1d6bb4e | 2016-06-08 16:30:06 -0600 | [diff] [blame] | 575 | StrCpy $1 75 |
| 576 | Call un.CheckForError |
David Pinedo | 9d09277 | 2016-02-09 14:44:05 -0700 | [diff] [blame] | 577 | |
David Pinedo | d133b78 | 2016-03-16 14:41:56 -0600 | [diff] [blame] | 578 | |
Lenny Komow | 769b9df | 2016-08-12 13:26:20 -0600 | [diff] [blame] | 579 | # Install ConfigureRT.exe so we can run it. |
David Pinedo | d133b78 | 2016-03-16 14:41:56 -0600 | [diff] [blame] | 580 | # It will be deleted later when we remove the install directory. |
Lenny Komow | 769b9df | 2016-08-12 13:26:20 -0600 | [diff] [blame] | 581 | File Release\ConfigureRT.exe |
David Pinedo | d133b78 | 2016-03-16 14:41:56 -0600 | [diff] [blame] | 582 | |
| 583 | # If running on a 64-bit OS machine |
| 584 | ${If} ${RunningX64} |
| 585 | |
| 586 | # Delete vulkaninfo.exe in C:\Windows\System32 and C:\Windows\SysWOW64 |
Lenny Komow | 307f0e5 | 2016-11-07 15:20:54 -0700 | [diff] [blame] | 587 | Delete /REBOOTOK $WINDIR\SysWow64\${APILOWER}info.exe |
| 588 | Delete /REBOOTOK $WINDIR\System32\${APILOWER}info.exe |
David Pinedo | d133b78 | 2016-03-16 14:41:56 -0600 | [diff] [blame] | 589 | |
Mark Young | 013dd06 | 2016-06-22 16:55:31 -0600 | [diff] [blame] | 590 | # Delete vulkan-<majorabi>.dll in C:\Windows\System32 and C:\Windows\SysWOW64 |
Lenny Komow | 307f0e5 | 2016-11-07 15:20:54 -0700 | [diff] [blame] | 591 | Delete /REBOOTOK $WINDIR\SysWow64\${APILOWER}-${VERSION_ABI_MAJOR}.dll |
| 592 | Delete /REBOOTOK $WINDIR\System32\${APILOWER}-${VERSION_ABI_MAJOR}.dll |
David Pinedo | d133b78 | 2016-03-16 14:41:56 -0600 | [diff] [blame] | 593 | |
David Pinedo | d133b78 | 2016-03-16 14:41:56 -0600 | [diff] [blame] | 594 | # Else, running on a 32-bit OS machine |
| 595 | ${Else} |
| 596 | |
| 597 | # Delete vulkaninfo.exe in C:\Windows\System32 |
Lenny Komow | 307f0e5 | 2016-11-07 15:20:54 -0700 | [diff] [blame] | 598 | Delete /REBOOTOK $WINDIR\System32\${APILOWER}info.exe |
David Pinedo | d133b78 | 2016-03-16 14:41:56 -0600 | [diff] [blame] | 599 | |
Mark Young | 013dd06 | 2016-06-22 16:55:31 -0600 | [diff] [blame] | 600 | # Delete vulkan-<majorabi>.dll in C:\Windows\System32 |
Lenny Komow | 307f0e5 | 2016-11-07 15:20:54 -0700 | [diff] [blame] | 601 | Delete /REBOOTOK $WINDIR\System32\${APILOWER}-${VERSION_ABI_MAJOR}.dll |
David Pinedo | d133b78 | 2016-03-16 14:41:56 -0600 | [diff] [blame] | 602 | |
David Pinedo | d133b78 | 2016-03-16 14:41:56 -0600 | [diff] [blame] | 603 | ${EndIf} |
David Pinedo | 1d6bb4e | 2016-06-08 16:30:06 -0600 | [diff] [blame] | 604 | StrCpy $1 80 |
| 605 | Call un.CheckForError |
David Pinedo | d133b78 | 2016-03-16 14:41:56 -0600 | [diff] [blame] | 606 | |
Mark Young | 013dd06 | 2016-06-22 16:55:31 -0600 | [diff] [blame] | 607 | # If Ref Count is zero, remove files in C:\Windows\System32 and C:\Windows\SysWow64 |
| 608 | ${If} $IC <= 0 |
| 609 | |
| 610 | ${If} ${RunningX64} |
| 611 | # Delete vulkaninfo.exe in C:\Windows\System32 and C:\Windows\SysWOW64 |
Lenny Komow | 307f0e5 | 2016-11-07 15:20:54 -0700 | [diff] [blame] | 612 | Delete /REBOOTOK "$WINDIR\SysWow64\${APILOWER}info-$FileVersion.exe" |
| 613 | Delete /REBOOTOK "$WINDIR\System32\${APILOWER}info-$FileVersion.exe" |
Mark Young | 013dd06 | 2016-06-22 16:55:31 -0600 | [diff] [blame] | 614 | # Delete vulkan-<majorabi>-<major>-<minor>-<patch>-<buildno>.dll from sys dirs |
Lenny Komow | 307f0e5 | 2016-11-07 15:20:54 -0700 | [diff] [blame] | 615 | Delete /REBOOTOK $WINDIR\SysWow64\${APILOWER}-$FileVersion.dll |
| 616 | Delete /REBOOTOK $WINDIR\System32\${APILOWER}-$FileVersion.dll |
Mark Young | 013dd06 | 2016-06-22 16:55:31 -0600 | [diff] [blame] | 617 | ${Else} |
| 618 | # Delete vulkaninfo.exe in C:\Windows\System32 |
Lenny Komow | 307f0e5 | 2016-11-07 15:20:54 -0700 | [diff] [blame] | 619 | Delete /REBOOTOK "$WINDIR\System32\${APILOWER}info-$FileVersion.exe" |
Mark Young | 013dd06 | 2016-06-22 16:55:31 -0600 | [diff] [blame] | 620 | # Delete vulkan-<majorabi>-<major>-<minor>-<patch>-<buildno>.dll from sys dir |
Lenny Komow | 307f0e5 | 2016-11-07 15:20:54 -0700 | [diff] [blame] | 621 | Delete /REBOOTOK $WINDIR\System32\${APILOWER}-$FileVersion.dll |
Mark Young | 013dd06 | 2016-06-22 16:55:31 -0600 | [diff] [blame] | 622 | ${EndIf} |
| 623 | |
| 624 | ${Endif} |
| 625 | |
Lenny Komow | 769b9df | 2016-08-12 13:26:20 -0600 | [diff] [blame] | 626 | # Run the ConfigureRT.exe program to copy the most recent version of |
David Pinedo | 19fc396 | 2016-06-07 09:35:56 -0600 | [diff] [blame] | 627 | # vulkan-<abimajor>-*.dll to vulkan-<abimajor>.dll, and to set up layer registry |
| 628 | # entries to use layers from the corresponding SDK |
David Pinedo | 1d6bb4e | 2016-06-08 16:30:06 -0600 | [diff] [blame] | 629 | SetOutPath "$IDir" |
David Pinedo | 19fc396 | 2016-06-07 09:35:56 -0600 | [diff] [blame] | 630 | Call un.ConfigLayersAndVulkanDLL |
| 631 | ${If} $0 != 0 |
David Pinedo | 1d6bb4e | 2016-06-08 16:30:06 -0600 | [diff] [blame] | 632 | SetOutPath "$IDir" |
David Pinedo | 19fc396 | 2016-06-07 09:35:56 -0600 | [diff] [blame] | 633 | Call un.DiagConfigLayersAndVulkanDLL |
Lenny Komow | 307f0e5 | 2016-11-07 15:20:54 -0700 | [diff] [blame] | 634 | MessageBox MB_OK "Warning!$\n$\nConfigureRT program called by ${APILOWER} Runtime Installer failed with error $0. This may result in an incomplete uninstall.$\n$\nVulkan $FileVersion has been uninstalled from your system." /SD IDOK |
David Pinedo | 1d1d577 | 2016-06-09 16:12:44 -0600 | [diff] [blame] | 635 | ${If} ${RunningX64} |
Lenny Komow | 307f0e5 | 2016-11-07 15:20:54 -0700 | [diff] [blame] | 636 | Delete $WINDIR\SysWow64\${APILOWER}-${VERSION_ABI_MAJOR}.dll |
| 637 | Delete $WINDIR\SysWow64\${APILOWER}info.exe |
David Pinedo | 1d1d577 | 2016-06-09 16:12:44 -0600 | [diff] [blame] | 638 | ${Endif} |
Lenny Komow | 307f0e5 | 2016-11-07 15:20:54 -0700 | [diff] [blame] | 639 | Delete $WINDIR\System32\${APILOWER}-${VERSION_ABI_MAJOR}.dll |
| 640 | Delete $WINDIR\System32\${APILOWER}info.exe |
David Pinedo | 1d1d577 | 2016-06-09 16:12:44 -0600 | [diff] [blame] | 641 | ClearErrors |
David Pinedo | 1d6bb4e | 2016-06-08 16:30:06 -0600 | [diff] [blame] | 642 | ${Else} |
| 643 | StrCpy $1 85 |
David Pinedo | 19fc396 | 2016-06-07 09:35:56 -0600 | [diff] [blame] | 644 | ${Endif} |
David Pinedo | 19fc396 | 2016-06-07 09:35:56 -0600 | [diff] [blame] | 645 | Call un.CheckForError |
Lenny Komow | 992fbc7 | 2016-09-09 09:43:17 -0600 | [diff] [blame] | 646 | |
| 647 | # Remove ConfigureRT regardless of the ref count |
| 648 | Delete /REBOOTOK "$IDir\ConfigureRT.exe" |
David Pinedo | 19fc396 | 2016-06-07 09:35:56 -0600 | [diff] [blame] | 649 | |
Mark Young | 013dd06 | 2016-06-22 16:55:31 -0600 | [diff] [blame] | 650 | # If Ref Count is zero, remove install dir |
David Pinedo | 9d09277 | 2016-02-09 14:44:05 -0700 | [diff] [blame] | 651 | ${If} $IC <= 0 |
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 652 | |
Mark Young | 4b8b548 | 2016-01-15 15:09:39 -0700 | [diff] [blame] | 653 | # Remove files in install dir |
David Pinedo | 32eb2ec | 2016-02-09 09:15:34 -0700 | [diff] [blame] | 654 | Delete /REBOOTOK "$IDir\VULKANRT_LICENSE.rtf" |
| 655 | Delete /REBOOTOK "$IDir\LICENSE.txt" |
David Pinedo | 5925ba0 | 2016-03-03 21:25:45 -0700 | [diff] [blame] | 656 | Delete /REBOOTOK "$IDir\Uninstall${PRODUCTNAME}.exe" |
David Pinedo | 32eb2ec | 2016-02-09 09:15:34 -0700 | [diff] [blame] | 657 | Delete /REBOOTOK "$IDir\V.ico" |
Lenny Komow | 307f0e5 | 2016-11-07 15:20:54 -0700 | [diff] [blame] | 658 | Delete /REBOOTOK "$IDir\${APILOWER}info.exe" |
Mark Young | f1bdefc | 2016-01-29 16:09:29 -0700 | [diff] [blame] | 659 | |
Mark Young | f7c705b | 2016-01-26 13:36:28 -0700 | [diff] [blame] | 660 | # If running on a 64-bit OS machine |
| 661 | ${If} ${RunningX64} |
Lenny Komow | 307f0e5 | 2016-11-07 15:20:54 -0700 | [diff] [blame] | 662 | Delete /REBOOTOK "$IDir\${APILOWER}info32.exe" |
Mark Young | f7c705b | 2016-01-26 13:36:28 -0700 | [diff] [blame] | 663 | ${EndIf} |
Mark Young | 4b8b548 | 2016-01-15 15:09:39 -0700 | [diff] [blame] | 664 | |
David Pinedo | 1d6bb4e | 2016-06-08 16:30:06 -0600 | [diff] [blame] | 665 | StrCpy $1 90 |
David Pinedo | 6ab257c | 2016-02-10 11:03:29 -0700 | [diff] [blame] | 666 | Call un.CheckForError |
| 667 | |
David Pinedo | 32eb2ec | 2016-02-09 09:15:34 -0700 | [diff] [blame] | 668 | # Need to do a SetOutPath to something outside of install dir, |
| 669 | # or the uninstall will think install dir is busy |
Mark Young | 4b8b548 | 2016-01-15 15:09:39 -0700 | [diff] [blame] | 670 | SetOutPath "$TEMP" |
| 671 | |
| 672 | # Remove install directories |
David Pinedo | 7f44f4f | 2016-03-18 13:15:27 -0600 | [diff] [blame] | 673 | StrCpy $0 "$IDir" |
| 674 | Call un.DeleteDirIfEmpty |
Mark Young | 4b8b548 | 2016-01-15 15:09:39 -0700 | [diff] [blame] | 675 | StrCpy $0 "$PROGRAMFILES\${PRODUCTNAME}" |
| 676 | Call un.DeleteDirIfEmpty |
David Pinedo | cf29063 | 2016-03-03 12:36:24 -0700 | [diff] [blame] | 677 | ClearErrors |
Mark Young | 4b8b548 | 2016-01-15 15:09:39 -0700 | [diff] [blame] | 678 | |
| 679 | # If any of the remove commands failed, request a reboot |
Mark Young | 0368c7d | 2016-02-02 10:56:42 -0700 | [diff] [blame] | 680 | IfRebootFlag 0 noreboot |
| 681 | MessageBox MB_YESNO "A reboot is required to finish the uninstall. Do you wish to reboot now?" /SD IDNO IDNO returnerror |
| 682 | Reboot |
David Pinedo | 1e368f7 | 2016-02-04 17:04:44 -0700 | [diff] [blame] | 683 | |
Mark Young | 0368c7d | 2016-02-02 10:56:42 -0700 | [diff] [blame] | 684 | returnerror: |
David Pinedo | 1e368f7 | 2016-02-04 17:04:44 -0700 | [diff] [blame] | 685 | |
Mark Young | 0368c7d | 2016-02-02 10:56:42 -0700 | [diff] [blame] | 686 | # Set an error message to output because we should reboot but didn't (whether because silent uninstall or user choice) |
| 687 | SetErrorLevel 3 # ERROR_TOO_MANY_OPEN_FILES |
| 688 | |
Mark Young | 4b8b548 | 2016-01-15 15:09:39 -0700 | [diff] [blame] | 689 | noreboot: |
Mark Young | f1bdefc | 2016-01-29 16:09:29 -0700 | [diff] [blame] | 690 | |
Mark Young | dd9eca7 | 2016-01-15 14:11:32 -0700 | [diff] [blame] | 691 | ${Endif} |
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 692 | |
David Pinedo | 1d6bb4e | 2016-06-08 16:30:06 -0600 | [diff] [blame] | 693 | StrCpy $1 95 |
David Pinedo | 6ab257c | 2016-02-10 11:03:29 -0700 | [diff] [blame] | 694 | Call un.CheckForError |
| 695 | |
David Pinedo | 8671af5 | 2016-06-03 12:08:12 -0600 | [diff] [blame] | 696 | # Finish logging |
David Pinedo | ef68bbe | 2016-03-29 13:46:12 -0600 | [diff] [blame] | 697 | LogSet off |
David Pinedo | 19fc396 | 2016-06-07 09:35:56 -0600 | [diff] [blame] | 698 | Rename "$INSTDIR\install.log" "$TEMP\VulkanRT\uninstaller.log" |
David Pinedo | 7f44f4f | 2016-03-18 13:15:27 -0600 | [diff] [blame] | 699 | |
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 700 | SectionEnd |
David Pinedo | 5925ba0 | 2016-03-03 21:25:45 -0700 | [diff] [blame] | 701 | !endif |
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 702 | |
| 703 | Function brandimage |
| 704 | SetOutPath "$TEMP" |
David Pinedo | f79938f | 2016-02-02 16:10:39 -0700 | [diff] [blame] | 705 | SetFileAttributes V.bmp temporary |
| 706 | File V.bmp |
| 707 | SetBrandingImage "$TEMP/V.bmp" |
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 708 | Functionend |
| 709 | |
| 710 | |
| 711 | Function un.brandimage |
| 712 | SetOutPath "$TEMP" |
David Pinedo | f79938f | 2016-02-02 16:10:39 -0700 | [diff] [blame] | 713 | SetFileAttributes V.bmp temporary |
| 714 | File V.bmp |
| 715 | SetBrandingImage "$TEMP/V.bmp" |
David Pinedo | c21fdb9 | 2016-01-04 16:31:57 -0700 | [diff] [blame] | 716 | Functionend |
| 717 | |
| 718 | Function un.DeleteDirIfEmpty |
| 719 | FindFirst $R0 $R1 "$0\*.*" |
| 720 | strcmp $R1 "." 0 NoDelete |
| 721 | FindNext $R0 $R1 |
| 722 | strcmp $R1 ".." 0 NoDelete |
| 723 | ClearErrors |
| 724 | FindNext $R0 $R1 |
| 725 | IfErrors 0 NoDelete |
| 726 | FindClose $R0 |
| 727 | Sleep 1000 |
| 728 | RMDir "$0" |
| 729 | NoDelete: |
| 730 | FindClose $R0 |
| 731 | FunctionEnd |
Mark Young | f1bdefc | 2016-01-29 16:09:29 -0700 | [diff] [blame] | 732 | |
David Pinedo | 6ab257c | 2016-02-10 11:03:29 -0700 | [diff] [blame] | 733 | # Check for errors during install. If we hit an error, stop, uninstall what we've put in so far, and quit. |
Mark Young | f1bdefc | 2016-01-29 16:09:29 -0700 | [diff] [blame] | 734 | # NOTE: We return a non-zero error code as well. |
David Pinedo | 6ab257c | 2016-02-10 11:03:29 -0700 | [diff] [blame] | 735 | Function CheckForError |
Mark Young | f1bdefc | 2016-01-29 16:09:29 -0700 | [diff] [blame] | 736 | ${If} ${Errors} |
| 737 | # IHV's using this install may want no message box. |
David Pinedo | a6d46a8 | 2016-02-12 12:23:57 -0700 | [diff] [blame] | 738 | MessageBox MB_OK|MB_ICONSTOP "${errorMessage1}${errorMessage2}Errorcode: $1$\r$\n" /SD IDOK |
Mark Young | f1bdefc | 2016-01-29 16:09:29 -0700 | [diff] [blame] | 739 | |
David Pinedo | ef68bbe | 2016-03-29 13:46:12 -0600 | [diff] [blame] | 740 | # Finish logging and move log file to TEMP dir |
| 741 | LogSet off |
David Pinedo | 19fc396 | 2016-06-07 09:35:56 -0600 | [diff] [blame] | 742 | Rename "$INSTDIR\install.log" "$TEMP\VulkanRT\installer.log" |
David Pinedo | ef68bbe | 2016-03-29 13:46:12 -0600 | [diff] [blame] | 743 | |
Mark Young | f1bdefc | 2016-01-29 16:09:29 -0700 | [diff] [blame] | 744 | # Copy the uninstaller to a temp folder of our own creation so we can completely |
| 745 | # delete the old contents. |
David Pinedo | 19fc396 | 2016-06-07 09:35:56 -0600 | [diff] [blame] | 746 | SetOutPath "$TEMP\VulkanRT" |
| 747 | CopyFiles "$INSTDIR\Uninstall${PRODUCTNAME}.exe" "$TEMP\VulkanRT" |
Mark Young | f1bdefc | 2016-01-29 16:09:29 -0700 | [diff] [blame] | 748 | |
David Pinedo | 8671af5 | 2016-06-03 12:08:12 -0600 | [diff] [blame] | 749 | # Do uninstall using the version in the temporary folder. |
David Pinedo | 19fc396 | 2016-06-07 09:35:56 -0600 | [diff] [blame] | 750 | ExecWait '"$TEMP\VulkanRT\Uninstall${PRODUCTNAME}.exe" /S _?=$INSTDIR' |
Mark Young | f1bdefc | 2016-01-29 16:09:29 -0700 | [diff] [blame] | 751 | |
| 752 | # Delete the copy of the uninstaller we ran |
David Pinedo | 19fc396 | 2016-06-07 09:35:56 -0600 | [diff] [blame] | 753 | Delete /REBOOTOK "$TEMP\VulkanRT\Uninstall${PRODUCTNAME}.exe" |
Mark Young | f1bdefc | 2016-01-29 16:09:29 -0700 | [diff] [blame] | 754 | |
| 755 | # Set an error message to output |
David Pinedo | a6d46a8 | 2016-02-12 12:23:57 -0700 | [diff] [blame] | 756 | SetErrorLevel $1 |
Mark Young | f1bdefc | 2016-01-29 16:09:29 -0700 | [diff] [blame] | 757 | |
| 758 | Quit |
| 759 | ${EndIf} |
| 760 | FunctionEnd |
David Pinedo | 6ab257c | 2016-02-10 11:03:29 -0700 | [diff] [blame] | 761 | |
| 762 | # Check for errors during uninstall. If we hit an error, don't attempt |
David Pinedo | 19fc396 | 2016-06-07 09:35:56 -0600 | [diff] [blame] | 763 | # to do anything. Just set a non-zero return code and continue. |
David Pinedo | 6ab257c | 2016-02-10 11:03:29 -0700 | [diff] [blame] | 764 | Function un.CheckForError |
| 765 | ${If} ${Errors} |
| 766 | # IHV's using this install may want no message box. |
David Pinedo | e80978b | 2016-02-13 14:06:55 -0700 | [diff] [blame] | 767 | MessageBox MB_OK|MB_ICONSTOP "${errorMessage1un}${errorMessage2}Errorcode: $1$\r$\n" /SD IDOK |
David Pinedo | 6ab257c | 2016-02-10 11:03:29 -0700 | [diff] [blame] | 768 | |
| 769 | # Set an error message to output |
David Pinedo | a6d46a8 | 2016-02-12 12:23:57 -0700 | [diff] [blame] | 770 | SetErrorLevel $1 |
David Pinedo | 6ab257c | 2016-02-10 11:03:29 -0700 | [diff] [blame] | 771 | |
David Pinedo | 6ab257c | 2016-02-10 11:03:29 -0700 | [diff] [blame] | 772 | ${EndIf} |
| 773 | FunctionEnd |