blob: c51c7cc69dda6f2ce8f60182d437727d1c5dd4bd [file] [log] [blame]
David Pinedoc21fdb92016-01-04 16:31:57 -07001# NSIS Script for creating the Windows Vulkan RT installer.
2#
David Pinedo1e368f72016-02-04 17:04:44 -07003# Copyright (c) 2015-2016 The Khronos Group Inc.
4# Copyright (c) 2015-2016 Valve Corporation
5# Copyright (c) 2015-2016 LunarG, Inc.
David Pinedoc21fdb92016-01-04 16:31:57 -07006#
David Pinedo1e368f72016-02-04 17:04:44 -07007# Permission is hereby granted, free of charge, to any person obtaining a copy
8# of this software and/or associated documentation files (the "Materials"), to
9# deal in the Materials without restriction, including without limitation the
10# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
11# sell copies of the Materials, and to permit persons to whom the Materials are
12# furnished to do so, subject to the following conditions:
David Pinedoc21fdb92016-01-04 16:31:57 -070013#
David Pinedo1e368f72016-02-04 17:04:44 -070014# The above copyright notice(s) and this permission notice shall be included in
15# all copies or substantial portions of the Materials.
David Pinedoc21fdb92016-01-04 16:31:57 -070016#
David Pinedo1e368f72016-02-04 17:04:44 -070017# THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
David Pinedoc21fdb92016-01-04 16:31:57 -070018# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
David Pinedo1e368f72016-02-04 17:04:44 -070019# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
David Pinedoc21fdb92016-01-04 16:31:57 -070020#
David Pinedo1e368f72016-02-04 17:04:44 -070021# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
22# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE
24# USE OR OTHER DEALINGS IN THE MATERIALS.
25#
26# Author: David Pinedo <david@LunarG.com>
27# Author: Mark Young <mark@LunarG.com>
David Pinedoc21fdb92016-01-04 16:31:57 -070028#
29
30
31# Version information
David Pinedo3bdbe5d2016-01-12 16:14:53 -070032# Set VERSION_BUILDNO to:
33# x.pre.z for prereleases
34# x for releases
35#
David Pinedoc21fdb92016-01-04 16:31:57 -070036!define PRODUCTNAME "VulkanRT"
David Pinedof2defe32016-01-06 16:34:27 -070037!define VERSION_ABI_MAJOR "1"
David Pinedo3bdbe5d2016-01-12 16:14:53 -070038!define VERSION_API_MAJOR "1"
39!define VERSION_MINOR "0"
40!define VERSION_PATCH "1"
Mark Youngd6897a32016-01-20 14:48:21 -070041!define VERSION_BUILDNO "0.pre.1"
David Pinedo55805972016-02-08 12:20:11 -070042!define PUBLISHER "YourCompany, Inc."
David Pinedo3bdbe5d2016-01-12 16:14:53 -070043#!define VERSION_BUILDNO "0"
44!define PRODUCTVERSION "${VERSION_API_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.${VERSION_BUILDNO}"
David Pinedoc21fdb92016-01-04 16:31:57 -070045
David Pinedoe8e52032016-01-06 09:59:58 -070046# Includes
47!include LogicLib.nsh
48
David Pinedoc21fdb92016-01-04 16:31:57 -070049# This number is determined by doing an install, and then from Windows Explorer,
50# doing a "Properties" on the install directory. Add to this the size of the
51# files installed to C:\Windows\System32. And then add a little bit more.
David Pinedo94e29b72016-01-04 16:38:15 -070052# The units are 1K bytes.
David Pinedo261d9782016-02-03 13:38:40 -070053!define ESTIMATEDSIZE "1700"
David Pinedoc21fdb92016-01-04 16:31:57 -070054
Mark Youngf1bdefc2016-01-29 16:09:29 -070055# This is used for the error message if a problem occurs during install.
56!define errorMessage1 "Installation of ${PRODUCTNAME} failed!$\r$\n"
David Pinedoe80978b2016-02-13 14:06:55 -070057!define errorMessage1un "Uninstall of ${PRODUCTNAME} failed!$\r$\n"
Mark Youngf1bdefc2016-01-29 16:09:29 -070058!define errorMessage2 "Uninstalling any installed items and exiting.$\r$\n"
59
David Pinedoc21fdb92016-01-04 16:31:57 -070060# Set the icon
David Pinedof79938f2016-02-02 16:10:39 -070061!define ICOFILE "V.ico"
David Pinedoc21fdb92016-01-04 16:31:57 -070062Icon ${ICOFILE}
63UninstallIcon ${ICOFILE}
64WindowIcon off
65
David Pinedo5925ba02016-03-03 21:25:45 -070066# If /DUNINSTALLER was specified, Create the uinstaller
67!ifdef UNINSTALLER
68 !echo "Creating RT uninstaller...."
69 OutFile "$%TEMP%\tempinstaller.exe"
70 SetCompress off
71!else
72 !echo "Creating RT installer...."
73
74 # Define name of installer
75 OutFile "VulkanRT-${PRODUCTVERSION}-Installer.exe"
76 SetCompressor /SOLID lzma
77
78!endif
David Pinedoc21fdb92016-01-04 16:31:57 -070079
80# Define default installation directory
Mark Young4b8b5482016-01-15 15:09:39 -070081InstallDir "$PROGRAMFILES\${PRODUCTNAME}\${PRODUCTVERSION}"
David Pinedoc21fdb92016-01-04 16:31:57 -070082
David Pinedo32eb2ec2016-02-09 09:15:34 -070083# Version string used in file names
David Pinedoe8e52032016-01-06 09:59:58 -070084Var FileVersion
David Pinedoc21fdb92016-01-04 16:31:57 -070085
David Pinedo32eb2ec2016-02-09 09:15:34 -070086# Directory RT was installed to.
87# The uninstaller can't just use $INSTDIR because it is set to the
88# directory the uninstaller exe file is located in.
David Pinedo5925ba02016-03-03 21:25:45 -070089!ifdef UNINSTALLER
David Pinedo32eb2ec2016-02-09 09:15:34 -070090Var IDir
David Pinedo5925ba02016-03-03 21:25:45 -070091!endif
David Pinedo32eb2ec2016-02-09 09:15:34 -070092
David Pinedo9d092772016-02-09 14:44:05 -070093# Install count
94Var IC
95
David Pinedoa6d46a82016-02-12 12:23:57 -070096# Error code from powershell script
97Var PsErr
98
David Pinedoe8e52032016-01-06 09:59:58 -070099
100#############################################
101# StrRep - string replace
102
103!define StrRep "!insertmacro StrRep"
104!macro StrRep output string old new
105 Push `${string}`
106 Push `${old}`
107 Push `${new}`
108 !ifdef __UNINSTALL__
109 Call un.StrRep
110 !else
111 Call StrRep
112 !endif
113 Pop ${output}
114!macroend
115
116!macro Func_StrRep un
117 Function ${un}StrRep
118 Exch $R2 ;new
119 Exch 1
120 Exch $R1 ;old
121 Exch 2
122 Exch $R0 ;string
123 Push $R3
124 Push $R4
125 Push $R5
126 Push $R6
127 Push $R7
128 Push $R8
129 Push $R9
130
131 StrCpy $R3 0
132 StrLen $R4 $R1
133 StrLen $R6 $R0
134 StrLen $R9 $R2
135 loop:
136 StrCpy $R5 $R0 $R4 $R3
137 StrCmp $R5 $R1 found
138 StrCmp $R3 $R6 done
139 IntOp $R3 $R3 + 1 ;move offset by 1 to check the next character
140 Goto loop
141 found:
142 StrCpy $R5 $R0 $R3
143 IntOp $R8 $R3 + $R4
144 StrCpy $R7 $R0 "" $R8
145 StrCpy $R0 $R5$R2$R7
146 StrLen $R6 $R0
147 IntOp $R3 $R3 + $R9 ;move offset by length of the replacement string
148 Goto loop
149 done:
150
151 Pop $R9
152 Pop $R8
153 Pop $R7
154 Pop $R6
155 Pop $R5
156 Pop $R4
157 Pop $R3
158 Push $R0
159 Push $R1
160 Pop $R0
161 Pop $R1
162 Pop $R0
163 Pop $R2
164 Exch $R1
165 FunctionEnd
166!macroend
167!insertmacro Func_StrRep ""
168!insertmacro Func_StrRep "un."
169
170#############################################
171# x64 macros
172
173!define IsWow64 `"" IsWow64 ""`
174!macro _IsWow64 _a _b _t _f
175 !insertmacro _LOGICLIB_TEMP
176 System::Call kernel32::GetCurrentProcess()p.s
177 System::Call kernel32::IsWow64Process(ps,*i0s)
178 Pop $_LOGICLIB_TEMP
179 !insertmacro _!= $_LOGICLIB_TEMP 0 `${_t}` `${_f}`
180!macroend
181
182!define RunningX64 `"" RunningX64 ""`
183!macro _RunningX64 _a _b _t _f
184 !if ${NSIS_PTR_SIZE} > 4
185 !insertmacro LogicLib_JumpToBranch `${_t}` `${_f}`
186 !else
187 !insertmacro _IsWow64 `${_a}` `${_b}` `${_t}` `${_f}`
188 !endif
189!macroend
190
191!define DisableX64FSRedirection "!insertmacro DisableX64FSRedirection"
192!macro DisableX64FSRedirection
193 System::Call kernel32::Wow64EnableWow64FsRedirection(i0)
194!macroend
195
196!define EnableX64FSRedirection "!insertmacro EnableX64FSRedirection"
197!macro EnableX64FSRedirection
198 System::Call kernel32::Wow64EnableWow64FsRedirection(i1)
199!macroend
200
David Pinedoc21fdb92016-01-04 16:31:57 -0700201
David Pinedoc21fdb92016-01-04 16:31:57 -0700202# Need admin to write to C:\Windows\System32 and install dir
203RequestExecutionLevel admin
204
Mark Youngf1bdefc2016-01-29 16:09:29 -0700205Function .onInit
David Pinedo1e368f72016-02-04 17:04:44 -0700206
David Pinedo5925ba02016-03-03 21:25:45 -0700207!ifdef UNINSTALLER
208 ; Write out the uinstaller and quit
209 WriteUninstaller "$%TEMP%\Uninstall${PRODUCTNAME}.exe"
210 Quit
211!endif
212
Mark Youngf1bdefc2016-01-29 16:09:29 -0700213FunctionEnd
214
David Pinedoc21fdb92016-01-04 16:31:57 -0700215AddBrandingImage left 150
216Caption "${PRODUCTNAME} ${PRODUCTVERSION} Setup"
217Name "${PRODUCTNAME} ${PRODUCTVERSION}"
David Pinedo41eb93f2016-01-29 12:20:49 -0700218LIcenseData "VULKANRT_LICENSE.rtf"
David Pinedoc21fdb92016-01-04 16:31:57 -0700219Page custom brandimage "" ": Brand Image"
David Pinedo41eb93f2016-01-29 12:20:49 -0700220Page license
David Pinedoc21fdb92016-01-04 16:31:57 -0700221Page directory
222Page instfiles
223UninstallCaption "\${PRODUCTNAME} ${PRODUCTVERSION} Uninstall"
224UninstallText "This wizard will uninstall ${PRODUCTNAME} ${PRODUCTVERSION} from your computer. Click Uninstall to start the uninstallation."
225UninstPage custom un.brandimage "" ": Brand Image"
226UninstPage uninstConfirm
227UninstPage instFiles
228
David Pinedo37976332016-02-10 16:20:45 -0700229# File Properties
230VIProductVersion "${PRODUCTVERSION}"
231VIAddVersionKey "ProductName" "Vulkan Runtime"
232VIAddVersionKey "FileVersion" "${PRODUCTVERSION}"
233VIAddVersionKey "ProductVersion" "${PRODUCTVERSION}"
234VIAddVersionKey "FileDescription" "Vulkan Runtime Installer"
235VIAddVersionKey "LegalCopyright" ""
236
David Pinedoc21fdb92016-01-04 16:31:57 -0700237# Start default section
238Section
239
David Pinedoef68bbe2016-03-29 13:46:12 -0600240 # Turn on logging
241 LogSet on
242
243 # Remove contents of temp dir
244 SetOutPath "$TEMP\VulkanRT"
245 RmDir /R "$TEMP\VulkanRT"
246
Mark Younga8557b82016-01-15 16:01:46 -0700247 # If running on a 64-bit OS machine, disable registry re-direct since we're running as a 32-bit executable.
Mark Youngdd9eca72016-01-15 14:11:32 -0700248 ${If} ${RunningX64}
Mark Youngf1bdefc2016-01-29 16:09:29 -0700249
Mark Youngdd9eca72016-01-15 14:11:32 -0700250 ${DisableX64FSRedirection}
251 SetRegView 64
David Pinedoc21fdb92016-01-04 16:31:57 -0700252
Mark Young4b8b5482016-01-15 15:09:39 -0700253 ${Endif}
David Pinedoc21fdb92016-01-04 16:31:57 -0700254
David Pinedo7f44f4f2016-03-18 13:15:27 -0600255 # Create our temp directory, with minimal permissions
256 SetOutPath "$TEMP\VulkanRT"
257 AccessControl::DisableFileInheritance $TEMP\VulkanRT
258 AccessControl::SetFileOwner $TEMP\VulkanRT "Administrators"
259 AccessControl::ClearOnFile $TEMP\VulkanRT "Administrators" "FullAccess"
260 AccessControl::SetOnFile $TEMP\VulkanRT "SYSTEM" "FullAccess"
261 AccessControl::GrantOnFile $TEMP\VulkanRT "Everyone" "ListDirectory"
262 AccessControl::GrantOnFile $TEMP\VulkanRT "Everyone" "GenericExecute"
263 AccessControl::GrantOnFile $TEMP\VulkanRT "Everyone" "GenericRead"
264 AccessControl::GrantOnFile $TEMP\VulkanRT "Everyone" "ReadAttributes"
265 StrCpy $1 10
266 Call CheckForError
267
268 # Check the registry to see if we are already installed
David Pinedo55805972016-02-08 12:20:11 -0700269 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "InstallDir"
David Pinedo6ab257c2016-02-10 11:03:29 -0700270
271 # If the registry entry isn't there, it will throw an error as well as return a blank value. So, clear the errors.
272 ${If} ${Errors}
273
274 # Nothing else to do since there is no previous install
275 ClearErrors
276
277 ${Else}
278
279 # Use the previous install directory, so we don't have to keep tracking every possible runtime install.
280 strcmp $INSTDIR $0 notinstalled
281
282 ${If} $0 != ""
David Pinedo4ccea8a2016-02-11 13:49:09 -0700283 MessageBox MB_OK "The Windows Vulkan Runtime is already installed to $0. It will be re-installed to the same folder." /SD IDOK
David Pinedo6ab257c2016-02-10 11:03:29 -0700284 Strcpy $INSTDIR $0
285 ${Endif}
286
287 notinstalled:
288
289 ${EndIf}
David Pinedo55805972016-02-08 12:20:11 -0700290
Mark Youngf1bdefc2016-01-29 16:09:29 -0700291 SetOutPath "$INSTDIR"
David Pinedo7f44f4f2016-03-18 13:15:27 -0600292 AccessControl::DisableFileInheritance $INSTDIR
293 AccessControl::SetFileOwner $INSTDIR "Administrators"
294 AccessControl::ClearOnFile $INSTDIR "Administrators" "FullAccess"
295 AccessControl::SetOnFile $INSTDIR "SYSTEM" "FullAccess"
296 AccessControl::GrantOnFile $INSTDIR "Everyone" "ListDirectory"
297 AccessControl::GrantOnFile $INSTDIR "Everyone" "GenericExecute"
298 AccessControl::GrantOnFile $INSTDIR "Everyone" "GenericRead"
299 AccessControl::GrantOnFile $INSTDIR "Everyone" "ReadAttributes"
Mark Youngf1bdefc2016-01-29 16:09:29 -0700300 File ${ICOFILE}
301 File VULKANRT_LICENSE.RTF
David Pinedo70d08eb2016-02-05 14:45:15 -0700302 File LICENSE.txt
Mark Youngf1bdefc2016-01-29 16:09:29 -0700303 File ConfigLayersAndVulkanDLL.ps1
David Pinedo7f44f4f2016-03-18 13:15:27 -0600304 StrCpy $1 15
David Pinedo6ab257c2016-02-10 11:03:29 -0700305 Call CheckForError
Mark Youngf1bdefc2016-01-29 16:09:29 -0700306
David Pinedo5925ba02016-03-03 21:25:45 -0700307 # Add the signed uninstaller
308 !ifndef UNINSTALLER
309 SetOutPath $INSTDIR
310 File "Uninstall${PRODUCTNAME}.exe"
311 !endif
312
David Pinedo7f44f4f2016-03-18 13:15:27 -0600313 StrCpy $1 20
David Pinedo6ab257c2016-02-10 11:03:29 -0700314 Call CheckForError
Mark Youngf1bdefc2016-01-29 16:09:29 -0700315
316 # Reference count the number of times we have been installed.
David Pinedo9d092772016-02-09 14:44:05 -0700317 # The reference count is stored in the registry value InstallCount
Mark Youngf1bdefc2016-01-29 16:09:29 -0700318 ReadRegDword $1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "InstallCount"
319 IntOp $1 $1 + 1
David Pinedo9d092772016-02-09 14:44:05 -0700320 StrCpy $IC $1
321
322 # We need to create a new folder for each install. Since we are using counted installs,
323 # an uninstall when the count is greater than one would result in the install
324 # count being decremented and nothing being removed. But Windows Add/Remove Programs
325 # generates a warning Window if the install dir for a package that is removed is not
326 # deleted. So we create a unique folder for each counted install.
327 # We fudge it a little and only create one folder, and rename it after each
328 # install/uninstall.
329
330 # Create the install instance folder. We rename the install instance folder if it already exists.
331 # Then copy the uninstaller to it.
332 ${If} $IC > 2
333 IntOp $1 $IC - 1
334 Rename "$INSTDIR\Instance_$1" "$INSTDIR\Instance_$IC"
335 CopyFiles /SILENT "$INSTDIR\Uninstall${PRODUCTNAME}.exe" "$INSTDIR\Instance_$IC"
336 ${ElseIf} $IC = 2
337 CreateDirectory "$INSTDIR\Instance_$IC"
338 CopyFiles /SILENT "$INSTDIR\Uninstall${PRODUCTNAME}.exe" "$INSTDIR\Instance_$IC"
339 ${EndIf}
340
David Pinedo1e368f72016-02-04 17:04:44 -0700341
Mark Youngf1bdefc2016-01-29 16:09:29 -0700342 # If the registry entry isn't there, it will throw an error as well as return a blank value. So, clear the errors.
343 ${If} ${Errors}
344 ClearErrors
345 ${EndIf}
346
Mark Youngf1bdefc2016-01-29 16:09:29 -0700347 # Modify registry for Programs and Features
348 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "DisplayName" "Vulkan Run Time Libraries ${PRODUCTVERSION}"
349 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "UninstallString" "$INSTDIR\Uninstall${PRODUCTNAME}.exe"
David Pinedo55805972016-02-08 12:20:11 -0700350 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "Publisher" "${PUBLISHER}"
Mark Youngf1bdefc2016-01-29 16:09:29 -0700351 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "DisplayVersion" "${PRODUCTVERSION}"
352 WriteRegDword HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "EstimatedSize" ${ESTIMATEDSIZE}
353 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "DisplayIcon" "$\"$INSTDIR\${ICOFILE}$\""
David Pinedo55805972016-02-08 12:20:11 -0700354 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "InstallDir" "$INSTDIR"
David Pinedo9d092772016-02-09 14:44:05 -0700355 WriteRegDword HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "InstallCount" $IC
356
357 ${If} $IC > 1
358 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}-$IC" "DisplayName" "Vulkan Run Time Libraries ${PRODUCTVERSION}"
359 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}-$IC" "UninstallString" "$INSTDIR\Instance_$IC\Uninstall${PRODUCTNAME}.exe"
360 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}-$IC" "Publisher" "${PUBLISHER}"
361 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}-$IC" "DisplayVersion" "${PRODUCTVERSION}"
362 WriteRegDword HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}-$IC" "EstimatedSize" ${ESTIMATEDSIZE}
363 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}-$IC" "DisplayIcon" "$\"$INSTDIR\${ICOFILE}$\""
364 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}-$IC" "InstallDir" "$INSTDIR\Instance_$IC"
365 WriteRegDword HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}-$IC" "InstallCount" $IC
366 ${EndIf}
367
368 # Set SystemComponent to 1 for those instances that are not to be visible to Add/Remove Programs.
369 # Set SystemComponent to 0 for the instance that is to be visible to Add/Remove Programs.
370 ${If} $IC > 2
371 IntOp $1 $IC - 1
372 WriteRegDword HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}-$IC" "SystemComponent" 0
373 WriteRegDword HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}-$1" "SystemComponent" 1
374 ${ElseIf} $IC = 2
375 WriteRegDword HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}-$IC" "SystemComponent" 0
376 WriteRegDword HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "SystemComponent" 1
377 ${Else}
378 WriteRegDword HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "SystemComponent" 0
379 ${EndIf}
380
David Pinedo7f44f4f2016-03-18 13:15:27 -0600381 StrCpy $1 25
David Pinedo6ab257c2016-02-10 11:03:29 -0700382 Call CheckForError
Mark Youngf1bdefc2016-01-29 16:09:29 -0700383
Mark Young4b8b5482016-01-15 15:09:39 -0700384 # Set up version number for file names
385 ${StrRep} $0 ${VERSION_BUILDNO} "." "-"
386 StrCpy $FileVersion ${VERSION_ABI_MAJOR}-${VERSION_API_MAJOR}-${VERSION_MINOR}-${VERSION_PATCH}-$0
387
David Pinedof2c7ed92016-03-29 16:29:00 -0600388 # Complete remove the Vulkan Start Menu. Prior version of the Vulkan RT
389 # created Start Menu items, we don't do that anymore.
David Pinedocf290632016-03-03 12:36:24 -0700390 SetShellVarContext all
David Pinedof2c7ed92016-03-29 16:29:00 -0600391 RmDir /R "$SMPROGRAMS\Vulkan"
David Pinedocf290632016-03-03 12:36:24 -0700392 ClearErrors
393
Mark Young4b8b5482016-01-15 15:09:39 -0700394 # If running on a 64-bit OS machine
395 ${If} ${RunningX64}
Mark Youngf1bdefc2016-01-29 16:09:29 -0700396
Mark Youngdd9eca72016-01-15 14:11:32 -0700397 # 32-bit DLLs/EXEs destined for SysWOW64
398 ##########################################
399 SetOutPath $WINDIR\SysWow64
400 File /oname=vulkan-$FileVersion.dll ..\build32\loader\Release\vulkan-${VERSION_ABI_MAJOR}.dll
401 File /oname=vulkaninfo-$FileVersion.exe ..\build32\demos\Release\vulkaninfo.exe
David Pinedo7f44f4f2016-03-18 13:15:27 -0600402 StrCpy $1 30
David Pinedo6ab257c2016-02-10 11:03:29 -0700403 Call CheckForError
Mark Youngf1bdefc2016-01-29 16:09:29 -0700404
Mark Youngdd9eca72016-01-15 14:11:32 -0700405 # 64-bit DLLs/EXEs
406 ##########################################
407 SetOutPath $WINDIR\System32
408 File /oname=vulkan-$FileVersion.dll ..\build\loader\Release\vulkan-${VERSION_ABI_MAJOR}.dll
David Pinedo7f44f4f2016-03-18 13:15:27 -0600409 StrCpy $1 35
David Pinedo6ab257c2016-02-10 11:03:29 -0700410 Call CheckForError
Mark Youngdd9eca72016-01-15 14:11:32 -0700411
412 # vulkaninfo.exe
413 File /oname=vulkaninfo-$FileVersion.exe ..\build\demos\Release\vulkaninfo.exe
414 SetOutPath "$INSTDIR"
415 File ..\build\demos\Release\vulkaninfo.exe
Mark Youngc60de9c2016-01-25 09:46:50 -0700416 File /oname=vulkaninfo32.exe ..\build32\demos\Release\vulkaninfo.exe
David Pinedo7f44f4f2016-03-18 13:15:27 -0600417 StrCpy $1 40
David Pinedo6ab257c2016-02-10 11:03:29 -0700418 Call CheckForError
Mark Youngdd9eca72016-01-15 14:11:32 -0700419
420 # Run the ConfigLayersAndVulkanDLL.ps1 script to copy the most recent version of
421 # vulkan-<abimajor>-*.dll to vulkan-<abimajor>.dll, and to set up layer registry
422 # entries to use layers from the corresponding SDK
Mark Young4b8b5482016-01-15 15:09:39 -0700423 nsExec::ExecToStack 'powershell -NoLogo -NonInteractive -WindowStyle Hidden -inputformat none -ExecutionPolicy RemoteSigned -File ConfigLayersAndVulkanDLL.ps1 ${VERSION_ABI_MAJOR} 64'
David Pinedoa6d46a82016-02-12 12:23:57 -0700424 pop $PsErr
425 ${If} $PsErr != 0
426 SetErrors
427 ${EndIf}
David Pinedo7f44f4f2016-03-18 13:15:27 -0600428 StrCpy $1 45
David Pinedo6ab257c2016-02-10 11:03:29 -0700429 Call CheckForError
Mark Youngdd9eca72016-01-15 14:11:32 -0700430
Mark Youngdd9eca72016-01-15 14:11:32 -0700431 # Else, running on a 32-bit OS machine
432 ${Else}
Mark Youngf1bdefc2016-01-29 16:09:29 -0700433
Mark Young4b8b5482016-01-15 15:09:39 -0700434 # 32-bit DLLs/EXEs destined for SysWOW64
435 ##########################################
436 SetOutPath $WINDIR\System32
437 File /oname=vulkan-$FileVersion.dll ..\build32\loader\Release\vulkan-${VERSION_ABI_MAJOR}.dll
David Pinedo7f44f4f2016-03-18 13:15:27 -0600438 StrCpy $1 50
David Pinedo6ab257c2016-02-10 11:03:29 -0700439 Call CheckForError
Mark Young4b8b5482016-01-15 15:09:39 -0700440
441 # vulkaninfo.exe
442 File /oname=vulkaninfo-$FileVersion.exe ..\build32\demos\Release\vulkaninfo.exe
443 SetOutPath "$INSTDIR"
444 File ..\build32\demos\Release\vulkaninfo.exe
David Pinedo7f44f4f2016-03-18 13:15:27 -0600445 StrCpy $1 55
David Pinedo6ab257c2016-02-10 11:03:29 -0700446 Call CheckForError
Mark Young4b8b5482016-01-15 15:09:39 -0700447
448 # Run the ConfigLayersAndVulkanDLL.ps1 script to copy the most recent version of
449 # vulkan-<abimajor>-*.dll to vulkan-<abimajor>.dll, and to set up layer registry
450 # entries to use layers from the corresponding SDK
451 nsExec::ExecToStack 'powershell -NoLogo -NonInteractive -WindowStyle Hidden -inputformat none -ExecutionPolicy RemoteSigned -File ConfigLayersAndVulkanDLL.ps1 ${VERSION_ABI_MAJOR} 32'
David Pinedoa6d46a82016-02-12 12:23:57 -0700452 pop $PsErr
453 ${If} $PsErr != 0
454 SetErrors
455 ${EndIf}
David Pinedo7f44f4f2016-03-18 13:15:27 -0600456 StrCpy $1 60
David Pinedo6ab257c2016-02-10 11:03:29 -0700457 Call CheckForError
Mark Young4b8b5482016-01-15 15:09:39 -0700458
Mark Youngdd9eca72016-01-15 14:11:32 -0700459 ${Endif}
David Pinedoc21fdb92016-01-04 16:31:57 -0700460
Mark Youngf1bdefc2016-01-29 16:09:29 -0700461 # We are done using ConfigLayersAndVulkanDLL.ps1, delete it. It will be re-installed
462 # by the uninstaller when it needs to be run again during uninstall.
463 Delete ConfigLayersAndVulkanDLL.ps1
Mark Young4b8b5482016-01-15 15:09:39 -0700464
465 # Possibly install MSVC 2013 redistributables
David Pinedo89845c42016-03-15 16:42:14 -0600466 ClearErrors
Mark Youngafc7c9b2016-02-12 13:56:56 -0700467 ${If} ${RunningX64}
Mark Youngafc7c9b2016-02-12 13:56:56 -0700468 ReadRegDword $1 HKLM "SOFTWARE\WOW6432Node\Microsoft\DevDiv\vc\Servicing\12.0\RuntimeMinimum" "Install"
David Pinedo89845c42016-03-15 16:42:14 -0600469 ${If} ${Errors}
470 StrCpy $1 0
471 ClearErrors
472 ${Endif}
Mark Youngafc7c9b2016-02-12 13:56:56 -0700473 ${Else}
David Pinedo89845c42016-03-15 16:42:14 -0600474 StrCpy $1 1
Mark Youngafc7c9b2016-02-12 13:56:56 -0700475 ${Endif}
David Pinedo89845c42016-03-15 16:42:14 -0600476 ReadRegDword $2 HKLM "SOFTWARE\Microsoft\DevDiv\vc\Servicing\12.0\RuntimeMinimum" "Install"
477 ${If} ${Errors}
478 StrCpy $2 0
479 ClearErrors
480 ${Endif}
481 IntOp $3 $1 + $2
482 ${If} $3 <= 1
483 # If either x86 or x64 redistributables are not present, install redistributables.
484 # We install both resdistributables because we have found that the x86 redist
485 # will uninstall the x64 redist if the x64 redistrib is an old version. Amazing, isn't it?
David Pinedo7f44f4f2016-03-18 13:15:27 -0600486 SetOutPath "$TEMP\VulkanRT"
David Pinedo89845c42016-03-15 16:42:14 -0600487 ${If} ${RunningX64}
488 File vcredist_x64.exe
David Pinedo7f44f4f2016-03-18 13:15:27 -0600489 ExecWait '"$TEMP\VulkanRT\vcredist_x64.exe" /quiet /norestart'
David Pinedo89845c42016-03-15 16:42:14 -0600490 ${Endif}
491 File vcredist_x86.exe
David Pinedo7f44f4f2016-03-18 13:15:27 -0600492 ExecWait '"$TEMP\VulkanRT\vcredist_x86.exe" /quiet /norestart'
David Pinedo89845c42016-03-15 16:42:14 -0600493 ${Endif}
David Pinedo7f44f4f2016-03-18 13:15:27 -0600494 StrCpy $1 65
David Pinedo6ab257c2016-02-10 11:03:29 -0700495 Call CheckForError
Mark Young4b8b5482016-01-15 15:09:39 -0700496
David Pinedoef68bbe2016-03-29 13:46:12 -0600497 # Finish logging and move log file to TEMP dir
498 LogSet off
499 Rename "$INSTDIR\install.log" "$TEMP\VulkanRT\Install.log"
500
David Pinedoc21fdb92016-01-04 16:31:57 -0700501SectionEnd
502
503# Uninstaller section start
David Pinedo5925ba02016-03-03 21:25:45 -0700504!ifdef UNINSTALLER
David Pinedoc21fdb92016-01-04 16:31:57 -0700505Section "uninstall"
506
David Pinedoef68bbe2016-03-29 13:46:12 -0600507 # Turn on logging
508 LogSet on
509
510 # Remove contents of temp dir
511 SetOutPath "$TEMP\VulkanRT"
512 RmDir /R "$TEMP\VulkanRT"
513
Mark Younga8557b82016-01-15 16:01:46 -0700514 # If running on a 64-bit OS machine, disable registry re-direct since we're running as a 32-bit executable.
Mark Youngdd9eca72016-01-15 14:11:32 -0700515 ${If} ${RunningX64}
David Pinedoc21fdb92016-01-04 16:31:57 -0700516
Mark Youngdd9eca72016-01-15 14:11:32 -0700517 ${DisableX64FSRedirection}
518 SetRegView 64
Mark Youngf1bdefc2016-01-29 16:09:29 -0700519
Mark Young4b8b5482016-01-15 15:09:39 -0700520 ${Endif}
David Pinedoc21fdb92016-01-04 16:31:57 -0700521
David Pinedo32eb2ec2016-02-09 09:15:34 -0700522 # Look up the install dir and remove files from that directory.
523 # We do this so that the uninstaller can be run from any directory.
524 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "InstallDir"
David Pinedo9d092772016-02-09 14:44:05 -0700525 StrCpy $IDir $0
David Pinedo32eb2ec2016-02-09 09:15:34 -0700526
David Pinedo7f44f4f2016-03-18 13:15:27 -0600527 StrCpy $1 70
David Pinedo6ab257c2016-02-10 11:03:29 -0700528 Call un.CheckForError
529
David Pinedo32eb2ec2016-02-09 09:15:34 -0700530 SetOutPath "$IDir"
David Pinedoc21fdb92016-01-04 16:31:57 -0700531
Mark Young4b8b5482016-01-15 15:09:39 -0700532 # Set up version number for file names
533 ${StrRep} $0 ${VERSION_BUILDNO} "." "-"
534 StrCpy $FileVersion ${VERSION_ABI_MAJOR}-${VERSION_API_MAJOR}-${VERSION_MINOR}-${VERSION_PATCH}-$0
David Pinedoc21fdb92016-01-04 16:31:57 -0700535
Mark Young4b8b5482016-01-15 15:09:39 -0700536 # Decrement the number of times we have been installed.
David Pinedo9d092772016-02-09 14:44:05 -0700537 ReadRegDword $IC HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "InstallCount"
538 IntOp $1 $IC - 1
David Pinedob4d7f6a2016-01-27 14:15:25 -0700539 WriteRegDword HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "InstallCount" $1
David Pinedoc21fdb92016-01-04 16:31:57 -0700540
David Pinedo9d092772016-02-09 14:44:05 -0700541 # Rename the install dir for this instance if is not the last uninstall
542 ${If} $IC > 2
543 IntOp $1 $IC - 1
544 Rename "$IDir\Instance_$IC" "$IDir\Instance_$1"
545 ${ElseIf} $IC = 2
David Pinedo5925ba02016-03-03 21:25:45 -0700546 Delete /REBOOTOK "$IDir\Instance_$IC\Uninstall${PRODUCTNAME}.exe"
David Pinedo9d092772016-02-09 14:44:05 -0700547 Rmdir /REBOOTOK "$IDir\Instance_$IC"
548 ${Endif}
549
550 # Modify registry for Programs and Features
David Pinedocf290632016-03-03 12:36:24 -0700551
552 ${If} $IC > 1
553 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}-$IC"
554 ${EndIf}
David Pinedo9d092772016-02-09 14:44:05 -0700555 ${If} $IC > 2
556 IntOp $IC $IC - 1
557 WriteRegDword HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}-$IC" "SystemComponent" 0
558 ${ElseIf} $IC = 2
559 WriteRegDword HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "SystemComponent" 0
560 ${Else}
561 # Last uninstall
562 IntOp $IC $IC - 1
563 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}"
564 ${EndIf}
565
David Pinedod133b782016-03-16 14:41:56 -0600566
567 # Install the ConfigLayersAndVulkanDLL.ps1 so we can run it.
568 # It will be deleted later when we remove the install directory.
569 File ConfigLayersAndVulkanDLL.ps1
570
571 # If running on a 64-bit OS machine
572 ${If} ${RunningX64}
573
574 # Delete vulkaninfo.exe in C:\Windows\System32 and C:\Windows\SysWOW64
575 Delete /REBOOTOK $WINDIR\SysWow64\vulkaninfo.exe
576 Delete /REBOOTOK "$WINDIR\SysWow64\vulkaninfo-$FileVersion.exe"
577 Delete /REBOOTOK $WINDIR\System32\vulkaninfo.exe
578 Delete /REBOOTOK "$WINDIR\System32\vulkaninfo-$FileVersion.exe"
579
580 # Delete vullkan dll files: vulkan-<majorabi>.dll and vulkan-<majorabi>-<major>-<minor>-<patch>-<buildno>.dll
581 Delete /REBOOTOK $WINDIR\SysWow64\vulkan-${VERSION_ABI_MAJOR}.dll
582 Delete /REBOOTOK $WINDIR\SysWow64\vulkan-$FileVersion.dll
583 Delete /REBOOTOK $WINDIR\System32\vulkan-${VERSION_ABI_MAJOR}.dll
584 Delete /REBOOTOK $WINDIR\System32\vulkan-$FileVersion.dll
585
586 # Run the ConfigLayersAndVulkanDLL.ps1 script to:
587 # Copy the most recent version of vulkan-<abimajor>-*.dll to vulkan-<abimajor>.dll
588 # Copy the most recent version of vulkaninfo-<abimajor>-*.exe to vulkaninfo.exe
589 # Set up layer registry entries to use layers from the corresponding SDK
590 nsExec::ExecToStack 'powershell -NoLogo -NonInteractive -WindowStyle Hidden -inputformat none -ExecutionPolicy RemoteSigned -File "$IDir\ConfigLayersAndVulkanDLL.ps1" ${VERSION_ABI_MAJOR} 64'
591
592 # Else, running on a 32-bit OS machine
593 ${Else}
594
595 # Delete vulkaninfo.exe in C:\Windows\System32
596 Delete /REBOOTOK $WINDIR\System32\vulkaninfo.exe
597 Delete /REBOOTOK "$WINDIR\System32\vulkaninfo-$FileVersion.exe"
598
599 # Delete vullkan dll files: vulkan-<majorabi>.dll and vulkan-<majorabi>-<major>-<minor>-<patch>-<buildno>.dll
600 Delete /REBOOTOK $WINDIR\System32\vulkan-${VERSION_ABI_MAJOR}.dll
601 Delete /REBOOTOK $WINDIR\System32\vulkan-$FileVersion.dll
602
603 # Run the ConfigLayersAndVulkanDLL.ps1 script to:
604 # Copy the most recent version of vulkan-<abimajor>-*.dll to vulkan-<abimajor>.dll
605 # Copy the most recent version of vulkaninfo-<abimajor>-*.exe to vulkaninfo.exe
606 # Set up layer registry entries to use layers from the corresponding SDK
607 nsExec::ExecToStack 'powershell -NoLogo -NonInteractive -WindowStyle Hidden -inputformat none -ExecutionPolicy RemoteSigned -File "$IDir\ConfigLayersAndVulkanDLL.ps1" ${VERSION_ABI_MAJOR} 32'
608
609 ${EndIf}
610
611 # If Ref Count is zero, uninstall everything
David Pinedo9d092772016-02-09 14:44:05 -0700612 ${If} $IC <= 0
David Pinedoc21fdb92016-01-04 16:31:57 -0700613
Mark Young4b8b5482016-01-15 15:09:39 -0700614 # Remove files in install dir
David Pinedo32eb2ec2016-02-09 09:15:34 -0700615 Delete /REBOOTOK "$IDir\VULKANRT_LICENSE.rtf"
616 Delete /REBOOTOK "$IDir\LICENSE.txt"
David Pinedo5925ba02016-03-03 21:25:45 -0700617 Delete /REBOOTOK "$IDir\Uninstall${PRODUCTNAME}.exe"
David Pinedo32eb2ec2016-02-09 09:15:34 -0700618 Delete /REBOOTOK "$IDir\V.ico"
619 Delete /REBOOTOK "$IDir\ConfigLayersAndVulkanDLL.ps1"
620 Delete /REBOOTOK "$IDir\vulkaninfo.exe"
Mark Youngf1bdefc2016-01-29 16:09:29 -0700621
Mark Youngf7c705b2016-01-26 13:36:28 -0700622 # If running on a 64-bit OS machine
623 ${If} ${RunningX64}
David Pinedo32eb2ec2016-02-09 09:15:34 -0700624 Delete /REBOOTOK "$IDir\vulkaninfo32.exe"
Mark Youngf7c705b2016-01-26 13:36:28 -0700625 ${EndIf}
Mark Young4b8b5482016-01-15 15:09:39 -0700626
David Pinedo7f44f4f2016-03-18 13:15:27 -0600627 StrCpy $1 75
David Pinedo6ab257c2016-02-10 11:03:29 -0700628 Call un.CheckForError
629
David Pinedo32eb2ec2016-02-09 09:15:34 -0700630 # Need to do a SetOutPath to something outside of install dir,
631 # or the uninstall will think install dir is busy
Mark Young4b8b5482016-01-15 15:09:39 -0700632 SetOutPath "$TEMP"
633
634 # Remove install directories
David Pinedo7f44f4f2016-03-18 13:15:27 -0600635 StrCpy $0 "$IDir"
636 Call un.DeleteDirIfEmpty
Mark Young4b8b5482016-01-15 15:09:39 -0700637 StrCpy $0 "$PROGRAMFILES\${PRODUCTNAME}"
638 Call un.DeleteDirIfEmpty
David Pinedocf290632016-03-03 12:36:24 -0700639 ClearErrors
Mark Young4b8b5482016-01-15 15:09:39 -0700640
641 # If any of the remove commands failed, request a reboot
Mark Young0368c7d2016-02-02 10:56:42 -0700642 IfRebootFlag 0 noreboot
643 MessageBox MB_YESNO "A reboot is required to finish the uninstall. Do you wish to reboot now?" /SD IDNO IDNO returnerror
644 Reboot
David Pinedo1e368f72016-02-04 17:04:44 -0700645
Mark Young0368c7d2016-02-02 10:56:42 -0700646 returnerror:
David Pinedo1e368f72016-02-04 17:04:44 -0700647
Mark Young0368c7d2016-02-02 10:56:42 -0700648 # Set an error message to output because we should reboot but didn't (whether because silent uninstall or user choice)
649 SetErrorLevel 3 # ERROR_TOO_MANY_OPEN_FILES
650
Mark Young4b8b5482016-01-15 15:09:39 -0700651 noreboot:
Mark Youngf1bdefc2016-01-29 16:09:29 -0700652
Mark Youngdd9eca72016-01-15 14:11:32 -0700653 ${Endif}
David Pinedoc21fdb92016-01-04 16:31:57 -0700654
David Pinedo7f44f4f2016-03-18 13:15:27 -0600655 StrCpy $1 80
David Pinedo6ab257c2016-02-10 11:03:29 -0700656 Call un.CheckForError
657
David Pinedoef68bbe2016-03-29 13:46:12 -0600658 # Finish logging and move log file to TEMP dir
659 LogSet off
660 Rename "$INSTDIR\install.log" "$TEMP\VulkanRT\Uninstall.log"
David Pinedo7f44f4f2016-03-18 13:15:27 -0600661
David Pinedoc21fdb92016-01-04 16:31:57 -0700662SectionEnd
David Pinedo5925ba02016-03-03 21:25:45 -0700663!endif
David Pinedoc21fdb92016-01-04 16:31:57 -0700664
665Function brandimage
666 SetOutPath "$TEMP"
David Pinedof79938f2016-02-02 16:10:39 -0700667 SetFileAttributes V.bmp temporary
668 File V.bmp
669 SetBrandingImage "$TEMP/V.bmp"
David Pinedoc21fdb92016-01-04 16:31:57 -0700670Functionend
671
672
673Function un.brandimage
674 SetOutPath "$TEMP"
David Pinedof79938f2016-02-02 16:10:39 -0700675 SetFileAttributes V.bmp temporary
676 File V.bmp
677 SetBrandingImage "$TEMP/V.bmp"
David Pinedoc21fdb92016-01-04 16:31:57 -0700678Functionend
679
680Function un.DeleteDirIfEmpty
681 FindFirst $R0 $R1 "$0\*.*"
682 strcmp $R1 "." 0 NoDelete
683 FindNext $R0 $R1
684 strcmp $R1 ".." 0 NoDelete
685 ClearErrors
686 FindNext $R0 $R1
687 IfErrors 0 NoDelete
688 FindClose $R0
689 Sleep 1000
690 RMDir "$0"
691 NoDelete:
692 FindClose $R0
693FunctionEnd
Mark Youngf1bdefc2016-01-29 16:09:29 -0700694
David Pinedo6ab257c2016-02-10 11:03:29 -0700695# Check for errors during install. If we hit an error, stop, uninstall what we've put in so far, and quit.
Mark Youngf1bdefc2016-01-29 16:09:29 -0700696# NOTE: We return a non-zero error code as well.
David Pinedo6ab257c2016-02-10 11:03:29 -0700697Function CheckForError
Mark Youngf1bdefc2016-01-29 16:09:29 -0700698 ${If} ${Errors}
699 # IHV's using this install may want no message box.
David Pinedoa6d46a82016-02-12 12:23:57 -0700700 MessageBox MB_OK|MB_ICONSTOP "${errorMessage1}${errorMessage2}Errorcode: $1$\r$\n" /SD IDOK
Mark Youngf1bdefc2016-01-29 16:09:29 -0700701
David Pinedoef68bbe2016-03-29 13:46:12 -0600702 # Finish logging and move log file to TEMP dir
703 LogSet off
704 Rename "$INSTDIR\install.log" "$TEMP\VulkanRT\install.log"
705
Mark Youngf1bdefc2016-01-29 16:09:29 -0700706 # Copy the uninstaller to a temp folder of our own creation so we can completely
707 # delete the old contents.
David Pinedo7f44f4f2016-03-18 13:15:27 -0600708 SetOutPath "$TEMP\VulkanRT"
709 CopyFiles "$INSTDIR\Uninstall${PRODUCTNAME}.exe" "$TEMP\VulkanRT"
Mark Youngf1bdefc2016-01-29 16:09:29 -0700710
711 # No uninstall using the version in the temporary folder.
David Pinedo7f44f4f2016-03-18 13:15:27 -0600712 ExecWait '"$TEMP\VulkanRT\Uninstall${PRODUCTNAME}.exe" /S _?=$INSTDIR'
Mark Youngf1bdefc2016-01-29 16:09:29 -0700713
714 # Delete the copy of the uninstaller we ran
David Pinedo7f44f4f2016-03-18 13:15:27 -0600715 Delete /REBOOTOK "$TEMP\VulkanRT\Uninstall${PRODUCTNAME}.exe"
716 RmDir /R /REBOOTOK "$TEMP\VulkanRT"
Mark Youngf1bdefc2016-01-29 16:09:29 -0700717
718 # Set an error message to output
David Pinedoa6d46a82016-02-12 12:23:57 -0700719 SetErrorLevel $1
Mark Youngf1bdefc2016-01-29 16:09:29 -0700720
721 Quit
722 ${EndIf}
723FunctionEnd
David Pinedo6ab257c2016-02-10 11:03:29 -0700724
725# Check for errors during uninstall. If we hit an error, don't attempt
726# to do anything. Just set a non-zero return code and quit.
727Function un.CheckForError
728 ${If} ${Errors}
729 # IHV's using this install may want no message box.
David Pinedoe80978b2016-02-13 14:06:55 -0700730 MessageBox MB_OK|MB_ICONSTOP "${errorMessage1un}${errorMessage2}Errorcode: $1$\r$\n" /SD IDOK
David Pinedo6ab257c2016-02-10 11:03:29 -0700731
732 # Set an error message to output
David Pinedoa6d46a82016-02-12 12:23:57 -0700733 SetErrorLevel $1
David Pinedo6ab257c2016-02-10 11:03:29 -0700734
David Pinedoef68bbe2016-03-29 13:46:12 -0600735 # Finish logging and move log file to TEMP dir
736 LogSet off
737 Delete "$TEMP\VulkanRT\Uninstall.log"
738 Rename "$INSTDIR\install.log" "$TEMP\VulkanRT\Uninstall.log"
739
David Pinedo6ab257c2016-02-10 11:03:29 -0700740 Quit
741 ${EndIf}
742FunctionEnd