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