blob: 45c5f255a3f86052c254c3b5e7d2e186adeac83c [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#
Jon Ashburn3ebf1252016-04-19 11:30:31 -06007# 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 Pinedoc21fdb92016-01-04 16:31:57 -070010#
Jon Ashburn3ebf1252016-04-19 11:30:31 -060011# http://www.apache.org/licenses/LICENSE-2.0
David Pinedoc21fdb92016-01-04 16:31:57 -070012#
Jon Ashburn3ebf1252016-04-19 11:30:31 -060013# 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 Pinedo1e368f72016-02-04 17:04:44 -070018#
19# Author: David Pinedo <david@LunarG.com>
20# Author: Mark Young <mark@LunarG.com>
David Pinedoc21fdb92016-01-04 16:31:57 -070021#
22
23
24# Version information
David Pinedo3bdbe5d2016-01-12 16:14:53 -070025# Set VERSION_BUILDNO to:
David Pinedo657bd742016-05-05 13:52:37 -060026# x.devbuild.z for development builds
David Pinedo3bdbe5d2016-01-12 16:14:53 -070027# x for releases
28#
Lenny Komowbc37ec22016-11-03 15:43:59 -060029
30# Set the default name to "Vulkan", but allow this to be overriden
31!ifndef APINAME
32 !define APINAME "Vulkan"
Lenny Komow307f0e52016-11-07 15:20:54 -070033 !define APILOWER "vulkan"
Lenny Komowbc37ec22016-11-03 15:43:59 -060034!endif
35
Lenny Komowbc37ec22016-11-03 15:43:59 -060036!define PRODUCTNAME "${APINAME}RT"
37
Lenny Komow841d97a2016-08-04 10:32:27 -060038!ifndef HIDE_VERSION
39 !define VERSION_ABI_MAJOR "1"
40 !define VERSION_API_MAJOR "1"
41 !define VERSION_MINOR "0"
42 !define VERSION_PATCH "12"
43 !define VERSION_BUILDNO "0.devbuild.1"
44!endif
45!ifndef HIDE_PUBLISHER
46 !define PUBLISHER "YourCompany, Inc."
47!endif
David Pinedo3bdbe5d2016-01-12 16:14:53 -070048#!define VERSION_BUILDNO "0"
49!define PRODUCTVERSION "${VERSION_API_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.${VERSION_BUILDNO}"
David Pinedoc21fdb92016-01-04 16:31:57 -070050
David Pinedoe8e52032016-01-06 09:59:58 -070051# Includes
52!include LogicLib.nsh
53
David Pinedoc21fdb92016-01-04 16:31:57 -070054# This number is determined by doing an install, and then from Windows Explorer,
55# doing a "Properties" on the install directory. Add to this the size of the
56# files installed to C:\Windows\System32. And then add a little bit more.
David Pinedo94e29b72016-01-04 16:38:15 -070057# The units are 1K bytes.
David Pinedo261d9782016-02-03 13:38:40 -070058!define ESTIMATEDSIZE "1700"
David Pinedoc21fdb92016-01-04 16:31:57 -070059
Mark Youngf1bdefc2016-01-29 16:09:29 -070060# This is used for the error message if a problem occurs during install.
61!define errorMessage1 "Installation of ${PRODUCTNAME} failed!$\r$\n"
David Pinedoe80978b2016-02-13 14:06:55 -070062!define errorMessage1un "Uninstall of ${PRODUCTNAME} failed!$\r$\n"
Mark Youngf1bdefc2016-01-29 16:09:29 -070063!define errorMessage2 "Uninstalling any installed items and exiting.$\r$\n"
64
David Pinedoc21fdb92016-01-04 16:31:57 -070065# Set the icon
David Pinedof79938f2016-02-02 16:10:39 -070066!define ICOFILE "V.ico"
David Pinedoc21fdb92016-01-04 16:31:57 -070067Icon ${ICOFILE}
68UninstallIcon ${ICOFILE}
69WindowIcon off
70
David Pinedo5925ba02016-03-03 21:25:45 -070071# If /DUNINSTALLER was specified, Create the uinstaller
72!ifdef UNINSTALLER
73 !echo "Creating RT uninstaller...."
74 OutFile "$%TEMP%\tempinstaller.exe"
75 SetCompress off
76!else
77 !echo "Creating RT installer...."
78
79 # Define name of installer
Lenny Komowbc37ec22016-11-03 15:43:59 -060080 OutFile "${PRODUCTNAME}-${PRODUCTVERSION}-Installer.exe"
David Pinedo5925ba02016-03-03 21:25:45 -070081 SetCompressor /SOLID lzma
82
83!endif
David Pinedoc21fdb92016-01-04 16:31:57 -070084
85# Define default installation directory
Mark Young4b8b5482016-01-15 15:09:39 -070086InstallDir "$PROGRAMFILES\${PRODUCTNAME}\${PRODUCTVERSION}"
David Pinedoc21fdb92016-01-04 16:31:57 -070087
David Pinedo32eb2ec2016-02-09 09:15:34 -070088# Version string used in file names
David Pinedoe8e52032016-01-06 09:59:58 -070089Var FileVersion
David Pinedoc21fdb92016-01-04 16:31:57 -070090
David Pinedo32eb2ec2016-02-09 09:15:34 -070091# Directory RT was installed to.
92# The uninstaller can't just use $INSTDIR because it is set to the
93# directory the uninstaller exe file is located in.
David Pinedo5925ba02016-03-03 21:25:45 -070094!ifdef UNINSTALLER
David Pinedo32eb2ec2016-02-09 09:15:34 -070095Var IDir
David Pinedo5925ba02016-03-03 21:25:45 -070096!endif
David Pinedo32eb2ec2016-02-09 09:15:34 -070097
David Pinedo9d092772016-02-09 14:44:05 -070098# Install count
99Var IC
100
David Pinedoe8e52032016-01-06 09:59:58 -0700101#############################################
102# StrRep - string replace
103
104!define StrRep "!insertmacro StrRep"
105!macro StrRep output string old new
106 Push `${string}`
107 Push `${old}`
108 Push `${new}`
109 !ifdef __UNINSTALL__
110 Call un.StrRep
111 !else
112 Call StrRep
113 !endif
114 Pop ${output}
115!macroend
116
117!macro Func_StrRep un
118 Function ${un}StrRep
119 Exch $R2 ;new
120 Exch 1
121 Exch $R1 ;old
122 Exch 2
123 Exch $R0 ;string
124 Push $R3
125 Push $R4
126 Push $R5
127 Push $R6
128 Push $R7
129 Push $R8
130 Push $R9
131
132 StrCpy $R3 0
133 StrLen $R4 $R1
134 StrLen $R6 $R0
135 StrLen $R9 $R2
136 loop:
137 StrCpy $R5 $R0 $R4 $R3
138 StrCmp $R5 $R1 found
139 StrCmp $R3 $R6 done
140 IntOp $R3 $R3 + 1 ;move offset by 1 to check the next character
141 Goto loop
142 found:
143 StrCpy $R5 $R0 $R3
144 IntOp $R8 $R3 + $R4
145 StrCpy $R7 $R0 "" $R8
146 StrCpy $R0 $R5$R2$R7
147 StrLen $R6 $R0
148 IntOp $R3 $R3 + $R9 ;move offset by length of the replacement string
149 Goto loop
150 done:
151
152 Pop $R9
153 Pop $R8
154 Pop $R7
155 Pop $R6
156 Pop $R5
157 Pop $R4
158 Pop $R3
159 Push $R0
160 Push $R1
161 Pop $R0
162 Pop $R1
163 Pop $R0
164 Pop $R2
165 Exch $R1
166 FunctionEnd
167!macroend
168!insertmacro Func_StrRep ""
169!insertmacro Func_StrRep "un."
170
171#############################################
172# x64 macros
173
174!define IsWow64 `"" IsWow64 ""`
175!macro _IsWow64 _a _b _t _f
176 !insertmacro _LOGICLIB_TEMP
177 System::Call kernel32::GetCurrentProcess()p.s
178 System::Call kernel32::IsWow64Process(ps,*i0s)
179 Pop $_LOGICLIB_TEMP
180 !insertmacro _!= $_LOGICLIB_TEMP 0 `${_t}` `${_f}`
181!macroend
182
183!define RunningX64 `"" RunningX64 ""`
184!macro _RunningX64 _a _b _t _f
185 !if ${NSIS_PTR_SIZE} > 4
186 !insertmacro LogicLib_JumpToBranch `${_t}` `${_f}`
187 !else
188 !insertmacro _IsWow64 `${_a}` `${_b}` `${_t}` `${_f}`
189 !endif
190!macroend
191
192!define DisableX64FSRedirection "!insertmacro DisableX64FSRedirection"
193!macro DisableX64FSRedirection
194 System::Call kernel32::Wow64EnableWow64FsRedirection(i0)
195!macroend
196
197!define EnableX64FSRedirection "!insertmacro EnableX64FSRedirection"
198!macro EnableX64FSRedirection
199 System::Call kernel32::Wow64EnableWow64FsRedirection(i1)
200!macroend
201
David Pinedoc21fdb92016-01-04 16:31:57 -0700202
David Pinedoc21fdb92016-01-04 16:31:57 -0700203# Need admin to write to C:\Windows\System32 and install dir
204RequestExecutionLevel admin
205
Mark Youngf1bdefc2016-01-29 16:09:29 -0700206Function .onInit
David Pinedo1e368f72016-02-04 17:04:44 -0700207
David Pinedo5925ba02016-03-03 21:25:45 -0700208!ifdef UNINSTALLER
209 ; Write out the uinstaller and quit
210 WriteUninstaller "$%TEMP%\Uninstall${PRODUCTNAME}.exe"
211 Quit
212!endif
213
Mark Youngf1bdefc2016-01-29 16:09:29 -0700214FunctionEnd
215
David Pinedoc21fdb92016-01-04 16:31:57 -0700216AddBrandingImage left 150
217Caption "${PRODUCTNAME} ${PRODUCTVERSION} Setup"
218Name "${PRODUCTNAME} ${PRODUCTVERSION}"
David Pinedo41eb93f2016-01-29 12:20:49 -0700219LIcenseData "VULKANRT_LICENSE.rtf"
David Pinedoc21fdb92016-01-04 16:31:57 -0700220Page custom brandimage "" ": Brand Image"
David Pinedo41eb93f2016-01-29 12:20:49 -0700221Page license
David Pinedoc21fdb92016-01-04 16:31:57 -0700222Page directory
223Page instfiles
224UninstallCaption "\${PRODUCTNAME} ${PRODUCTVERSION} Uninstall"
225UninstallText "This wizard will uninstall ${PRODUCTNAME} ${PRODUCTVERSION} from your computer. Click Uninstall to start the uninstallation."
226UninstPage custom un.brandimage "" ": Brand Image"
227UninstPage uninstConfirm
228UninstPage instFiles
229
David Pinedo37976332016-02-10 16:20:45 -0700230# File Properties
231VIProductVersion "${PRODUCTVERSION}"
Lenny Komowbc37ec22016-11-03 15:43:59 -0600232VIAddVersionKey "ProductName" "${APINAME} Runtime"
David Pinedo37976332016-02-10 16:20:45 -0700233VIAddVersionKey "FileVersion" "${PRODUCTVERSION}"
234VIAddVersionKey "ProductVersion" "${PRODUCTVERSION}"
David Pinedo37976332016-02-10 16:20:45 -0700235VIAddVersionKey "LegalCopyright" ""
236
David Pinedoe1af1b02016-04-08 16:33:29 -0600237!ifdef UNINSTALLER
Lenny Komowbc37ec22016-11-03 15:43:59 -0600238 VIAddVersionKey "FileDescription" "${APINAME} Runtime Uninstaller"
David Pinedoe1af1b02016-04-08 16:33:29 -0600239!else
Lenny Komowbc37ec22016-11-03 15:43:59 -0600240 VIAddVersionKey "FileDescription" "${APINAME} Runtime Installer"
David Pinedoe1af1b02016-04-08 16:33:29 -0600241!endif
242
David Pinedo19fc3962016-06-07 09:35:56 -0600243
Lenny Komow769b9df2016-08-12 13:26:20 -0600244# Function to run ConfigureRT program.
David Pinedo19fc3962016-06-07 09:35:56 -0600245# Return value is in $0 - 0 is success, all else is failure.
246!macro ConfigLayersAndVulkanDLL un
247Function ${un}ConfigLayersAndVulkanDLL
Lenny Komow769b9df2016-08-12 13:26:20 -0600248
249 # Execute the configuration program
Lenny Komowcaa3ab82016-11-04 10:38:39 -0600250 nsExec::ExecToStack 'ConfigureRT.exe --abi-major ${VERSION_ABI_MAJOR} --api-name ${APINAME}'
Lenny Komow4443fe82016-08-31 10:41:19 -0600251 Delete "$TEMP\VulkanRT\configure_rt.log"
Lenny Komow769b9df2016-08-12 13:26:20 -0600252 Rename "configure_rt.log" "$TEMP\VulkanRT\configure_rt.log"
253 pop $0
254
255 # Ignore errors. If something went wrong, the return value will indicate it.
David Pinedod1282e52016-06-10 11:37:44 -0600256 ClearErrors
257
David Pinedo19fc3962016-06-07 09:35:56 -0600258FunctionEnd
259!macroend
260!insertmacro ConfigLayersAndVulkanDLL ""
261!insertmacro ConfigLayersAndVulkanDLL "un."
262
263
Lenny Komow769b9df2016-08-12 13:26:20 -0600264# Function to run diagnostics if ConfigureRT program failed.
265# On entry $0, contains the return value from ConfigureRT.exe. It shouldn't be changed.
David Pinedo19fc3962016-06-07 09:35:56 -0600266!macro DiagConfigLayersAndVulkanDLL un
Lenny Komow769b9df2016-08-12 13:26:20 -0600267Function ${un}DiagConfigLayersAndVulkanDLL
268 # Report the failure
269 LogText "ConfigureRT.exe failed with return code $0"
270
David Pinedod1282e52016-06-10 11:37:44 -0600271 # Ignore errors
272 ClearErrors
273
David Pinedo19fc3962016-06-07 09:35:56 -0600274FunctionEnd
275!macroend
276!insertmacro DiagConfigLayersAndVulkanDLL ""
277!insertmacro DiagConfigLayersAndVulkanDLL "un."
278
David Pinedoc21fdb92016-01-04 16:31:57 -0700279# Start default section
280Section
281
David Pinedoef68bbe2016-03-29 13:46:12 -0600282 # Turn on logging
283 LogSet on
284
Mark Younga8557b82016-01-15 16:01:46 -0700285 # 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 -0700286 ${If} ${RunningX64}
Mark Youngf1bdefc2016-01-29 16:09:29 -0700287
Mark Youngdd9eca72016-01-15 14:11:32 -0700288 ${DisableX64FSRedirection}
289 SetRegView 64
David Pinedoc21fdb92016-01-04 16:31:57 -0700290
Mark Young4b8b5482016-01-15 15:09:39 -0700291 ${Endif}
David Pinedoc21fdb92016-01-04 16:31:57 -0700292
David Pinedo7f44f4f2016-03-18 13:15:27 -0600293 # Create our temp directory, with minimal permissions
David Pinedo19fc3962016-06-07 09:35:56 -0600294 RmDir /R "$TEMP\VulkanRT"
295 SetOutPath "$TEMP\VulkanRT"
296 AccessControl::DisableFileInheritance $TEMP\VulkanRT
297 AccessControl::SetFileOwner $TEMP\VulkanRT "Administrators"
298 AccessControl::ClearOnFile $TEMP\VulkanRT "Administrators" "FullAccess"
299 AccessControl::SetOnFile $TEMP\VulkanRT "SYSTEM" "FullAccess"
300 AccessControl::GrantOnFile $TEMP\VulkanRT "Everyone" "ListDirectory"
301 AccessControl::GrantOnFile $TEMP\VulkanRT "Everyone" "GenericExecute"
302 AccessControl::GrantOnFile $TEMP\VulkanRT "Everyone" "GenericRead"
303 AccessControl::GrantOnFile $TEMP\VulkanRT "Everyone" "ReadAttributes"
David Pinedo7f44f4f2016-03-18 13:15:27 -0600304 StrCpy $1 10
305 Call CheckForError
306
307 # Check the registry to see if we are already installed
David Pinedo55805972016-02-08 12:20:11 -0700308 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "InstallDir"
David Pinedo6ab257c2016-02-10 11:03:29 -0700309
310 # If the registry entry isn't there, it will throw an error as well as return a blank value. So, clear the errors.
311 ${If} ${Errors}
312
313 # Nothing else to do since there is no previous install
314 ClearErrors
315
316 ${Else}
317
318 # Use the previous install directory, so we don't have to keep tracking every possible runtime install.
319 strcmp $INSTDIR $0 notinstalled
320
321 ${If} $0 != ""
Lenny Komowbc37ec22016-11-03 15:43:59 -0600322 MessageBox MB_OK "The Windows ${APINAME} Runtime is already installed to $0. It will be re-installed to the same folder." /SD IDOK
David Pinedo6ab257c2016-02-10 11:03:29 -0700323 Strcpy $INSTDIR $0
324 ${Endif}
325
326 notinstalled:
327
328 ${EndIf}
David Pinedo55805972016-02-08 12:20:11 -0700329
Mark Youngf1bdefc2016-01-29 16:09:29 -0700330 SetOutPath "$INSTDIR"
David Pinedo7f44f4f2016-03-18 13:15:27 -0600331 AccessControl::DisableFileInheritance $INSTDIR
332 AccessControl::SetFileOwner $INSTDIR "Administrators"
333 AccessControl::ClearOnFile $INSTDIR "Administrators" "FullAccess"
334 AccessControl::SetOnFile $INSTDIR "SYSTEM" "FullAccess"
335 AccessControl::GrantOnFile $INSTDIR "Everyone" "ListDirectory"
336 AccessControl::GrantOnFile $INSTDIR "Everyone" "GenericExecute"
337 AccessControl::GrantOnFile $INSTDIR "Everyone" "GenericRead"
338 AccessControl::GrantOnFile $INSTDIR "Everyone" "ReadAttributes"
Mark Youngf1bdefc2016-01-29 16:09:29 -0700339 File ${ICOFILE}
340 File VULKANRT_LICENSE.RTF
David Pinedob5d98a92016-04-19 13:36:49 -0600341 File /oname=LICENSE.txt ..\COPYRIGHT.txt
Lenny Komow769b9df2016-08-12 13:26:20 -0600342 File Release\ConfigureRT.exe
David Pinedo7f44f4f2016-03-18 13:15:27 -0600343 StrCpy $1 15
David Pinedo6ab257c2016-02-10 11:03:29 -0700344 Call CheckForError
Mark Youngf1bdefc2016-01-29 16:09:29 -0700345
David Pinedo5925ba02016-03-03 21:25:45 -0700346 # Add the signed uninstaller
347 !ifndef UNINSTALLER
348 SetOutPath $INSTDIR
349 File "Uninstall${PRODUCTNAME}.exe"
350 !endif
351
David Pinedo7f44f4f2016-03-18 13:15:27 -0600352 StrCpy $1 20
David Pinedo6ab257c2016-02-10 11:03:29 -0700353 Call CheckForError
Mark Youngf1bdefc2016-01-29 16:09:29 -0700354
355 # Reference count the number of times we have been installed.
David Pinedo9d092772016-02-09 14:44:05 -0700356 # The reference count is stored in the registry value InstallCount
Mark Youngf1bdefc2016-01-29 16:09:29 -0700357 ReadRegDword $1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "InstallCount"
358 IntOp $1 $1 + 1
David Pinedo9d092772016-02-09 14:44:05 -0700359 StrCpy $IC $1
360
361 # We need to create a new folder for each install. Since we are using counted installs,
362 # an uninstall when the count is greater than one would result in the install
363 # count being decremented and nothing being removed. But Windows Add/Remove Programs
364 # generates a warning Window if the install dir for a package that is removed is not
365 # deleted. So we create a unique folder for each counted install.
366 # We fudge it a little and only create one folder, and rename it after each
367 # install/uninstall.
368
369 # Create the install instance folder. We rename the install instance folder if it already exists.
370 # Then copy the uninstaller to it.
371 ${If} $IC > 2
372 IntOp $1 $IC - 1
373 Rename "$INSTDIR\Instance_$1" "$INSTDIR\Instance_$IC"
374 CopyFiles /SILENT "$INSTDIR\Uninstall${PRODUCTNAME}.exe" "$INSTDIR\Instance_$IC"
375 ${ElseIf} $IC = 2
376 CreateDirectory "$INSTDIR\Instance_$IC"
377 CopyFiles /SILENT "$INSTDIR\Uninstall${PRODUCTNAME}.exe" "$INSTDIR\Instance_$IC"
378 ${EndIf}
379
David Pinedo1e368f72016-02-04 17:04:44 -0700380
Mark Youngf1bdefc2016-01-29 16:09:29 -0700381 # If the registry entry isn't there, it will throw an error as well as return a blank value. So, clear the errors.
382 ${If} ${Errors}
383 ClearErrors
384 ${EndIf}
385
Mark Youngf1bdefc2016-01-29 16:09:29 -0700386 # Modify registry for Programs and Features
Lenny Komowbc37ec22016-11-03 15:43:59 -0600387 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "DisplayName" "${APINAME} Run Time Libraries ${PRODUCTVERSION}"
Mark Youngf1bdefc2016-01-29 16:09:29 -0700388 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "UninstallString" "$INSTDIR\Uninstall${PRODUCTNAME}.exe"
David Pinedo55805972016-02-08 12:20:11 -0700389 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "Publisher" "${PUBLISHER}"
Mark Youngf1bdefc2016-01-29 16:09:29 -0700390 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "DisplayVersion" "${PRODUCTVERSION}"
391 WriteRegDword HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "EstimatedSize" ${ESTIMATEDSIZE}
392 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "DisplayIcon" "$\"$INSTDIR\${ICOFILE}$\""
David Pinedo55805972016-02-08 12:20:11 -0700393 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "InstallDir" "$INSTDIR"
David Pinedo9d092772016-02-09 14:44:05 -0700394 WriteRegDword HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "InstallCount" $IC
395
396 ${If} $IC > 1
Lenny Komowbc37ec22016-11-03 15:43:59 -0600397 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}-$IC" "DisplayName" "${APINAME} Run Time Libraries ${PRODUCTVERSION}"
David Pinedo9d092772016-02-09 14:44:05 -0700398 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}-$IC" "UninstallString" "$INSTDIR\Instance_$IC\Uninstall${PRODUCTNAME}.exe"
399 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}-$IC" "Publisher" "${PUBLISHER}"
400 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}-$IC" "DisplayVersion" "${PRODUCTVERSION}"
401 WriteRegDword HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}-$IC" "EstimatedSize" ${ESTIMATEDSIZE}
402 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}-$IC" "DisplayIcon" "$\"$INSTDIR\${ICOFILE}$\""
403 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}-$IC" "InstallDir" "$INSTDIR\Instance_$IC"
404 WriteRegDword HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}-$IC" "InstallCount" $IC
405 ${EndIf}
406
407 # Set SystemComponent to 1 for those instances that are not to be visible to Add/Remove Programs.
408 # Set SystemComponent to 0 for the instance that is to be visible to Add/Remove Programs.
409 ${If} $IC > 2
410 IntOp $1 $IC - 1
411 WriteRegDword HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}-$IC" "SystemComponent" 0
412 WriteRegDword HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}-$1" "SystemComponent" 1
413 ${ElseIf} $IC = 2
414 WriteRegDword HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}-$IC" "SystemComponent" 0
415 WriteRegDword HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "SystemComponent" 1
416 ${Else}
417 WriteRegDword HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "SystemComponent" 0
418 ${EndIf}
419
David Pinedo7f44f4f2016-03-18 13:15:27 -0600420 StrCpy $1 25
David Pinedo6ab257c2016-02-10 11:03:29 -0700421 Call CheckForError
Mark Youngf1bdefc2016-01-29 16:09:29 -0700422
Mark Young4b8b5482016-01-15 15:09:39 -0700423 # Set up version number for file names
424 ${StrRep} $0 ${VERSION_BUILDNO} "." "-"
425 StrCpy $FileVersion ${VERSION_ABI_MAJOR}-${VERSION_API_MAJOR}-${VERSION_MINOR}-${VERSION_PATCH}-$0
426
David Pinedof2c7ed92016-03-29 16:29:00 -0600427 # Complete remove the Vulkan Start Menu. Prior version of the Vulkan RT
428 # created Start Menu items, we don't do that anymore.
David Pinedocf290632016-03-03 12:36:24 -0700429 SetShellVarContext all
David Pinedof2c7ed92016-03-29 16:29:00 -0600430 RmDir /R "$SMPROGRAMS\Vulkan"
David Pinedocf290632016-03-03 12:36:24 -0700431 ClearErrors
432
Mark Young4b8b5482016-01-15 15:09:39 -0700433 # If running on a 64-bit OS machine
434 ${If} ${RunningX64}
Mark Youngf1bdefc2016-01-29 16:09:29 -0700435
Mark Youngdd9eca72016-01-15 14:11:32 -0700436 # 32-bit DLLs/EXEs destined for SysWOW64
437 ##########################################
438 SetOutPath $WINDIR\SysWow64
Lenny Komow307f0e52016-11-07 15:20:54 -0700439 File /oname=${APILOWER}-$FileVersion.dll ..\build32\loader\Release\${APILOWER}-${VERSION_ABI_MAJOR}.dll
440 File /oname=${APILOWER}info-$FileVersion.exe ..\build32\demos\Release\${APILOWER}info.exe
David Pinedo7f44f4f2016-03-18 13:15:27 -0600441 StrCpy $1 30
David Pinedo6ab257c2016-02-10 11:03:29 -0700442 Call CheckForError
Mark Youngf1bdefc2016-01-29 16:09:29 -0700443
Mark Youngdd9eca72016-01-15 14:11:32 -0700444 # 64-bit DLLs/EXEs
445 ##########################################
446 SetOutPath $WINDIR\System32
Lenny Komow307f0e52016-11-07 15:20:54 -0700447 File /oname=${APILOWER}-$FileVersion.dll ..\build\loader\Release\${APILOWER}-${VERSION_ABI_MAJOR}.dll
David Pinedo7f44f4f2016-03-18 13:15:27 -0600448 StrCpy $1 35
David Pinedo6ab257c2016-02-10 11:03:29 -0700449 Call CheckForError
Mark Youngdd9eca72016-01-15 14:11:32 -0700450
451 # vulkaninfo.exe
Lenny Komow307f0e52016-11-07 15:20:54 -0700452 File /oname=${APILOWER}info-$FileVersion.exe ..\build\demos\Release\${APILOWER}info.exe
Mark Youngdd9eca72016-01-15 14:11:32 -0700453 SetOutPath "$INSTDIR"
Lenny Komowbe937252016-11-10 18:36:05 -0700454 File /oname=${APILOWER}info.exe ..\build\demos\Release\${APILOWER}info.exe
Lenny Komow307f0e52016-11-07 15:20:54 -0700455 File /oname=${APILOWER}info32.exe ..\build32\demos\Release\${APILOWER}info.exe
David Pinedo7f44f4f2016-03-18 13:15:27 -0600456 StrCpy $1 40
David Pinedo6ab257c2016-02-10 11:03:29 -0700457 Call CheckForError
Mark Youngdd9eca72016-01-15 14:11:32 -0700458
Mark Youngdd9eca72016-01-15 14:11:32 -0700459 # Else, running on a 32-bit OS machine
460 ${Else}
Mark Youngf1bdefc2016-01-29 16:09:29 -0700461
Mark Young4b8b5482016-01-15 15:09:39 -0700462 # 32-bit DLLs/EXEs destined for SysWOW64
463 ##########################################
464 SetOutPath $WINDIR\System32
Lenny Komow307f0e52016-11-07 15:20:54 -0700465 File /oname=${APILOWER}-$FileVersion.dll ..\build32\loader\Release\${APILOWER}-${VERSION_ABI_MAJOR}.dll
David Pinedo7f44f4f2016-03-18 13:15:27 -0600466 StrCpy $1 50
David Pinedo6ab257c2016-02-10 11:03:29 -0700467 Call CheckForError
Mark Young4b8b5482016-01-15 15:09:39 -0700468
469 # vulkaninfo.exe
Lenny Komow307f0e52016-11-07 15:20:54 -0700470 File /oname=${APILOWER}info-$FileVersion.exe ..\build32\demos\Release\${APILOWER}info.exe
Mark Young4b8b5482016-01-15 15:09:39 -0700471 SetOutPath "$INSTDIR"
Lenny Komow307f0e52016-11-07 15:20:54 -0700472 File /oname=${APILOWER}info ..\build32\demos\Release\${APILOWER}info.exe
David Pinedo7f44f4f2016-03-18 13:15:27 -0600473 StrCpy $1 55
David Pinedo6ab257c2016-02-10 11:03:29 -0700474 Call CheckForError
Mark Young4b8b5482016-01-15 15:09:39 -0700475
Mark Youngdd9eca72016-01-15 14:11:32 -0700476 ${Endif}
David Pinedoc21fdb92016-01-04 16:31:57 -0700477
Lenny Komow769b9df2016-08-12 13:26:20 -0600478 # Run the ConfigureRT program to copy the most recent version of
David Pinedo19fc3962016-06-07 09:35:56 -0600479 # vulkan-<abimajor>-*.dll to vulkan-<abimajor>.dll, and to set up layer registry
480 # entries to use layers from the corresponding SDK
David Pinedo1d6bb4e2016-06-08 16:30:06 -0600481 SetOutPath "$INSTDIR"
David Pinedo19fc3962016-06-07 09:35:56 -0600482 Call ConfigLayersAndVulkanDLL
483 ${If} $0 != 0
David Pinedo1d6bb4e2016-06-08 16:30:06 -0600484 SetOutPath "$INSTDIR"
David Pinedo19fc3962016-06-07 09:35:56 -0600485 Call DiagConfigLayersAndVulkanDLL
David Pinedo1d1d5772016-06-09 16:12:44 -0600486
Lenny Komow769b9df2016-08-12 13:26:20 -0600487 # The program failed, and we don't know why.
David Pinedo1d1d5772016-06-09 16:12:44 -0600488 # Simply configure system to use our loader and vulkaninfo.
Lenny Komowd8b4f6b2016-08-31 09:45:46 -0600489 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 Pinedo1d1d5772016-06-09 16:12:44 -0600490 ${If} ${RunningX64}
Lenny Komow307f0e52016-11-07 15:20:54 -0700491 Delete $WINDIR\SysWow64\${APILOWER}-${VERSION_ABI_MAJOR}.dll
492 Delete $WINDIR\SysWow64\${APILOWER}info.exe
493 CopyFiles /SILENT $WINDIR\SysWow64\${APILOWER}-$FileVersion.dll $WINDIR\SysWow64\${APILOWER}-${VERSION_ABI_MAJOR}.dll
494 CopyFiles /SILENT $WINDIR\SysWow64\${APILOWER}info-$FileVersion.exe $WINDIR\SysWow64\${APILOWER}info.exe
David Pinedo1d1d5772016-06-09 16:12:44 -0600495 ${Endif}
Lenny Komow307f0e52016-11-07 15:20:54 -0700496 Delete $WINDIR\System32\${APILOWER}-${VERSION_ABI_MAJOR}.dll
497 Delete $WINDIR\System32\${APILOWER}info.exe
498 CopyFiles /SILENT $WINDIR\System32\${APILOWER}-$FileVersion.dll $WINDIR\System32\${APILOWER}-${VERSION_ABI_MAJOR}.dll
499 CopyFiles /SILENT $WINDIR\System32\${APILOWER}info-$FileVersion.exe $WINDIR\System32\${APILOWER}info.exe
David Pinedo1d1d5772016-06-09 16:12:44 -0600500 ClearErrors
David Pinedo19fc3962016-06-07 09:35:56 -0600501 ${Endif}
David Pinedo1d1d5772016-06-09 16:12:44 -0600502 StrCpy $1 60
David Pinedo19fc3962016-06-07 09:35:56 -0600503 Call CheckForError
504
Lenny Komow769b9df2016-08-12 13:26:20 -0600505 # We are done using ConfigureRT.exe, delete it. It will be re-installed
Mark Youngf1bdefc2016-01-29 16:09:29 -0700506 # by the uninstaller when it needs to be run again during uninstall.
Lenny Komow769b9df2016-08-12 13:26:20 -0600507 Delete ConfigureRT.exe
Mark Young4b8b5482016-01-15 15:09:39 -0700508
David Pinedoef68bbe2016-03-29 13:46:12 -0600509 # Finish logging and move log file to TEMP dir
510 LogSet off
David Pinedo19fc3962016-06-07 09:35:56 -0600511 Rename "$INSTDIR\install.log" "$TEMP\VulkanRT\installer.log"
David Pinedoef68bbe2016-03-29 13:46:12 -0600512
David Pinedoc21fdb92016-01-04 16:31:57 -0700513SectionEnd
514
515# Uninstaller section start
David Pinedo5925ba02016-03-03 21:25:45 -0700516!ifdef UNINSTALLER
David Pinedoc21fdb92016-01-04 16:31:57 -0700517Section "uninstall"
David Pinedo3fc22bf2016-04-05 16:40:08 -0600518 # Turn on logging
David Pinedo19fc3962016-06-07 09:35:56 -0600519 SetOutPath "$TEMP\VulkanRT"
520 StrCpy $INSTDIR "$TEMP\VulkanRT"
David Pinedo3fc22bf2016-04-05 16:40:08 -0600521 LogSet on
522
Mark Younga8557b82016-01-15 16:01:46 -0700523 # 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 -0700524 ${If} ${RunningX64}
David Pinedoc21fdb92016-01-04 16:31:57 -0700525
Mark Youngdd9eca72016-01-15 14:11:32 -0700526 ${DisableX64FSRedirection}
527 SetRegView 64
Mark Youngf1bdefc2016-01-29 16:09:29 -0700528
Mark Young4b8b5482016-01-15 15:09:39 -0700529 ${Endif}
David Pinedoc21fdb92016-01-04 16:31:57 -0700530
David Pinedo32eb2ec2016-02-09 09:15:34 -0700531 # Look up the install dir and remove files from that directory.
David Pinedo32eb2ec2016-02-09 09:15:34 -0700532 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "InstallDir"
David Pinedo9d092772016-02-09 14:44:05 -0700533 StrCpy $IDir $0
David Pinedo32eb2ec2016-02-09 09:15:34 -0700534
David Pinedo1d6bb4e2016-06-08 16:30:06 -0600535 StrCpy $1 65
David Pinedo6ab257c2016-02-10 11:03:29 -0700536 Call un.CheckForError
537
David Pinedo32eb2ec2016-02-09 09:15:34 -0700538 SetOutPath "$IDir"
David Pinedoc21fdb92016-01-04 16:31:57 -0700539
Mark Young4b8b5482016-01-15 15:09:39 -0700540 # Set up version number for file names
541 ${StrRep} $0 ${VERSION_BUILDNO} "." "-"
542 StrCpy $FileVersion ${VERSION_ABI_MAJOR}-${VERSION_API_MAJOR}-${VERSION_MINOR}-${VERSION_PATCH}-$0
David Pinedoc21fdb92016-01-04 16:31:57 -0700543
Mark Young4b8b5482016-01-15 15:09:39 -0700544 # Decrement the number of times we have been installed.
David Pinedo9d092772016-02-09 14:44:05 -0700545 ReadRegDword $IC HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "InstallCount"
546 IntOp $1 $IC - 1
David Pinedob4d7f6a2016-01-27 14:15:25 -0700547 WriteRegDword HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "InstallCount" $1
David Pinedoc21fdb92016-01-04 16:31:57 -0700548
David Pinedo9d092772016-02-09 14:44:05 -0700549 # Rename the install dir for this instance if is not the last uninstall
550 ${If} $IC > 2
551 IntOp $1 $IC - 1
552 Rename "$IDir\Instance_$IC" "$IDir\Instance_$1"
553 ${ElseIf} $IC = 2
David Pinedo5925ba02016-03-03 21:25:45 -0700554 Delete /REBOOTOK "$IDir\Instance_$IC\Uninstall${PRODUCTNAME}.exe"
David Pinedo9d092772016-02-09 14:44:05 -0700555 Rmdir /REBOOTOK "$IDir\Instance_$IC"
556 ${Endif}
David Pinedo1d6bb4e2016-06-08 16:30:06 -0600557 StrCpy $1 70
558 Call un.CheckForError
David Pinedo9d092772016-02-09 14:44:05 -0700559
560 # Modify registry for Programs and Features
David Pinedocf290632016-03-03 12:36:24 -0700561
562 ${If} $IC > 1
563 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}-$IC"
564 ${EndIf}
David Pinedo9d092772016-02-09 14:44:05 -0700565 ${If} $IC > 2
566 IntOp $IC $IC - 1
567 WriteRegDword HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}-$IC" "SystemComponent" 0
568 ${ElseIf} $IC = 2
569 WriteRegDword HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "SystemComponent" 0
570 ${Else}
571 # Last uninstall
572 IntOp $IC $IC - 1
573 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}"
574 ${EndIf}
David Pinedo1d6bb4e2016-06-08 16:30:06 -0600575 StrCpy $1 75
576 Call un.CheckForError
David Pinedo9d092772016-02-09 14:44:05 -0700577
David Pinedod133b782016-03-16 14:41:56 -0600578
Lenny Komow769b9df2016-08-12 13:26:20 -0600579 # Install ConfigureRT.exe so we can run it.
David Pinedod133b782016-03-16 14:41:56 -0600580 # It will be deleted later when we remove the install directory.
Lenny Komow769b9df2016-08-12 13:26:20 -0600581 File Release\ConfigureRT.exe
David Pinedod133b782016-03-16 14:41:56 -0600582
583 # If running on a 64-bit OS machine
584 ${If} ${RunningX64}
585
586 # Delete vulkaninfo.exe in C:\Windows\System32 and C:\Windows\SysWOW64
Lenny Komow307f0e52016-11-07 15:20:54 -0700587 Delete /REBOOTOK $WINDIR\SysWow64\${APILOWER}info.exe
588 Delete /REBOOTOK $WINDIR\System32\${APILOWER}info.exe
David Pinedod133b782016-03-16 14:41:56 -0600589
Mark Young013dd062016-06-22 16:55:31 -0600590 # Delete vulkan-<majorabi>.dll in C:\Windows\System32 and C:\Windows\SysWOW64
Lenny Komow307f0e52016-11-07 15:20:54 -0700591 Delete /REBOOTOK $WINDIR\SysWow64\${APILOWER}-${VERSION_ABI_MAJOR}.dll
592 Delete /REBOOTOK $WINDIR\System32\${APILOWER}-${VERSION_ABI_MAJOR}.dll
David Pinedod133b782016-03-16 14:41:56 -0600593
David Pinedod133b782016-03-16 14:41:56 -0600594 # Else, running on a 32-bit OS machine
595 ${Else}
596
597 # Delete vulkaninfo.exe in C:\Windows\System32
Lenny Komow307f0e52016-11-07 15:20:54 -0700598 Delete /REBOOTOK $WINDIR\System32\${APILOWER}info.exe
David Pinedod133b782016-03-16 14:41:56 -0600599
Mark Young013dd062016-06-22 16:55:31 -0600600 # Delete vulkan-<majorabi>.dll in C:\Windows\System32
Lenny Komow307f0e52016-11-07 15:20:54 -0700601 Delete /REBOOTOK $WINDIR\System32\${APILOWER}-${VERSION_ABI_MAJOR}.dll
David Pinedod133b782016-03-16 14:41:56 -0600602
David Pinedod133b782016-03-16 14:41:56 -0600603 ${EndIf}
David Pinedo1d6bb4e2016-06-08 16:30:06 -0600604 StrCpy $1 80
605 Call un.CheckForError
David Pinedod133b782016-03-16 14:41:56 -0600606
Mark Young013dd062016-06-22 16:55:31 -0600607 # If Ref Count is zero, remove files in C:\Windows\System32 and C:\Windows\SysWow64
608 ${If} $IC <= 0
609
610 ${If} ${RunningX64}
611 # Delete vulkaninfo.exe in C:\Windows\System32 and C:\Windows\SysWOW64
Lenny Komow307f0e52016-11-07 15:20:54 -0700612 Delete /REBOOTOK "$WINDIR\SysWow64\${APILOWER}info-$FileVersion.exe"
613 Delete /REBOOTOK "$WINDIR\System32\${APILOWER}info-$FileVersion.exe"
Mark Young013dd062016-06-22 16:55:31 -0600614 # Delete vulkan-<majorabi>-<major>-<minor>-<patch>-<buildno>.dll from sys dirs
Lenny Komow307f0e52016-11-07 15:20:54 -0700615 Delete /REBOOTOK $WINDIR\SysWow64\${APILOWER}-$FileVersion.dll
616 Delete /REBOOTOK $WINDIR\System32\${APILOWER}-$FileVersion.dll
Mark Young013dd062016-06-22 16:55:31 -0600617 ${Else}
618 # Delete vulkaninfo.exe in C:\Windows\System32
Lenny Komow307f0e52016-11-07 15:20:54 -0700619 Delete /REBOOTOK "$WINDIR\System32\${APILOWER}info-$FileVersion.exe"
Mark Young013dd062016-06-22 16:55:31 -0600620 # Delete vulkan-<majorabi>-<major>-<minor>-<patch>-<buildno>.dll from sys dir
Lenny Komow307f0e52016-11-07 15:20:54 -0700621 Delete /REBOOTOK $WINDIR\System32\${APILOWER}-$FileVersion.dll
Mark Young013dd062016-06-22 16:55:31 -0600622 ${EndIf}
623
624 ${Endif}
625
Lenny Komow769b9df2016-08-12 13:26:20 -0600626 # Run the ConfigureRT.exe program to copy the most recent version of
David Pinedo19fc3962016-06-07 09:35:56 -0600627 # vulkan-<abimajor>-*.dll to vulkan-<abimajor>.dll, and to set up layer registry
628 # entries to use layers from the corresponding SDK
David Pinedo1d6bb4e2016-06-08 16:30:06 -0600629 SetOutPath "$IDir"
David Pinedo19fc3962016-06-07 09:35:56 -0600630 Call un.ConfigLayersAndVulkanDLL
631 ${If} $0 != 0
David Pinedo1d6bb4e2016-06-08 16:30:06 -0600632 SetOutPath "$IDir"
David Pinedo19fc3962016-06-07 09:35:56 -0600633 Call un.DiagConfigLayersAndVulkanDLL
Lenny Komow307f0e52016-11-07 15:20:54 -0700634 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 Pinedo1d1d5772016-06-09 16:12:44 -0600635 ${If} ${RunningX64}
Lenny Komow307f0e52016-11-07 15:20:54 -0700636 Delete $WINDIR\SysWow64\${APILOWER}-${VERSION_ABI_MAJOR}.dll
637 Delete $WINDIR\SysWow64\${APILOWER}info.exe
David Pinedo1d1d5772016-06-09 16:12:44 -0600638 ${Endif}
Lenny Komow307f0e52016-11-07 15:20:54 -0700639 Delete $WINDIR\System32\${APILOWER}-${VERSION_ABI_MAJOR}.dll
640 Delete $WINDIR\System32\${APILOWER}info.exe
David Pinedo1d1d5772016-06-09 16:12:44 -0600641 ClearErrors
David Pinedo1d6bb4e2016-06-08 16:30:06 -0600642 ${Else}
643 StrCpy $1 85
David Pinedo19fc3962016-06-07 09:35:56 -0600644 ${Endif}
David Pinedo19fc3962016-06-07 09:35:56 -0600645 Call un.CheckForError
Lenny Komow992fbc72016-09-09 09:43:17 -0600646
647 # Remove ConfigureRT regardless of the ref count
648 Delete /REBOOTOK "$IDir\ConfigureRT.exe"
David Pinedo19fc3962016-06-07 09:35:56 -0600649
Mark Young013dd062016-06-22 16:55:31 -0600650 # If Ref Count is zero, remove install dir
David Pinedo9d092772016-02-09 14:44:05 -0700651 ${If} $IC <= 0
David Pinedoc21fdb92016-01-04 16:31:57 -0700652
Mark Young4b8b5482016-01-15 15:09:39 -0700653 # Remove files in install dir
David Pinedo32eb2ec2016-02-09 09:15:34 -0700654 Delete /REBOOTOK "$IDir\VULKANRT_LICENSE.rtf"
655 Delete /REBOOTOK "$IDir\LICENSE.txt"
David Pinedo5925ba02016-03-03 21:25:45 -0700656 Delete /REBOOTOK "$IDir\Uninstall${PRODUCTNAME}.exe"
David Pinedo32eb2ec2016-02-09 09:15:34 -0700657 Delete /REBOOTOK "$IDir\V.ico"
Lenny Komow307f0e52016-11-07 15:20:54 -0700658 Delete /REBOOTOK "$IDir\${APILOWER}info.exe"
Mark Youngf1bdefc2016-01-29 16:09:29 -0700659
Mark Youngf7c705b2016-01-26 13:36:28 -0700660 # If running on a 64-bit OS machine
661 ${If} ${RunningX64}
Lenny Komow307f0e52016-11-07 15:20:54 -0700662 Delete /REBOOTOK "$IDir\${APILOWER}info32.exe"
Mark Youngf7c705b2016-01-26 13:36:28 -0700663 ${EndIf}
Mark Young4b8b5482016-01-15 15:09:39 -0700664
David Pinedo1d6bb4e2016-06-08 16:30:06 -0600665 StrCpy $1 90
David Pinedo6ab257c2016-02-10 11:03:29 -0700666 Call un.CheckForError
667
David Pinedo32eb2ec2016-02-09 09:15:34 -0700668 # Need to do a SetOutPath to something outside of install dir,
669 # or the uninstall will think install dir is busy
Mark Young4b8b5482016-01-15 15:09:39 -0700670 SetOutPath "$TEMP"
671
672 # Remove install directories
David Pinedo7f44f4f2016-03-18 13:15:27 -0600673 StrCpy $0 "$IDir"
674 Call un.DeleteDirIfEmpty
Mark Young4b8b5482016-01-15 15:09:39 -0700675 StrCpy $0 "$PROGRAMFILES\${PRODUCTNAME}"
676 Call un.DeleteDirIfEmpty
David Pinedocf290632016-03-03 12:36:24 -0700677 ClearErrors
Mark Young4b8b5482016-01-15 15:09:39 -0700678
679 # If any of the remove commands failed, request a reboot
Mark Young0368c7d2016-02-02 10:56:42 -0700680 IfRebootFlag 0 noreboot
681 MessageBox MB_YESNO "A reboot is required to finish the uninstall. Do you wish to reboot now?" /SD IDNO IDNO returnerror
682 Reboot
David Pinedo1e368f72016-02-04 17:04:44 -0700683
Mark Young0368c7d2016-02-02 10:56:42 -0700684 returnerror:
David Pinedo1e368f72016-02-04 17:04:44 -0700685
Mark Young0368c7d2016-02-02 10:56:42 -0700686 # Set an error message to output because we should reboot but didn't (whether because silent uninstall or user choice)
687 SetErrorLevel 3 # ERROR_TOO_MANY_OPEN_FILES
688
Mark Young4b8b5482016-01-15 15:09:39 -0700689 noreboot:
Mark Youngf1bdefc2016-01-29 16:09:29 -0700690
Mark Youngdd9eca72016-01-15 14:11:32 -0700691 ${Endif}
David Pinedoc21fdb92016-01-04 16:31:57 -0700692
David Pinedo1d6bb4e2016-06-08 16:30:06 -0600693 StrCpy $1 95
David Pinedo6ab257c2016-02-10 11:03:29 -0700694 Call un.CheckForError
695
David Pinedo8671af52016-06-03 12:08:12 -0600696 # Finish logging
David Pinedoef68bbe2016-03-29 13:46:12 -0600697 LogSet off
David Pinedo19fc3962016-06-07 09:35:56 -0600698 Rename "$INSTDIR\install.log" "$TEMP\VulkanRT\uninstaller.log"
David Pinedo7f44f4f2016-03-18 13:15:27 -0600699
David Pinedoc21fdb92016-01-04 16:31:57 -0700700SectionEnd
David Pinedo5925ba02016-03-03 21:25:45 -0700701!endif
David Pinedoc21fdb92016-01-04 16:31:57 -0700702
703Function brandimage
704 SetOutPath "$TEMP"
David Pinedof79938f2016-02-02 16:10:39 -0700705 SetFileAttributes V.bmp temporary
706 File V.bmp
707 SetBrandingImage "$TEMP/V.bmp"
David Pinedoc21fdb92016-01-04 16:31:57 -0700708Functionend
709
710
711Function un.brandimage
712 SetOutPath "$TEMP"
David Pinedof79938f2016-02-02 16:10:39 -0700713 SetFileAttributes V.bmp temporary
714 File V.bmp
715 SetBrandingImage "$TEMP/V.bmp"
David Pinedoc21fdb92016-01-04 16:31:57 -0700716Functionend
717
718Function un.DeleteDirIfEmpty
719 FindFirst $R0 $R1 "$0\*.*"
720 strcmp $R1 "." 0 NoDelete
721 FindNext $R0 $R1
722 strcmp $R1 ".." 0 NoDelete
723 ClearErrors
724 FindNext $R0 $R1
725 IfErrors 0 NoDelete
726 FindClose $R0
727 Sleep 1000
728 RMDir "$0"
729 NoDelete:
730 FindClose $R0
731FunctionEnd
Mark Youngf1bdefc2016-01-29 16:09:29 -0700732
David Pinedo6ab257c2016-02-10 11:03:29 -0700733# 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 -0700734# NOTE: We return a non-zero error code as well.
David Pinedo6ab257c2016-02-10 11:03:29 -0700735Function CheckForError
Mark Youngf1bdefc2016-01-29 16:09:29 -0700736 ${If} ${Errors}
737 # IHV's using this install may want no message box.
David Pinedoa6d46a82016-02-12 12:23:57 -0700738 MessageBox MB_OK|MB_ICONSTOP "${errorMessage1}${errorMessage2}Errorcode: $1$\r$\n" /SD IDOK
Mark Youngf1bdefc2016-01-29 16:09:29 -0700739
David Pinedoef68bbe2016-03-29 13:46:12 -0600740 # Finish logging and move log file to TEMP dir
741 LogSet off
David Pinedo19fc3962016-06-07 09:35:56 -0600742 Rename "$INSTDIR\install.log" "$TEMP\VulkanRT\installer.log"
David Pinedoef68bbe2016-03-29 13:46:12 -0600743
Mark Youngf1bdefc2016-01-29 16:09:29 -0700744 # Copy the uninstaller to a temp folder of our own creation so we can completely
745 # delete the old contents.
David Pinedo19fc3962016-06-07 09:35:56 -0600746 SetOutPath "$TEMP\VulkanRT"
747 CopyFiles "$INSTDIR\Uninstall${PRODUCTNAME}.exe" "$TEMP\VulkanRT"
Mark Youngf1bdefc2016-01-29 16:09:29 -0700748
David Pinedo8671af52016-06-03 12:08:12 -0600749 # Do uninstall using the version in the temporary folder.
David Pinedo19fc3962016-06-07 09:35:56 -0600750 ExecWait '"$TEMP\VulkanRT\Uninstall${PRODUCTNAME}.exe" /S _?=$INSTDIR'
Mark Youngf1bdefc2016-01-29 16:09:29 -0700751
752 # Delete the copy of the uninstaller we ran
David Pinedo19fc3962016-06-07 09:35:56 -0600753 Delete /REBOOTOK "$TEMP\VulkanRT\Uninstall${PRODUCTNAME}.exe"
Mark Youngf1bdefc2016-01-29 16:09:29 -0700754
755 # Set an error message to output
David Pinedoa6d46a82016-02-12 12:23:57 -0700756 SetErrorLevel $1
Mark Youngf1bdefc2016-01-29 16:09:29 -0700757
758 Quit
759 ${EndIf}
760FunctionEnd
David Pinedo6ab257c2016-02-10 11:03:29 -0700761
762# Check for errors during uninstall. If we hit an error, don't attempt
David Pinedo19fc3962016-06-07 09:35:56 -0600763# to do anything. Just set a non-zero return code and continue.
David Pinedo6ab257c2016-02-10 11:03:29 -0700764Function un.CheckForError
765 ${If} ${Errors}
766 # IHV's using this install may want no message box.
David Pinedoe80978b2016-02-13 14:06:55 -0700767 MessageBox MB_OK|MB_ICONSTOP "${errorMessage1un}${errorMessage2}Errorcode: $1$\r$\n" /SD IDOK
David Pinedo6ab257c2016-02-10 11:03:29 -0700768
769 # Set an error message to output
David Pinedoa6d46a82016-02-12 12:23:57 -0700770 SetErrorLevel $1
David Pinedo6ab257c2016-02-10 11:03:29 -0700771
David Pinedo6ab257c2016-02-10 11:03:29 -0700772 ${EndIf}
773FunctionEnd