[43129] | 1 | ; $Id: VBoxGuestAdditionsUninstall.nsh 98103 2023-01-17 14:15:46Z vboxsync $
|
---|
[69354] | 2 | ;; @file
|
---|
[43129] | 3 | ; VBoxGuestAdditionsUninstall.nsh - Guest Additions uninstallation.
|
---|
| 4 | ;
|
---|
| 5 |
|
---|
| 6 | ;
|
---|
[98103] | 7 | ; Copyright (C) 2006-2023 Oracle and/or its affiliates.
|
---|
[43129] | 8 | ;
|
---|
[96407] | 9 | ; This file is part of VirtualBox base platform packages, as
|
---|
| 10 | ; available from https://www.virtualbox.org.
|
---|
[43129] | 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 | ;
|
---|
[43129] | 27 |
|
---|
| 28 | !macro UninstallCommon un
|
---|
| 29 | Function ${un}UninstallCommon
|
---|
| 30 |
|
---|
| 31 | Delete /REBOOTOK "$INSTDIR\install*.log"
|
---|
| 32 | Delete /REBOOTOK "$INSTDIR\uninst.exe"
|
---|
| 33 | Delete /REBOOTOK "$INSTDIR\${PRODUCT_NAME}.url"
|
---|
| 34 |
|
---|
| 35 | ; Remove common files
|
---|
| 36 | Delete /REBOOTOK "$INSTDIR\VBoxDrvInst.exe"
|
---|
| 37 | Delete /REBOOTOK "$INSTDIR\DIFxAPI.dll"
|
---|
| 38 |
|
---|
| 39 | Delete /REBOOTOK "$INSTDIR\VBoxVideo.inf"
|
---|
| 40 | !ifdef VBOX_SIGN_ADDITIONS
|
---|
| 41 | Delete /REBOOTOK "$INSTDIR\VBoxVideo.cat"
|
---|
| 42 | !endif
|
---|
| 43 |
|
---|
| 44 | !if $%VBOX_WITH_LICENSE_INSTALL_RTF% == "1"
|
---|
| 45 | Delete /REBOOTOK "$INSTDIR\${LICENSE_FILE_RTF}"
|
---|
| 46 | !endif
|
---|
| 47 |
|
---|
| 48 | Delete /REBOOTOK "$INSTDIR\VBoxGINA.dll"
|
---|
| 49 |
|
---|
| 50 | ; Delete registry keys
|
---|
| 51 | DeleteRegKey /ifempty HKLM "${PRODUCT_INSTALL_KEY}"
|
---|
| 52 | DeleteRegKey /ifempty HKLM "${VENDOR_ROOT_KEY}"
|
---|
| 53 |
|
---|
| 54 | ; Delete desktop & start menu entries
|
---|
[96776] | 55 | Delete "$DESKTOP\${PRODUCT_NAME}.lnk" ; Obsolete. We don't install a desktop link any more.
|
---|
| 56 | Delete "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk"
|
---|
| 57 | Delete "$SMPROGRAMS\${PRODUCT_NAME}\Website.url"
|
---|
| 58 | Delete "$SMPROGRAMS\${PRODUCT_NAME}\Website.lnk" ; Old name. Changed to Website.url in r153663.
|
---|
| 59 | RMDir "$SMPROGRAMS\${PRODUCT_NAME}"
|
---|
[43129] | 60 |
|
---|
| 61 | ; Delete Guest Additions directory (only if completely empty)
|
---|
| 62 | RMDir /REBOOTOK "$INSTDIR"
|
---|
| 63 |
|
---|
| 64 | ; Delete vendor installation directory (only if completely empty)
|
---|
[84945] | 65 | !if $%KBUILD_TARGET_ARCH% == "x86" ; 32-bit
|
---|
[43129] | 66 | RMDir /REBOOTOK "$PROGRAMFILES32\$%VBOX_VENDOR_SHORT%"
|
---|
| 67 | !else ; 64-bit
|
---|
| 68 | RMDir /REBOOTOK "$PROGRAMFILES64\$%VBOX_VENDOR_SHORT%"
|
---|
| 69 | !endif
|
---|
| 70 |
|
---|
| 71 | ; Remove registry entries
|
---|
| 72 | DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
|
---|
| 73 |
|
---|
| 74 | FunctionEnd
|
---|
| 75 | !macroend
|
---|
[96693] | 76 | ;!insertmacro UninstallCommon "" - only .un version used
|
---|
[43129] | 77 | !insertmacro UninstallCommon "un."
|
---|
| 78 |
|
---|
| 79 | !macro Uninstall un
|
---|
| 80 | Function ${un}Uninstall
|
---|
| 81 |
|
---|
[44417] | 82 | ${LogVerbose} "Uninstalling system files ..."
|
---|
[43129] | 83 | !ifdef _DEBUG
|
---|
[44417] | 84 | ${LogVerbose} "Detected OS version: Windows $g_strWinVersion"
|
---|
| 85 | ${LogVerbose} "System Directory: $g_strSystemDir"
|
---|
[43129] | 86 | !endif
|
---|
| 87 |
|
---|
| 88 | ; Which OS are we using?
|
---|
[84945] | 89 | !if $%KBUILD_TARGET_ARCH% == "x86" ; 32-bit
|
---|
[43129] | 90 | StrCmp $g_strWinVersion "NT4" nt4 ; Windows NT 4.0
|
---|
| 91 | !endif
|
---|
| 92 | StrCmp $g_strWinVersion "2000" w2k ; Windows 2000
|
---|
| 93 | StrCmp $g_strWinVersion "XP" w2k ; Windows XP
|
---|
| 94 | StrCmp $g_strWinVersion "2003" w2k ; Windows 2003 Server
|
---|
| 95 | StrCmp $g_strWinVersion "Vista" vista ; Windows Vista
|
---|
| 96 | StrCmp $g_strWinVersion "7" vista ; Windows 7
|
---|
| 97 | StrCmp $g_strWinVersion "8" vista ; Windows 8
|
---|
[46845] | 98 | StrCmp $g_strWinVersion "8_1" vista ; Windows 8.1 / Windows Server 2012 R2
|
---|
[53008] | 99 | StrCmp $g_strWinVersion "10" vista ; Windows 10
|
---|
[43129] | 100 |
|
---|
| 101 | ${If} $g_bForceInstall == "true"
|
---|
| 102 | Goto vista ; Assume newer OS than we know of ...
|
---|
| 103 | ${EndIf}
|
---|
| 104 |
|
---|
| 105 | Goto notsupported
|
---|
| 106 |
|
---|
[84945] | 107 | !if $%KBUILD_TARGET_ARCH% == "x86" ; 32-bit
|
---|
[43129] | 108 | nt4:
|
---|
| 109 |
|
---|
| 110 | Call ${un}NT4_Uninstall
|
---|
| 111 | goto common
|
---|
| 112 | !endif
|
---|
| 113 |
|
---|
| 114 | w2k:
|
---|
| 115 |
|
---|
| 116 | Call ${un}W2K_Uninstall
|
---|
| 117 | goto common
|
---|
| 118 |
|
---|
| 119 | vista:
|
---|
| 120 |
|
---|
| 121 | Call ${un}W2K_Uninstall
|
---|
| 122 | Call ${un}Vista_Uninstall
|
---|
| 123 | goto common
|
---|
| 124 |
|
---|
| 125 | notsupported:
|
---|
| 126 |
|
---|
| 127 | MessageBox MB_ICONSTOP $(VBOX_PLATFORM_UNSUPPORTED) /SD IDOK
|
---|
| 128 | Goto exit
|
---|
| 129 |
|
---|
| 130 | common:
|
---|
| 131 |
|
---|
| 132 | exit:
|
---|
| 133 |
|
---|
| 134 | FunctionEnd
|
---|
| 135 | !macroend
|
---|
[96694] | 136 | !ifndef UNINSTALLER_ONLY
|
---|
| 137 | !insertmacro Uninstall ""
|
---|
| 138 | !endif
|
---|
[43129] | 139 | !insertmacro Uninstall "un."
|
---|
| 140 |
|
---|
[96775] | 141 | ;;
|
---|
| 142 | ; The last step of the uninstallation where we remove all files from the
|
---|
| 143 | ; install directory and such.
|
---|
| 144 | ;
|
---|
[43129] | 145 | !macro UninstallInstDir un
|
---|
| 146 | Function ${un}UninstallInstDir
|
---|
| 147 |
|
---|
[44417] | 148 | ${LogVerbose} "Uninstalling directory ..."
|
---|
[43129] | 149 | !ifdef _DEBUG
|
---|
[44417] | 150 | ${LogVerbose} "Detected OS version: Windows $g_strWinVersion"
|
---|
| 151 | ${LogVerbose} "System Directory: $g_strSystemDir"
|
---|
[43129] | 152 | !endif
|
---|
| 153 |
|
---|
| 154 | ; Which OS are we using?
|
---|
[84945] | 155 | !if $%KBUILD_TARGET_ARCH% == "x86" ; 32-bit
|
---|
[43129] | 156 | StrCmp $g_strWinVersion "NT4" nt4 ; Windows NT 4.0
|
---|
| 157 | !endif
|
---|
| 158 | StrCmp $g_strWinVersion "2000" w2k ; Windows 2000
|
---|
| 159 | StrCmp $g_strWinVersion "XP" w2k ; Windows XP
|
---|
| 160 | StrCmp $g_strWinVersion "2003" w2k ; Windows 2003 Server
|
---|
| 161 | StrCmp $g_strWinVersion "Vista" vista ; Windows Vista
|
---|
| 162 | StrCmp $g_strWinVersion "7" vista ; Windows 7
|
---|
| 163 | StrCmp $g_strWinVersion "8" vista ; Windows 8
|
---|
[46845] | 164 | StrCmp $g_strWinVersion "8_1" vista ; Windows 8.1 / Windows Server 2012 R2
|
---|
[53008] | 165 | StrCmp $g_strWinVersion "10" vista ; Windows 10
|
---|
[43129] | 166 |
|
---|
| 167 | ${If} $g_bForceInstall == "true"
|
---|
| 168 | Goto vista ; Assume newer OS than we know of ...
|
---|
| 169 | ${EndIf}
|
---|
| 170 |
|
---|
[96775] | 171 | MessageBox MB_ICONSTOP $(VBOX_PLATFORM_UNSUPPORTED) /SD IDOK
|
---|
| 172 | Goto exit
|
---|
[43129] | 173 |
|
---|
[84945] | 174 | !if $%KBUILD_TARGET_ARCH% == "x86" ; 32-bit
|
---|
[43129] | 175 | nt4:
|
---|
| 176 |
|
---|
| 177 | Call ${un}NT4_UninstallInstDir
|
---|
| 178 | goto common
|
---|
| 179 | !endif
|
---|
| 180 |
|
---|
| 181 | w2k:
|
---|
| 182 |
|
---|
| 183 | Call ${un}W2K_UninstallInstDir
|
---|
| 184 | goto common
|
---|
| 185 |
|
---|
| 186 | vista:
|
---|
| 187 |
|
---|
| 188 | Call ${un}W2K_UninstallInstDir
|
---|
| 189 | Call ${un}Vista_UninstallInstDir
|
---|
| 190 | goto common
|
---|
| 191 |
|
---|
[96775] | 192 | common:
|
---|
[43129] | 193 |
|
---|
[96775] | 194 | Call ${un}Common_CleanupObsoleteFiles
|
---|
[43129] | 195 |
|
---|
[96775] | 196 | ; This will attempt remove the install dir, so must be last.
|
---|
[43129] | 197 | Call ${un}UninstallCommon
|
---|
| 198 |
|
---|
| 199 | exit:
|
---|
| 200 |
|
---|
| 201 | FunctionEnd
|
---|
| 202 | !macroend
|
---|
[96693] | 203 | ;!insertmacro UninstallInstDir "" - only un. version is used.
|
---|
[43129] | 204 | !insertmacro UninstallInstDir "un."
|
---|