[40270] | 1 | ; $Id: VBoxGuestAdditionsCommon.nsh 98626 2023-02-18 02:13:49Z vboxsync $
|
---|
[69354] | 2 | ;; @file
|
---|
[35753] | 3 | ; VBoxGuestAdditionsCommon.nsh - Common / shared utility functions.
|
---|
| 4 | ;
|
---|
[31634] | 5 |
|
---|
[35753] | 6 | ;
|
---|
[98103] | 7 | ; Copyright (C) 2006-2023 Oracle and/or its affiliates.
|
---|
[35753] | 8 | ;
|
---|
[96407] | 9 | ; This file is part of VirtualBox base platform packages, as
|
---|
| 10 | ; available from https://www.virtualbox.org.
|
---|
[35753] | 11 | ;
|
---|
[96407] | 12 | ; This program is free software; you can redistribute it and/or
|
---|
| 13 | ; modify it under the terms of the GNU General Public License
|
---|
| 14 | ; as published by the Free Software Foundation, in version 3 of the
|
---|
| 15 | ; License.
|
---|
| 16 | ;
|
---|
| 17 | ; This program is distributed in the hope that it will be useful, but
|
---|
| 18 | ; WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 19 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
| 20 | ; General Public License for more details.
|
---|
| 21 | ;
|
---|
| 22 | ; You should have received a copy of the GNU General Public License
|
---|
| 23 | ; along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
| 24 | ;
|
---|
| 25 | ; SPDX-License-Identifier: GPL-3.0-only
|
---|
| 26 | ;
|
---|
[35680] | 27 |
|
---|
[96775] | 28 |
|
---|
| 29 | !macro Common_CleanupObsoleteFiles un
|
---|
| 30 | ;;
|
---|
| 31 | ; Removes common files we're no longer shipping.
|
---|
| 32 | ;
|
---|
| 33 | ; During installation this step should be taken before copy files over in case
|
---|
| 34 | ; the list gets out of sync and we start shipping files on it. That way it
|
---|
| 35 | ; doesn't much matter as the file will be restore afterwards.
|
---|
| 36 | ;
|
---|
| 37 | Function ${un}Common_CleanupObsoleteFiles
|
---|
| 38 | Delete /REBOOTOK "$INSTDIR\iexplore.ico" ; Removed in r153662.
|
---|
| 39 | FunctionEnd
|
---|
| 40 | !macroend
|
---|
| 41 | !insertmacro Common_CleanupObsoleteFiles ""
|
---|
| 42 | !ifdef UNINSTALLER_ONLY
|
---|
| 43 | !insertmacro Common_CleanupObsoleteFiles "un."
|
---|
[96780] | 44 | !else ifndef VBOX_SIGN_ADDITIONS
|
---|
| 45 | !insertmacro Common_CleanupObsoleteFiles "un."
|
---|
[96775] | 46 | !endif
|
---|
| 47 |
|
---|
[39558] | 48 | Function Common_CopyFiles
|
---|
| 49 |
|
---|
| 50 | SetOutPath "$INSTDIR"
|
---|
| 51 | SetOverwrite on
|
---|
| 52 |
|
---|
| 53 | !ifdef VBOX_WITH_LICENSE_INSTALL_RTF
|
---|
| 54 | ; Copy license file (if any) into the installation directory
|
---|
| 55 | FILE "/oname=${LICENSE_FILE_RTF}" "$%VBOX_BRAND_LICENSE_RTF%"
|
---|
| 56 | !endif
|
---|
| 57 |
|
---|
| 58 | FILE "$%VBOX_PATH_DIFX%\DIFxAPI.dll"
|
---|
| 59 | FILE "$%PATH_OUT%\bin\additions\VBoxDrvInst.exe"
|
---|
| 60 |
|
---|
| 61 | FILE "$%PATH_OUT%\bin\additions\VBoxVideo.inf"
|
---|
[98626] | 62 | !if $%KBUILD_TARGET_ARCH% == "x86"
|
---|
| 63 | ${If} $g_strEarlyNTDrvInfix != ""
|
---|
| 64 | FILE "$%PATH_OUT%\bin\additions\VBoxVideoEarlyNT.inf"
|
---|
| 65 | !ifdef VBOX_SIGN_ADDITIONS
|
---|
| 66 | FILE "$%PATH_OUT%\bin\additions\VBoxVideoEarlyNT.cat"
|
---|
| 67 | !endif
|
---|
| 68 | ${EndIf}
|
---|
| 69 | !endif
|
---|
[39558] | 70 | !ifdef VBOX_SIGN_ADDITIONS
|
---|
[94160] | 71 | ${If} $g_strWinVersion == "10"
|
---|
| 72 | FILE "$%PATH_OUT%\bin\additions\VBoxVideo.cat"
|
---|
| 73 | ${Else}
|
---|
| 74 | FILE "/oname=VBoxVideo.cat" "$%PATH_OUT%\bin\additions\VBoxVideo-PreW10.cat"
|
---|
| 75 | ${EndIf}
|
---|
[39558] | 76 | !endif
|
---|
| 77 |
|
---|
| 78 | FunctionEnd
|
---|
| 79 |
|
---|
[31634] | 80 | !ifndef UNINSTALLER_ONLY
|
---|
[96686] | 81 | ;;
|
---|
| 82 | ; Extract files to the install dir + arch.
|
---|
| 83 | ;
|
---|
[31634] | 84 | Function ExtractFiles
|
---|
| 85 |
|
---|
| 86 | ; @todo: Use a define for all the file specs to group the files per module
|
---|
[34099] | 87 | ; and keep the redundancy low
|
---|
[31634] | 88 |
|
---|
| 89 | Push $0
|
---|
[84945] | 90 | StrCpy "$0" "$INSTDIR\$%KBUILD_TARGET_ARCH%"
|
---|
[31634] | 91 |
|
---|
[35660] | 92 | ; Root files
|
---|
| 93 | SetOutPath "$0"
|
---|
[35659] | 94 | !if $%VBOX_WITH_LICENSE_INSTALL_RTF% == "1"
|
---|
[35660] | 95 | FILE "/oname=${LICENSE_FILE_RTF}" "$%VBOX_BRAND_LICENSE_RTF%"
|
---|
[34677] | 96 | !endif
|
---|
| 97 |
|
---|
[31634] | 98 | ; Video driver
|
---|
| 99 | SetOutPath "$0\VBoxVideo"
|
---|
| 100 | FILE "$%PATH_OUT%\bin\additions\VBoxVideo.sys"
|
---|
| 101 | FILE "$%PATH_OUT%\bin\additions\VBoxVideo.inf"
|
---|
[98626] | 102 | !if $%KBUILD_TARGET_ARCH% == "x86"
|
---|
| 103 | ${If} $g_strEarlyNTDrvInfix != ""
|
---|
| 104 | FILE "$%PATH_OUT%\bin\additions\VBoxVideoEarlyNT.inf"
|
---|
| 105 | !ifdef VBOX_SIGN_ADDITIONS
|
---|
| 106 | FILE "$%PATH_OUT%\bin\additions\VBoxVideoEarlyNT.cat"
|
---|
| 107 | !endif
|
---|
| 108 | ${EndIf}
|
---|
| 109 | !endif
|
---|
[31634] | 110 | !ifdef VBOX_SIGN_ADDITIONS
|
---|
[94160] | 111 | ${If} $g_strWinVersion == "10"
|
---|
| 112 | FILE "$%PATH_OUT%\bin\additions\VBoxVideo.cat"
|
---|
| 113 | ${Else}
|
---|
| 114 | FILE "/oname=VBoxVideo.cat" "$%PATH_OUT%\bin\additions\VBoxVideo-PreW10.cat"
|
---|
| 115 | ${EndIf}
|
---|
[31634] | 116 | !endif
|
---|
| 117 | FILE "$%PATH_OUT%\bin\additions\VBoxDisp.dll"
|
---|
| 118 |
|
---|
[35319] | 119 | !if $%VBOX_WITH_WDDM% == "1"
|
---|
[71323] | 120 | ; WDDM Video driver
|
---|
| 121 | SetOutPath "$0\VBoxWddm"
|
---|
[35651] | 122 |
|
---|
[35319] | 123 | !ifdef VBOX_SIGN_ADDITIONS
|
---|
[94160] | 124 | ${If} $g_strWinVersion == "10"
|
---|
| 125 | FILE "$%PATH_OUT%\bin\additions\VBoxWddm.cat"
|
---|
| 126 | ${Else}
|
---|
| 127 | FILE "/oname=VBoxWddm.cat" "$%PATH_OUT%\bin\additions\VBoxWddm-PreW10.cat"
|
---|
| 128 | ${EndIf}
|
---|
[35319] | 129 | !endif
|
---|
[71323] | 130 | FILE "$%PATH_OUT%\bin\additions\VBoxWddm.sys"
|
---|
| 131 | FILE "$%PATH_OUT%\bin\additions\VBoxWddm.inf"
|
---|
[35319] | 132 | FILE "$%PATH_OUT%\bin\additions\VBoxDispD3D.dll"
|
---|
[94485] | 133 | !if $%VBOX_WITH_WDDM_DX% == "1"
|
---|
| 134 | FILE "$%PATH_OUT%\bin\additions\VBoxDX.dll"
|
---|
| 135 | !endif
|
---|
[75445] | 136 | !if $%VBOX_WITH_MESA3D% == "1"
|
---|
| 137 | FILE "$%PATH_OUT%\bin\additions\VBoxNine.dll"
|
---|
| 138 | FILE "$%PATH_OUT%\bin\additions\VBoxSVGA.dll"
|
---|
| 139 | FILE "$%PATH_OUT%\bin\additions\VBoxGL.dll"
|
---|
| 140 | !endif
|
---|
[35319] | 141 |
|
---|
[84945] | 142 | !if $%KBUILD_TARGET_ARCH% == "amd64"
|
---|
[35319] | 143 | FILE "$%PATH_OUT%\bin\additions\VBoxDispD3D-x86.dll"
|
---|
[94485] | 144 | !if $%VBOX_WITH_WDDM_DX% == "1"
|
---|
| 145 | FILE "$%PATH_OUT%\bin\additions\VBoxDX-x86.dll"
|
---|
| 146 | !endif
|
---|
[75445] | 147 | !if $%VBOX_WITH_MESA3D% == "1"
|
---|
| 148 | FILE "$%PATH_OUT%\bin\additions\VBoxNine-x86.dll"
|
---|
| 149 | FILE "$%PATH_OUT%\bin\additions\VBoxSVGA-x86.dll"
|
---|
| 150 | FILE "$%PATH_OUT%\bin\additions\VBoxGL-x86.dll"
|
---|
| 151 | !endif
|
---|
[35319] | 152 |
|
---|
[84945] | 153 | !endif ; $%KBUILD_TARGET_ARCH% == "amd64"
|
---|
[35319] | 154 | !endif ; $%VBOX_WITH_WDDM% == "1"
|
---|
| 155 |
|
---|
[31634] | 156 | ; Mouse driver
|
---|
| 157 | SetOutPath "$0\VBoxMouse"
|
---|
| 158 | FILE "$%PATH_OUT%\bin\additions\VBoxMouse.sys"
|
---|
| 159 | FILE "$%PATH_OUT%\bin\additions\VBoxMouse.inf"
|
---|
| 160 | !ifdef VBOX_SIGN_ADDITIONS
|
---|
[94160] | 161 | ${If} $g_strWinVersion == "10"
|
---|
| 162 | FILE "$%PATH_OUT%\bin\additions\VBoxMouse.cat"
|
---|
| 163 | ${Else}
|
---|
| 164 | FILE "/oname=VBoxMouse.cat" "$%PATH_OUT%\bin\additions\VBoxMouse-PreW10.cat"
|
---|
| 165 | ${EndIf}
|
---|
[31634] | 166 | !endif
|
---|
| 167 |
|
---|
[84945] | 168 | !if $%KBUILD_TARGET_ARCH% == "x86"
|
---|
[31634] | 169 | SetOutPath "$0\VBoxMouse\NT4"
|
---|
| 170 | FILE "$%PATH_OUT%\bin\additions\VBoxMouseNT.sys"
|
---|
| 171 | !endif
|
---|
| 172 |
|
---|
| 173 | ; Guest driver
|
---|
| 174 | SetOutPath "$0\VBoxGuest"
|
---|
| 175 | FILE "$%PATH_OUT%\bin\additions\VBoxGuest.sys"
|
---|
| 176 | FILE "$%PATH_OUT%\bin\additions\VBoxGuest.inf"
|
---|
[98626] | 177 | !if $%KBUILD_TARGET_ARCH% == "x86"
|
---|
| 178 | ${If} $g_strEarlyNTDrvInfix != ""
|
---|
| 179 | FILE "$%PATH_OUT%\bin\additions\VBoxGuestEarlyNT.inf"
|
---|
| 180 | !ifdef VBOX_SIGN_ADDITIONS
|
---|
| 181 | FILE "$%PATH_OUT%\bin\additions\VBoxGuestEarlyNT.cat"
|
---|
| 182 | !endif
|
---|
| 183 | ${EndIf}
|
---|
| 184 | !endif
|
---|
[31634] | 185 | !ifdef VBOX_SIGN_ADDITIONS
|
---|
[94160] | 186 | ${If} $g_strWinVersion == "10"
|
---|
| 187 | FILE "$%PATH_OUT%\bin\additions\VBoxGuest.cat"
|
---|
| 188 | ${Else}
|
---|
| 189 | FILE "/oname=VBoxGuest.cat" "$%PATH_OUT%\bin\additions\VBoxGuest-PreW10.cat"
|
---|
| 190 | ${EndIf}
|
---|
[31634] | 191 | !endif
|
---|
| 192 | FILE "$%PATH_OUT%\bin\additions\VBoxTray.exe"
|
---|
| 193 | FILE "$%PATH_OUT%\bin\additions\VBoxHook.dll"
|
---|
| 194 | FILE "$%PATH_OUT%\bin\additions\VBoxControl.exe"
|
---|
| 195 |
|
---|
| 196 | ; VBoxService
|
---|
| 197 | SetOutPath "$0\Bin"
|
---|
| 198 | FILE "$%PATH_OUT%\bin\additions\VBoxService.exe"
|
---|
| 199 |
|
---|
| 200 | ; Shared Folders
|
---|
| 201 | SetOutPath "$0\VBoxSF"
|
---|
| 202 | FILE "$%PATH_OUT%\bin\additions\VBoxSF.sys"
|
---|
| 203 | FILE "$%PATH_OUT%\bin\additions\VBoxMRXNP.dll"
|
---|
[84945] | 204 | !if $%KBUILD_TARGET_ARCH% == "amd64"
|
---|
[40136] | 205 | ; Only 64-bit installer: Also copy 32-bit DLLs on 64-bit target
|
---|
| 206 | FILE "$%PATH_OUT%\bin\additions\VBoxMRXNP-x86.dll"
|
---|
| 207 | !endif
|
---|
[31634] | 208 |
|
---|
| 209 | ; Auto-Logon
|
---|
| 210 | SetOutPath "$0\AutoLogon"
|
---|
| 211 | FILE "$%PATH_OUT%\bin\additions\VBoxGINA.dll"
|
---|
| 212 | FILE "$%PATH_OUT%\bin\additions\VBoxCredProv.dll"
|
---|
| 213 |
|
---|
| 214 | ; Misc tools
|
---|
| 215 | SetOutPath "$0\Tools"
|
---|
| 216 | FILE "$%PATH_OUT%\bin\additions\VBoxDrvInst.exe"
|
---|
[35651] | 217 | FILE "$%VBOX_PATH_DIFX%\DIFxAPI.dll"
|
---|
[89709] | 218 | !ifdef VBOX_WITH_ADDITIONS_SHIPPING_AUDIO_TEST
|
---|
| 219 | FILE "$%PATH_OUT%\bin\additions\VBoxAudioTest.exe"
|
---|
| 220 | !endif
|
---|
[31634] | 221 |
|
---|
[84945] | 222 | !if $%KBUILD_TARGET_ARCH% == "x86"
|
---|
[31634] | 223 | SetOutPath "$0\Tools\NT4"
|
---|
| 224 | FILE "$%PATH_OUT%\bin\additions\RegCleanup.exe"
|
---|
| 225 | !endif
|
---|
| 226 |
|
---|
| 227 | Pop $0
|
---|
| 228 |
|
---|
| 229 | FunctionEnd
|
---|
| 230 | !endif ; UNINSTALLER_ONLY
|
---|
| 231 |
|
---|
[96686] | 232 | ;;
|
---|
| 233 | ; Checks that the installer target architecture matches the host,
|
---|
| 234 | ; i.e. that we're not trying to install 32-bit binaries on a 64-bit
|
---|
| 235 | ; host from WOW64 mode.
|
---|
| 236 | ;
|
---|
[34549] | 237 | !macro CheckArchitecture un
|
---|
| 238 | Function ${un}CheckArchitecture
|
---|
| 239 |
|
---|
[96686] | 240 | Push $0 ;; @todo r=bird: Why ??
|
---|
[34549] | 241 |
|
---|
| 242 | System::Call "kernel32::GetCurrentProcess() i .s"
|
---|
| 243 | System::Call "kernel32::IsWow64Process(i s, *i .r0)"
|
---|
| 244 | ; R0 now contains 1 if we're a 64-bit process, or 0 if not
|
---|
| 245 |
|
---|
[84945] | 246 | !if $%KBUILD_TARGET_ARCH% == "amd64"
|
---|
[34549] | 247 | IntCmp $0 0 wrong_platform
|
---|
| 248 | !else ; 32-bit
|
---|
| 249 | IntCmp $0 1 wrong_platform
|
---|
| 250 | !endif
|
---|
| 251 |
|
---|
| 252 | Push 0
|
---|
| 253 | Goto exit
|
---|
| 254 |
|
---|
| 255 | wrong_platform:
|
---|
| 256 |
|
---|
| 257 | Push 1
|
---|
| 258 | Goto exit
|
---|
| 259 |
|
---|
| 260 | exit:
|
---|
| 261 |
|
---|
| 262 | FunctionEnd
|
---|
| 263 | !macroend
|
---|
[96694] | 264 | !ifndef UNINSTALLER_ONLY
|
---|
| 265 | !insertmacro CheckArchitecture ""
|
---|
| 266 | !insertmacro CheckArchitecture "un."
|
---|
| 267 | !endif
|
---|
[34549] | 268 |
|
---|
[44484] | 269 | ;
|
---|
| 270 | ; Macro for retrieving the Windows version this installer is running on.
|
---|
| 271 | ;
|
---|
| 272 | ; @return Stack: Windows version string. Empty on error /
|
---|
| 273 | ; if not able to identify.
|
---|
| 274 | ;
|
---|
| 275 | !macro GetWindowsVersionEx un
|
---|
| 276 | Function ${un}GetWindowsVersionEx
|
---|
[31634] | 277 |
|
---|
[44484] | 278 | Push $0
|
---|
| 279 | Push $1
|
---|
| 280 |
|
---|
| 281 | ; Check if we are running on Windows 2000 or above
|
---|
| 282 | ; For other windows versions (> XP) it may be necessary to change winver.nsh
|
---|
[31634] | 283 | Call ${un}GetWindowsVersion
|
---|
[44484] | 284 | Pop $0 ; Windows Version
|
---|
[31634] | 285 |
|
---|
[44484] | 286 | Push $0 ; The windows version string
|
---|
| 287 | Push "NT" ; String to search for. W2K+ returns no string containing "NT"
|
---|
[31634] | 288 | Call ${un}StrStr
|
---|
[44484] | 289 | Pop $1
|
---|
[31634] | 290 |
|
---|
[44484] | 291 | ${If} $1 == "" ; If empty -> not NT 3.XX or 4.XX
|
---|
[44493] | 292 | ; $0 contains the original version string
|
---|
[44484] | 293 | ${Else}
|
---|
| 294 | ; Ok we know it is NT. Must be a string like NT X.XX
|
---|
| 295 | Push $0 ; The windows version string
|
---|
| 296 | Push "4." ; String to search for
|
---|
| 297 | Call ${un}StrStr
|
---|
| 298 | Pop $1
|
---|
| 299 | ${If} $1 == "" ; If empty -> not NT 4
|
---|
| 300 | ;; @todo NT <= 3.x ?
|
---|
[44493] | 301 | ; $0 contains the original version string
|
---|
[44484] | 302 | ${Else}
|
---|
[44493] | 303 | StrCpy $0 "NT4"
|
---|
[44484] | 304 | ${EndIf}
|
---|
| 305 | ${EndIf}
|
---|
[31634] | 306 |
|
---|
[44484] | 307 | Pop $1
|
---|
| 308 | Exch $0
|
---|
[31634] | 309 |
|
---|
| 310 | FunctionEnd
|
---|
| 311 | !macroend
|
---|
[96694] | 312 | !ifndef UNINSTALLER_ONLY
|
---|
| 313 | !insertmacro GetWindowsVersionEx ""
|
---|
| 314 | !endif
|
---|
[44484] | 315 | !insertmacro GetWindowsVersionEx "un."
|
---|
[31634] | 316 |
|
---|
[96693] | 317 | !ifndef UNINSTALLER_ONLY
|
---|
[31634] | 318 | !macro GetAdditionsVersion un
|
---|
| 319 | Function ${un}GetAdditionsVersion
|
---|
| 320 |
|
---|
| 321 | Push $0
|
---|
| 322 | Push $1
|
---|
| 323 |
|
---|
| 324 | ; Get additions version
|
---|
| 325 | ReadRegStr $0 HKLM "SOFTWARE\$%VBOX_VENDOR_SHORT%\VirtualBox Guest Additions" "Version"
|
---|
| 326 |
|
---|
| 327 | ; Get revision
|
---|
| 328 | ReadRegStr $g_strAddVerRev HKLM "SOFTWARE\$%VBOX_VENDOR_SHORT%\VirtualBox Guest Additions" "Revision"
|
---|
| 329 |
|
---|
| 330 | ; Extract major version
|
---|
| 331 | Push "$0" ; String
|
---|
| 332 | Push "." ; SubString
|
---|
| 333 | Push ">" ; SearchDirection
|
---|
| 334 | Push "<" ; StrInclusionDirection
|
---|
| 335 | Push "0" ; IncludeSubString
|
---|
| 336 | Push "0" ; Loops
|
---|
| 337 | Push "0" ; CaseSensitive
|
---|
| 338 | Call ${un}StrStrAdv
|
---|
| 339 | Pop $g_strAddVerMaj
|
---|
| 340 |
|
---|
| 341 | ; Extract minor version
|
---|
| 342 | Push "$0" ; String
|
---|
| 343 | Push "." ; SubString
|
---|
| 344 | Push ">" ; SearchDirection
|
---|
| 345 | Push ">" ; StrInclusionDirection
|
---|
| 346 | Push "0" ; IncludeSubString
|
---|
| 347 | Push "0" ; Loops
|
---|
| 348 | Push "0" ; CaseSensitive
|
---|
| 349 | Call ${un}StrStrAdv
|
---|
| 350 | Pop $1 ; Got first part (e.g. "1.5")
|
---|
| 351 |
|
---|
| 352 | Push "$1" ; String
|
---|
| 353 | Push "." ; SubString
|
---|
| 354 | Push ">" ; SearchDirection
|
---|
| 355 | Push "<" ; StrInclusionDirection
|
---|
| 356 | Push "0" ; IncludeSubString
|
---|
| 357 | Push "0" ; Loops
|
---|
| 358 | Push "0" ; CaseSensitive
|
---|
| 359 | Call ${un}StrStrAdv
|
---|
| 360 | Pop $g_strAddVerMin ; Extracted second part (e.g. "5" from "1.5")
|
---|
| 361 |
|
---|
| 362 | ; Extract build number
|
---|
| 363 | Push "$0" ; String
|
---|
| 364 | Push "." ; SubString
|
---|
| 365 | Push "<" ; SearchDirection
|
---|
| 366 | Push ">" ; StrInclusionDirection
|
---|
| 367 | Push "0" ; IncludeSubString
|
---|
| 368 | Push "0" ; Loops
|
---|
| 369 | Push "0" ; CaseSensitive
|
---|
| 370 | Call ${un}StrStrAdv
|
---|
| 371 | Pop $g_strAddVerBuild
|
---|
| 372 |
|
---|
| 373 | Pop $1
|
---|
| 374 | Pop $0
|
---|
| 375 |
|
---|
| 376 | FunctionEnd
|
---|
| 377 | !macroend
|
---|
| 378 | !insertmacro GetAdditionsVersion ""
|
---|
[96695] | 379 | ; !insertmacro GetAdditionsVersion "un." - not used.
|
---|
[96693] | 380 | !endif ; UNINSTALLER_ONLY
|
---|
[31634] | 381 |
|
---|
| 382 | !macro StopVBoxService un
|
---|
| 383 | Function ${un}StopVBoxService
|
---|
| 384 |
|
---|
| 385 | Push $0 ; Temp results
|
---|
| 386 | Push $1
|
---|
| 387 | Push $2 ; Image name of VBoxService
|
---|
| 388 | Push $3 ; Safety counter
|
---|
| 389 |
|
---|
| 390 | StrCpy $3 "0" ; Init counter
|
---|
[44352] | 391 | ${LogVerbose} "Stopping VBoxService ..."
|
---|
[31634] | 392 |
|
---|
[44352] | 393 | ${LogVerbose} "Stopping VBoxService via SCM ..."
|
---|
[32503] | 394 | ${If} $g_strWinVersion == "NT4"
|
---|
[44352] | 395 | nsExec::Exec '"$SYSDIR\net.exe" stop VBoxService'
|
---|
[31634] | 396 | ${Else}
|
---|
[96686] | 397 | nsExec::Exec '"$SYSDIR\sc.exe" stop VBoxService'
|
---|
[31634] | 398 | ${EndIf}
|
---|
| 399 | Sleep "1000" ; Wait a bit
|
---|
| 400 |
|
---|
| 401 | !ifdef _DEBUG
|
---|
[44352] | 402 | ${LogVerbose} "Stopping VBoxService (as exe) ..."
|
---|
[31634] | 403 | !endif
|
---|
| 404 |
|
---|
| 405 | exe_stop_loop:
|
---|
| 406 |
|
---|
| 407 | IntCmp $3 10 exit ; Only try this loop 10 times max
|
---|
| 408 | IntOp $3 $3 + 1 ; Increment
|
---|
| 409 |
|
---|
[44352] | 410 | !ifdef _DEBUG
|
---|
| 411 | ${LogVerbose} "Stopping attempt #$3"
|
---|
| 412 | !endif
|
---|
[44484] | 413 |
|
---|
[70175] | 414 | StrCpy $2 "VBoxService.exe"
|
---|
[31634] | 415 |
|
---|
| 416 | ${nsProcess::FindProcess} $2 $0
|
---|
| 417 | StrCmp $0 0 0 exit
|
---|
| 418 |
|
---|
| 419 | ${nsProcess::KillProcess} $2 $0
|
---|
[44352] | 420 | Sleep "1000" ; Wait a bit
|
---|
[31634] | 421 | Goto exe_stop_loop
|
---|
| 422 |
|
---|
| 423 | exit:
|
---|
| 424 |
|
---|
[44352] | 425 | ${LogVerbose} "Stopping VBoxService done"
|
---|
[31634] | 426 |
|
---|
| 427 | Pop $3
|
---|
| 428 | Pop $2
|
---|
| 429 | Pop $1
|
---|
| 430 | Pop $0
|
---|
| 431 |
|
---|
| 432 | FunctionEnd
|
---|
| 433 | !macroend
|
---|
| 434 | !insertmacro StopVBoxService ""
|
---|
| 435 | !insertmacro StopVBoxService "un."
|
---|
| 436 |
|
---|
| 437 | !macro StopVBoxTray un
|
---|
| 438 | Function ${un}StopVBoxTray
|
---|
| 439 |
|
---|
| 440 | Push $0 ; Temp results
|
---|
| 441 | Push $1 ; Safety counter
|
---|
| 442 |
|
---|
| 443 | StrCpy $1 "0" ; Init counter
|
---|
[44352] | 444 | ${LogVerbose} "Stopping VBoxTray ..."
|
---|
[31634] | 445 |
|
---|
| 446 | exe_stop:
|
---|
| 447 |
|
---|
| 448 | IntCmp $1 10 exit ; Only try this loop 10 times max
|
---|
| 449 | IntOp $1 $1 + 1 ; Increment
|
---|
| 450 |
|
---|
| 451 | ${nsProcess::FindProcess} "VBoxTray.exe" $0
|
---|
| 452 | StrCmp $0 0 0 exit
|
---|
| 453 |
|
---|
| 454 | ${nsProcess::KillProcess} "VBoxTray.exe" $0
|
---|
| 455 | Sleep "1000" ; Wait a bit
|
---|
| 456 | Goto exe_stop
|
---|
| 457 |
|
---|
| 458 | exit:
|
---|
| 459 |
|
---|
[44352] | 460 | ${LogVerbose} "Stopping VBoxTray done"
|
---|
[31634] | 461 |
|
---|
| 462 | Pop $1
|
---|
| 463 | Pop $0
|
---|
| 464 |
|
---|
| 465 | FunctionEnd
|
---|
| 466 | !macroend
|
---|
| 467 | !insertmacro StopVBoxTray ""
|
---|
| 468 | !insertmacro StopVBoxTray "un."
|
---|
| 469 |
|
---|
[44864] | 470 | !macro StopVBoxMMR un
|
---|
| 471 | Function ${un}StopVBoxMMR
|
---|
| 472 |
|
---|
| 473 | Push $0 ; Temp results
|
---|
| 474 | Push $1 ; Safety counter
|
---|
| 475 |
|
---|
| 476 | StrCpy $1 "0" ; Init counter
|
---|
| 477 | DetailPrint "Stopping VBoxMMR ..."
|
---|
| 478 |
|
---|
| 479 | exe_stop:
|
---|
| 480 |
|
---|
| 481 | IntCmp $1 10 exit ; Only try this loop 10 times max
|
---|
| 482 | IntOp $1 $1 + 1 ; Increment
|
---|
| 483 |
|
---|
| 484 | ${nsProcess::FindProcess} "VBoxMMR.exe" $0
|
---|
| 485 | StrCmp $0 0 0 exit
|
---|
| 486 |
|
---|
| 487 | ${nsProcess::KillProcess} "VBoxMMR.exe" $0
|
---|
| 488 | Sleep "1000" ; Wait a bit
|
---|
| 489 | Goto exe_stop
|
---|
| 490 |
|
---|
| 491 | exit:
|
---|
| 492 |
|
---|
| 493 | DetailPrint "Stopping VBoxMMR done."
|
---|
| 494 |
|
---|
| 495 | Pop $1
|
---|
| 496 | Pop $0
|
---|
| 497 |
|
---|
| 498 | FunctionEnd
|
---|
| 499 | !macroend
|
---|
| 500 | !insertmacro StopVBoxMMR ""
|
---|
| 501 | !insertmacro StopVBoxMMR "un."
|
---|
| 502 |
|
---|
[31634] | 503 | !macro WriteRegBinR ROOT KEY NAME VALUE
|
---|
| 504 | WriteRegBin "${ROOT}" "${KEY}" "${NAME}" "${VALUE}"
|
---|
| 505 | !macroend
|
---|
| 506 |
|
---|
[96693] | 507 | !ifdef UNUSED_CODE ; Only used by unused Uninstall_RunExtUnInstaller function in VBoxguestAdditionsUninstallOld.nsh.
|
---|
[31634] | 508 | !macro AbortShutdown un
|
---|
| 509 | Function ${un}AbortShutdown
|
---|
| 510 |
|
---|
[44459] | 511 | ${If} ${FileExists} "$g_strSystemDir\shutdown.exe"
|
---|
| 512 | ; Try to abort the shutdown
|
---|
[96687] | 513 | ${CmdExecute} "$\"$g_strSystemDir\shutdown.exe$\" -a" 'non-zero-exitcode=log'
|
---|
[44459] | 514 | ${Else}
|
---|
| 515 | ${LogVerbose} "Shutting down not supported: Binary $\"$g_strSystemDir\shutdown.exe$\" not found"
|
---|
| 516 | ${EndIf}
|
---|
[31634] | 517 |
|
---|
| 518 | FunctionEnd
|
---|
| 519 | !macroend
|
---|
| 520 | !insertmacro AbortShutdown ""
|
---|
| 521 | !insertmacro AbortShutdown "un."
|
---|
[96693] | 522 | !endif ; UNUSED_CODE
|
---|
[32683] | 523 |
|
---|
[96686] | 524 | ;;
|
---|
| 525 | ; Sets $g_bCapDllCache, $g_bCapXPDM, $g_bWithWDDM and $g_bCapWDDM.
|
---|
| 526 | ;
|
---|
[32683] | 527 | !macro CheckForCapabilities un
|
---|
| 528 | Function ${un}CheckForCapabilities
|
---|
| 529 |
|
---|
[34549] | 530 | Push $0
|
---|
[32683] | 531 |
|
---|
[34549] | 532 | ; Retrieve system mode and store result in
|
---|
| 533 | System::Call 'user32::GetSystemMetrics(i ${SM_CLEANBOOT}) i .r0'
|
---|
| 534 | StrCpy $g_iSystemMode $0
|
---|
| 535 |
|
---|
[40711] | 536 | ; Does the guest have a DLL cache?
|
---|
[96686] | 537 | ${If} $g_strWinVersion == "NT4" ; bird: NT4 doesn't have a DLL cache, WTP is 5.0 <= NtVersion < 6.0.
|
---|
[60526] | 538 | ${OrIf} $g_strWinVersion == "2000"
|
---|
| 539 | ${OrIf} $g_strWinVersion == "XP"
|
---|
[40711] | 540 | StrCpy $g_bCapDllCache "true"
|
---|
[44352] | 541 | ${LogVerbose} "OS has a DLL cache"
|
---|
[40711] | 542 | ${EndIf}
|
---|
| 543 |
|
---|
[84433] | 544 | ${If} $g_strWinVersion == "2000"
|
---|
| 545 | ${OrIf} $g_strWinVersion == "XP"
|
---|
| 546 | ${OrIf} $g_strWinVersion == "2003"
|
---|
| 547 | ${OrIf} $g_strWinVersion == "Vista"
|
---|
| 548 | ${OrIf} $g_strWinVersion == "7"
|
---|
| 549 | StrCpy $g_bCapXPDM "true"
|
---|
| 550 | ${LogVerbose} "OS is XPDM driver capable"
|
---|
| 551 | ${EndIf}
|
---|
[34549] | 552 |
|
---|
[84433] | 553 | !if $%VBOX_WITH_WDDM% == "1"
|
---|
| 554 | ; By default use the WDDM driver on Vista+
|
---|
| 555 | ${If} $g_strWinVersion == "Vista"
|
---|
| 556 | ${OrIf} $g_strWinVersion == "7"
|
---|
| 557 | ${OrIf} $g_strWinVersion == "8"
|
---|
| 558 | ${OrIf} $g_strWinVersion == "8_1"
|
---|
| 559 | ${OrIf} $g_strWinVersion == "10"
|
---|
| 560 | StrCpy $g_bWithWDDM "true"
|
---|
| 561 | StrCpy $g_bCapWDDM "true"
|
---|
| 562 | ${LogVerbose} "OS is WDDM driver capable"
|
---|
| 563 | ${EndIf}
|
---|
| 564 | !endif
|
---|
| 565 |
|
---|
[34549] | 566 | Pop $0
|
---|
| 567 |
|
---|
[32683] | 568 | FunctionEnd
|
---|
| 569 | !macroend
|
---|
[96694] | 570 | !ifndef UNINSTALLER_ONLY
|
---|
| 571 | !insertmacro CheckForCapabilities ""
|
---|
| 572 | !endif
|
---|
[32683] | 573 | !insertmacro CheckForCapabilities "un."
|
---|
| 574 |
|
---|
[36311] | 575 | ; Switches (back) the path + registry view to
|
---|
| 576 | ; 32-bit mode (SysWOW64) on 64-bit guests
|
---|
| 577 | !macro SetAppMode32 un
|
---|
| 578 | Function ${un}SetAppMode32
|
---|
[84945] | 579 | !if $%KBUILD_TARGET_ARCH% == "amd64"
|
---|
[36311] | 580 | ${EnableX64FSRedirection}
|
---|
| 581 | SetRegView 32
|
---|
| 582 | !endif
|
---|
| 583 | FunctionEnd
|
---|
| 584 | !macroend
|
---|
[96694] | 585 | !ifndef UNINSTALLER_ONLY
|
---|
| 586 | !insertmacro SetAppMode32 ""
|
---|
| 587 | !insertmacro SetAppMode32 "un."
|
---|
| 588 | !endif
|
---|
[36311] | 589 |
|
---|
| 590 | ; Because this NSIS installer is always built in 32-bit mode, we have to
|
---|
| 591 | ; do some tricks for the Windows paths + registry on 64-bit guests
|
---|
| 592 | !macro SetAppMode64 un
|
---|
| 593 | Function ${un}SetAppMode64
|
---|
[84945] | 594 | !if $%KBUILD_TARGET_ARCH% == "amd64"
|
---|
[36311] | 595 | ${DisableX64FSRedirection}
|
---|
| 596 | SetRegView 64
|
---|
| 597 | !endif
|
---|
| 598 | FunctionEnd
|
---|
| 599 | !macroend
|
---|
| 600 | !insertmacro SetAppMode64 ""
|
---|
| 601 | !insertmacro SetAppMode64 "un."
|
---|
| 602 |
|
---|
[39549] | 603 | ;
|
---|
| 604 | ; Retrieves the vendor ("CompanyName" of FILEINFO structure)
|
---|
| 605 | ; of a given file.
|
---|
| 606 | ; @return Stack: Company name, or "" on error/if not found.
|
---|
| 607 | ; @param Stack: File name to retrieve vendor for.
|
---|
| 608 | ;
|
---|
| 609 | !macro GetFileVendor un
|
---|
| 610 | Function ${un}GetFileVendor
|
---|
| 611 |
|
---|
| 612 | ; Preserve values
|
---|
| 613 | Exch $0 ; Stack: $0 <filename> (Get file name into $0)
|
---|
| 614 | Push $1
|
---|
| 615 |
|
---|
| 616 | IfFileExists "$0" found
|
---|
| 617 | Goto not_found
|
---|
| 618 |
|
---|
| 619 | found:
|
---|
| 620 |
|
---|
| 621 | VBoxGuestInstallHelper::FileGetVendor "$0"
|
---|
| 622 | ; Stack: <vendor> $1 $0
|
---|
| 623 | Pop $0 ; Get vendor
|
---|
| 624 | Pop $1 ; Restore $1
|
---|
| 625 | Exch $0 ; Restore $0, push vendor on top of stack
|
---|
| 626 | Goto end
|
---|
| 627 |
|
---|
| 628 | not_found:
|
---|
| 629 |
|
---|
| 630 | Pop $1
|
---|
| 631 | Pop $0
|
---|
| 632 | Push "File not found"
|
---|
| 633 | Goto end
|
---|
| 634 |
|
---|
| 635 | end:
|
---|
| 636 |
|
---|
| 637 | FunctionEnd
|
---|
| 638 | !macroend
|
---|
| 639 | !insertmacro GetFileVendor ""
|
---|
| 640 | !insertmacro GetFileVendor "un."
|
---|
| 641 |
|
---|
| 642 | ;
|
---|
| 643 | ; Retrieves the architecture of a given file.
|
---|
| 644 | ; @return Stack: Architecture ("x86", "amd64") or error message.
|
---|
| 645 | ; @param Stack: File name to retrieve architecture for.
|
---|
| 646 | ;
|
---|
| 647 | !macro GetFileArchitecture un
|
---|
| 648 | Function ${un}GetFileArchitecture
|
---|
| 649 |
|
---|
| 650 | ; Preserve values
|
---|
| 651 | Exch $0 ; Stack: $0 <filename> (Get file name into $0)
|
---|
| 652 | Push $1
|
---|
| 653 |
|
---|
| 654 | IfFileExists "$0" found
|
---|
| 655 | Goto not_found
|
---|
| 656 |
|
---|
| 657 | found:
|
---|
| 658 |
|
---|
[82625] | 659 | ${LogVerbose} "Getting architecture of file $\"$0$\" ..."
|
---|
| 660 |
|
---|
[39549] | 661 | VBoxGuestInstallHelper::FileGetArchitecture "$0"
|
---|
[82625] | 662 |
|
---|
[39549] | 663 | ; Stack: <architecture> $1 $0
|
---|
| 664 | Pop $0 ; Get architecture string
|
---|
[82625] | 665 |
|
---|
| 666 | ${LogVerbose} "Architecture is: $0"
|
---|
| 667 |
|
---|
[39549] | 668 | Pop $1 ; Restore $1
|
---|
| 669 | Exch $0 ; Restore $0, push vendor on top of stack
|
---|
| 670 | Goto end
|
---|
| 671 |
|
---|
| 672 | not_found:
|
---|
| 673 |
|
---|
| 674 | Pop $1
|
---|
| 675 | Pop $0
|
---|
| 676 | Push "File not found"
|
---|
| 677 | Goto end
|
---|
| 678 |
|
---|
| 679 | end:
|
---|
| 680 |
|
---|
| 681 | FunctionEnd
|
---|
| 682 | !macroend
|
---|
| 683 | !insertmacro GetFileArchitecture ""
|
---|
| 684 | !insertmacro GetFileArchitecture "un."
|
---|
| 685 |
|
---|
| 686 | ;
|
---|
| 687 | ; Verifies a given file by checking its file vendor and target
|
---|
| 688 | ; architecture.
|
---|
[39558] | 689 | ; @return Stack: "0" if valid, "1" if not, "2" on error / not found.
|
---|
[39549] | 690 | ; @param Stack: Architecture ("x86" or "amd64").
|
---|
| 691 | ; @param Stack: Vendor.
|
---|
| 692 | ; @param Stack: File name to verify.
|
---|
| 693 | ;
|
---|
| 694 | !macro VerifyFile un
|
---|
| 695 | Function ${un}VerifyFile
|
---|
| 696 |
|
---|
| 697 | ; Preserve values
|
---|
| 698 | Exch $0 ; File; S: old$0 vendor arch
|
---|
| 699 | Exch ; S: vendor old$0 arch
|
---|
| 700 | Exch $1 ; Vendor; S: old$1 old$0 arch
|
---|
| 701 | Exch ; S: old$0 old$1 arch
|
---|
| 702 | Exch 2 ; S: arch old$1 old$0
|
---|
| 703 | Exch $2 ; Architecture; S: old$2 old$1 old$0
|
---|
| 704 | Push $3 ; S: old$3 old$2 old$1 old$0
|
---|
| 705 |
|
---|
[82606] | 706 | ${LogVerbose} "Verifying file $\"$0$\" (vendor: $1, arch: $2) ..."
|
---|
| 707 |
|
---|
| 708 | IfFileExists "$0" check_arch
|
---|
[39549] | 709 | Goto not_found
|
---|
| 710 |
|
---|
[82606] | 711 | check_arch:
|
---|
[82604] | 712 |
|
---|
[82606] | 713 | ${LogVerbose} "File $\"$0$\" found"
|
---|
| 714 |
|
---|
| 715 | Push $0
|
---|
| 716 | Call ${un}GetFileArchitecture
|
---|
| 717 | Pop $3
|
---|
| 718 |
|
---|
| 719 | ${LogVerbose} "Architecture is: $3"
|
---|
| 720 |
|
---|
| 721 | ${If} $3 == $2
|
---|
| 722 | Goto check_vendor
|
---|
| 723 | ${EndIf}
|
---|
| 724 | Goto invalid
|
---|
| 725 |
|
---|
[39549] | 726 | check_vendor:
|
---|
| 727 |
|
---|
| 728 | Push $0
|
---|
| 729 | Call ${un}GetFileVendor
|
---|
| 730 | Pop $3
|
---|
[39558] | 731 |
|
---|
[82606] | 732 | ${LogVerbose} "Vendor is: $3"
|
---|
[82604] | 733 |
|
---|
[39549] | 734 | ${If} $3 == $1
|
---|
[82606] | 735 | Goto valid
|
---|
[39549] | 736 | ${EndIf}
|
---|
[82606] | 737 |
|
---|
| 738 | invalid:
|
---|
| 739 |
|
---|
| 740 | ${LogVerbose} "File $\"$0$\" is invalid"
|
---|
| 741 |
|
---|
[39549] | 742 | StrCpy $3 "1" ; Invalid
|
---|
| 743 | Goto end
|
---|
| 744 |
|
---|
[82606] | 745 | valid:
|
---|
[39549] | 746 |
|
---|
[82606] | 747 | ${LogVerbose} "File $\"$0$\" is valid"
|
---|
[39558] | 748 |
|
---|
[82606] | 749 | StrCpy $3 "0" ; Valid
|
---|
[39549] | 750 | Goto end
|
---|
| 751 |
|
---|
| 752 | not_found:
|
---|
| 753 |
|
---|
[82606] | 754 | ${LogVerbose} "File $\"$0$\" was not found"
|
---|
| 755 |
|
---|
[39549] | 756 | StrCpy $3 "2" ; Not found
|
---|
| 757 | Goto end
|
---|
| 758 |
|
---|
| 759 | end:
|
---|
[39558] | 760 |
|
---|
[39549] | 761 | ; S: old$3 old$2 old$1 old$0
|
---|
| 762 | Exch $3 ; S: $3 old$2 old$1 old$0
|
---|
| 763 | Exch ; S: old$2 $3 old$1
|
---|
| 764 | Pop $2 ; S: $3 old$1 old$0
|
---|
| 765 | Exch ; S: old$1 $3 old$0
|
---|
| 766 | Pop $1 ; S: $3 old$0
|
---|
| 767 | Exch ; S: old$0 $3
|
---|
| 768 | Pop $0 ; S: $3
|
---|
| 769 |
|
---|
| 770 | FunctionEnd
|
---|
| 771 | !macroend
|
---|
| 772 | !insertmacro VerifyFile ""
|
---|
| 773 | !insertmacro VerifyFile "un."
|
---|
| 774 |
|
---|
[39558] | 775 | ;
|
---|
| 776 | ; Macro for accessing VerifyFile in a more convenient way by using
|
---|
| 777 | ; a parameter list.
|
---|
| 778 | ; @return Stack: "0" if valid, "1" if not, "2" on error / not found.
|
---|
| 779 | ; @param Un/Installer prefix; either "" or "un".
|
---|
| 780 | ; @param Name of file to verify.
|
---|
| 781 | ; @param Vendor to check for.
|
---|
| 782 | ; @param Architecture ("x86" or "amd64") to check for.
|
---|
| 783 | ;
|
---|
[39549] | 784 | !macro VerifyFileEx un File Vendor Architecture
|
---|
[40738] | 785 | Push $0
|
---|
[39549] | 786 | Push "${Architecture}"
|
---|
| 787 | Push "${Vendor}"
|
---|
| 788 | Push "${File}"
|
---|
| 789 | Call ${un}VerifyFile
|
---|
[40738] | 790 | Pop $0
|
---|
| 791 | ${If} $0 == "0"
|
---|
[44352] | 792 | ${LogVerbose} "Verification of file $\"${File}$\" successful (Vendor: ${Vendor}, Architecture: ${Architecture})"
|
---|
[40738] | 793 | ${ElseIf} $0 == "1"
|
---|
[44352] | 794 | ${LogVerbose} "Verification of file $\"${File}$\" failed (not Vendor: ${Vendor}, and/or not Architecture: ${Architecture})"
|
---|
[40738] | 795 | ${Else}
|
---|
[44352] | 796 | ${LogVerbose} "Skipping to file $\"${File}$\"; not found"
|
---|
[40738] | 797 | ${EndIf}
|
---|
| 798 | ; Push result popped off the stack to stack again
|
---|
| 799 | Push $0
|
---|
[39549] | 800 | !macroend
|
---|
| 801 | !define VerifyFileEx "!insertmacro VerifyFileEx"
|
---|
| 802 |
|
---|
| 803 | ;
|
---|
[44484] | 804 | ; Macro for copying a file only if the source file is verified
|
---|
[40711] | 805 | ; to be from a certain vendor and architecture.
|
---|
| 806 | ; @return Stack: "0" if copied, "1" if not, "2" on error / not found.
|
---|
| 807 | ; @param Un/Installer prefix; either "" or "un".
|
---|
| 808 | ; @param Name of file to verify and copy to destination.
|
---|
| 809 | ; @param Destination name to copy verified file to.
|
---|
| 810 | ; @param Vendor to check for.
|
---|
| 811 | ; @param Architecture ("x86" or "amd64") to check for.
|
---|
| 812 | ;
|
---|
| 813 | !macro CopyFileEx un FileSrc FileDest Vendor Architecture
|
---|
| 814 | Push $0
|
---|
| 815 | Push "${Architecture}"
|
---|
| 816 | Push "${Vendor}"
|
---|
[44484] | 817 | Push "${FileSrc}"
|
---|
[40711] | 818 | Call ${un}VerifyFile
|
---|
| 819 | Pop $0
|
---|
[85006] | 820 |
|
---|
| 821 | Push "${Architecture}"
|
---|
| 822 | Push "Oracle Corporation"
|
---|
| 823 | Push "${FileDest}"
|
---|
| 824 | Call ${un}VerifyFile
|
---|
| 825 | Pop $0
|
---|
| 826 |
|
---|
[40711] | 827 | ${If} $0 == "0"
|
---|
[44352] | 828 | ${LogVerbose} "Copying verified file $\"${FileSrc}$\" to $\"${FileDest}$\" ..."
|
---|
[50433] | 829 | ClearErrors
|
---|
| 830 | SetOverwrite on
|
---|
[40711] | 831 | CopyFiles /SILENT "${FileSrc}" "${FileDest}"
|
---|
[50433] | 832 | ${If} ${Errors}
|
---|
| 833 | CreateDirectory "$TEMP\${PRODUCT_NAME}"
|
---|
| 834 | ${GetFileName} "${FileSrc}" $0 ; Get the base name
|
---|
| 835 | CopyFiles /SILENT "${FileSrc}" "$TEMP\${PRODUCT_NAME}\$0"
|
---|
| 836 | ${LogVerbose} "Immediate installation failed, postponing to next reboot (temporary location is: $\"$TEMP\${PRODUCT_NAME}\$0$\") ..."
|
---|
| 837 | ;${InstallFileEx} "${un}" "${FileSrc}" "${FileDest}" "$TEMP" ; Only works with compile time files!
|
---|
| 838 | System::Call "kernel32::MoveFileEx(t '$TEMP\${PRODUCT_NAME}\$0', t '${FileDest}', i 5)"
|
---|
| 839 | ${EndIf}
|
---|
[40711] | 840 | ${Else}
|
---|
[44352] | 841 | ${LogVerbose} "Skipping to copy file $\"${FileSrc}$\" to $\"${FileDest}$\" (not Vendor: ${Vendor}, Architecture: ${Architecture})"
|
---|
[40711] | 842 | ${EndIf}
|
---|
[40738] | 843 | ; Push result popped off the stack to stack again
|
---|
[40711] | 844 | Push $0
|
---|
| 845 | !macroend
|
---|
| 846 | !define CopyFileEx "!insertmacro CopyFileEx"
|
---|
| 847 |
|
---|
| 848 | ;
|
---|
| 849 | ; Macro for installing a library/DLL.
|
---|
| 850 | ; @return Stack: "0" if copied, "1" if not, "2" on error / not found.
|
---|
| 851 | ; @param Un/Installer prefix; either "" or "un".
|
---|
[50421] | 852 | ; @param Name of lib/DLL to copy to destination.
|
---|
| 853 | ; @param Destination name to copy the source file to.
|
---|
[40711] | 854 | ; @param Temporary folder used for exchanging the (locked) lib/DLL after a reboot.
|
---|
| 855 | ;
|
---|
| 856 | !macro InstallFileEx un FileSrc FileDest DirTemp
|
---|
[44352] | 857 | ${LogVerbose} "Installing library $\"${FileSrc}$\" to $\"${FileDest}$\" ..."
|
---|
[40711] | 858 | ; Try the gentle way and replace the file instantly
|
---|
| 859 | !insertmacro InstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED "${FileSrc}" "${FileDest}" "${DirTemp}"
|
---|
| 860 | ; If the above call didn't help, use a (later) reboot to replace the file
|
---|
| 861 | !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "${FileSrc}" "${FileDest}" "${DirTemp}"
|
---|
| 862 | !macroend
|
---|
| 863 | !define InstallFileEx "!insertmacro InstallFileEx"
|
---|
| 864 |
|
---|
| 865 | ;
|
---|
| 866 | ; Macro for installing a library/DLL.
|
---|
| 867 | ; @return Stack: "0" if copied, "1" if not, "2" on error / not found.
|
---|
| 868 | ; @param Un/Installer prefix; either "" or "un".
|
---|
| 869 | ; @param Name of lib/DLL to verify and copy to destination.
|
---|
| 870 | ; @param Destination name to copy verified file to.
|
---|
| 871 | ; @param Temporary folder used for exchanging the (locked) lib/DLL after a reboot.
|
---|
| 872 | ; @param Vendor to check for.
|
---|
| 873 | ; @param Architecture ("x86" or "amd64") to check for.
|
---|
| 874 | ;
|
---|
| 875 | !macro InstallFileVerify un FileSrc FileDest DirTemp Vendor Architecture
|
---|
| 876 | Push $0
|
---|
| 877 | Push "${Architecture}"
|
---|
| 878 | Push "${Vendor}"
|
---|
| 879 | Push "${FileSrc}"
|
---|
[44352] | 880 | ${LogVerbose} "Verifying library $\"${FileSrc}$\" ..."
|
---|
[40711] | 881 | Call ${un}VerifyFile
|
---|
| 882 | Pop $0
|
---|
| 883 | ${If} $0 == "0"
|
---|
| 884 | ${InstallFileEx} ${un} ${FileSrc} ${FileDest} ${DirTemp}
|
---|
| 885 | ${Else}
|
---|
[44352] | 886 | ${LogVerbose} "File $\"${FileSrc}$\" did not pass verification (Vendor: ${Vendor}, Architecture: ${Architecture})"
|
---|
[40711] | 887 | ${EndIf}
|
---|
| 888 | ; Push result popped off the stack to stack again.
|
---|
| 889 | Push $0
|
---|
| 890 | !macroend
|
---|
| 891 | !define InstallFileVerify "!insertmacro InstallFileVerify"
|
---|
| 892 |
|
---|
[50423] | 893 |
|
---|
[82587] | 894 | ; Note: We don't ship modified Direct3D files anymore, but we need to (try to)
|
---|
| 895 | ; restore the original (backed up) DLLs when upgrading from an old(er)
|
---|
| 896 | ; installation.
|
---|
[50423] | 897 | ;
|
---|
[50401] | 898 | ; Restores formerly backed up Direct3D original files, which were replaced by
|
---|
| 899 | ; a VBox XPDM driver installation before. This might be necessary for upgrading a
|
---|
| 900 | ; XPDM installation to a WDDM one.
|
---|
| 901 | ; @return Stack: "0" if files were restored successfully; otherwise "1".
|
---|
| 902 | ;
|
---|
| 903 | !macro RestoreFilesDirect3D un
|
---|
| 904 | Function ${un}RestoreFilesDirect3D
|
---|
[84433] | 905 | ${If} $g_bCapXPDM != "true"
|
---|
| 906 | ${LogVerbose} "RestoreFilesDirect3D: XPDM is not supported"
|
---|
| 907 | Return
|
---|
| 908 | ${EndIf}
|
---|
[50401] | 909 |
|
---|
| 910 | Push $0
|
---|
| 911 |
|
---|
| 912 | ; We need to switch to 64-bit app mode to handle the "real" 64-bit files in
|
---|
[50414] | 913 | ; "system32" on a 64-bit guest
|
---|
[50401] | 914 | Call ${un}SetAppMode64
|
---|
| 915 |
|
---|
[50421] | 916 | ${LogVerbose} "Restoring original D3D files ..."
|
---|
[84945] | 917 | ${CopyFileEx} "${un}" "$SYSDIR\msd3d8.dll" "$SYSDIR\d3d8.dll" "Microsoft Corporation" "$%KBUILD_TARGET_ARCH%"
|
---|
| 918 | ${CopyFileEx} "${un}" "$SYSDIR\msd3d9.dll" "$SYSDIR\d3d9.dll" "Microsoft Corporation" "$%KBUILD_TARGET_ARCH%"
|
---|
[50401] | 919 |
|
---|
| 920 | ${If} $g_bCapDllCache == "true"
|
---|
[84945] | 921 | ${CopyFileEx} "${un}" "$SYSDIR\dllcache\msd3d8.dll" "$SYSDIR\dllcache\d3d8.dll" "Microsoft Corporation" "$%KBUILD_TARGET_ARCH%"
|
---|
| 922 | ${CopyFileEx} "${un}" "$SYSDIR\dllcache\msd3d9.dll" "$SYSDIR\dllcache\d3d9.dll" "Microsoft Corporation" "$%KBUILD_TARGET_ARCH%"
|
---|
[50401] | 923 | ${EndIf}
|
---|
| 924 |
|
---|
[84945] | 925 | !if $%KBUILD_TARGET_ARCH% == "amd64"
|
---|
[50414] | 926 | ${CopyFileEx} "${un}" "$g_strSysWow64\msd3d8.dll" "$g_strSysWow64\d3d8.dll" "Microsoft Corporation" "x86"
|
---|
| 927 | ${CopyFileEx} "${un}" "$g_strSysWow64\msd3d9.dll" "$g_strSysWow64\d3d9.dll" "Microsoft Corporation" "x86"
|
---|
[50401] | 928 |
|
---|
| 929 | ${If} $g_bCapDllCache == "true"
|
---|
[50414] | 930 | ${CopyFileEx} "${un}" "$g_strSysWow64\dllcache\msd3d8.dll" "$g_strSysWow64\dllcache\d3d8.dll" "Microsoft Corporation" "x86"
|
---|
| 931 | ${CopyFileEx} "${un}" "$g_strSysWow64\dllcache\msd3d9.dll" "$g_strSysWow64\dllcache\d3d9.dll" "Microsoft Corporation" "x86"
|
---|
[50401] | 932 | ${EndIf}
|
---|
| 933 | !endif
|
---|
| 934 |
|
---|
| 935 | Pop $0
|
---|
| 936 |
|
---|
| 937 | FunctionEnd
|
---|
| 938 | !macroend
|
---|
| 939 | !insertmacro RestoreFilesDirect3D ""
|
---|
| 940 | !insertmacro RestoreFilesDirect3D "un."
|
---|