1 # The Vulkan runtime installer NSIS script
15 !define VERSION "${MAJOR}.${MINOR}.${PATCH}.${BUILD}"
17 !define PUBLISHER "YourCompany, Inc."
23 # Installer information
25 OutFile "VulkanRT-${VERSION}-Installer.exe"
26 InstallDir "$PROGRAMFILES\VulkanRT"
28 RequestExecutionLevel admin
29 AddBrandingImage left 150
30 Caption "Vulkan Runtime ${VERSION} Setup"
31 Name "Vulkan Runtime ${VERSION}"
32 LicenseData "${RES}\VulkanRT-License.txt"
33 Page custom brandimage "" ": Brand Image"
37 VIProductVersion "${VERSION}"
38 VIAddVersionKey "ProductName" "Vulkan Runtime"
39 VIAddVersionKey "FileVersion" "${VERSION}"
40 VIAddVersionKey "ProductVersion" "${VERSION}"
41 VIAddVersionKey "LegalCopyright" "${COPYRIGHT}"
42 VIAddVersionKey "FileDescription" "Vulkan Runtime Installer"
46 SetFileAttributes V.bmp temporary
48 SetBrandingImage "$TEMP/V.bmp"
51 # Utilties to check if a file is older than this installer or not
52 Function NeedsReplacing
55 # Extract the version of the existing file
56 GetDllVersion "$0" $R0 $R1
58 IntOp $R2 $R2 & 0xffff
59 IntOp $R3 $R0 & 0xffff
61 IntOp $R4 $R4 & 0xffff
62 IntOp $R5 $R1 & 0xffff
64 # Check major versions
67 ${ELSEIF} ${MAJOR} < $R2
70 # Check minor versions
71 ${ELSEIF} ${MINOR} > $R3
73 ${ELSEIF} ${MINOR} < $R3
76 # Check patch versions
77 ${ELSEIF} ${PATCH} > $R4
79 ${ELSEIF} ${PATCH} < $R4
82 # Check build versions
83 ${ELSEIF} ${BUILD} > $R5
85 ${ELSEIF} ${BUILD} < $R5
88 # If they match exactly, then we update
94 !macro InstallIfNewer SrcPath OutName
95 Push "$OUTDIR\${OutName}"
100 DetailPrint "File $OUTDIR\${OutName} (version $R2.$R3.$R4.$R5) will be upgraded to ${VERSION}"
101 File /oname=${OutName} "${SrcPath}"
103 DetailPrint "File $OUTDIR\${OutName} (version $R2.$R3.$R4.$R5) will not be replaced with ${VERSION}"
107 # Utilities to check if this is a 64-bit OS or not
108 !define IsWow64 `"" IsWow64 ""`
109 !macro _IsWow64 _a _b _t _f
110 !insertmacro _LOGICLIB_TEMP
111 System::Call kernel32::GetCurrentProcess()p.s
112 System::Call kernel32::IsWow64Process(ps,*i0s)
114 !insertmacro _!= $_LOGICLIB_TEMP 0 `${_t}` `${_f}`
117 !define RunningX64 `"" RunningX64 ""`
118 !macro _RunningX64 _a _b _t _f
119 !if ${NSIS_PTR_SIZE} > 4
120 !insertmacro LogicLib_JumpToBranch `${_t}` `${_f}`
122 !insertmacro _IsWow64 `${_a}` `${_b}` `${_t}` `${_f}`
128 Delete "$INSTDIR\install.log"
129 Delete "$INSTDIR\VULKANRT_LICENSE.rtf"
132 # Disable filesystem redirection
133 System::Call kernel32::Wow64EnableWow64FsRedirection(i0)
136 SetOutPath $WINDIR\System32
137 !insertmacro InstallIfNewer "${LOADER64}" "vulkan-1.dll"
138 !insertmacro InstallIfNewer "${LOADER64}" "vulkan-1-999-0-0-0.dll"
139 !insertmacro InstallIfNewer "${VULKANINFO64}" "vulkaninfo.exe"
140 !insertmacro InstallIfNewer "${VULKANINFO64}" "vulkaninfo-1-999-0-0-0.exe"
141 SetOutPath $WINDIR\SysWOW64
143 SetOutPath $WINDIR\System32
146 # Install 32-bit contents
147 !insertmacro InstallIfNewer "${LOADER32}" "vulkan-1.dll"
148 !insertmacro InstallIfNewer "${LOADER32}" "vulkan-1-999-0-0-0.dll"
149 !insertmacro InstallIfNewer "${VULKANINFO32}" "vulkaninfo.exe"
150 !insertmacro InstallIfNewer "${VULKANINFO32}" "vulkaninfo-1-999-0-0-0.exe"
152 # Dump licenses into a the installation directory
153 SetOutPath "$INSTDIR"
154 AccessControl::DisableFileInheritance $INSTDIR
155 AccessControl::SetFileOwner $INSTDIR "Administrators"
156 AccessControl::ClearOnFile $INSTDIR "Administrators" "FullAccess"
157 AccessControl::SetOnFile $INSTDIR "SYSTEM" "FullAccess"
158 AccessControl::GrantOnFile $INSTDIR "Everyone" "ListDirectory"
159 AccessControl::GrantOnFile $INSTDIR "Everyone" "GenericExecute"
160 AccessControl::GrantOnFile $INSTDIR "Everyone" "GenericRead"
161 AccessControl::GrantOnFile $INSTDIR "Everyone" "ReadAttributes"
162 File "${RES}\VulkanRT-License.txt"