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