[43129] | 1 | ; $Id: VBoxGuestAdditionsUninstall.nsh 96775 2022-09-16 23:39:31Z vboxsync $
|
---|
[69354] | 2 | ;; @file
|
---|
[43129] | 3 | ; VBoxGuestAdditionsUninstall.nsh - Guest Additions uninstallation.
|
---|
| 4 | ;
|
---|
| 5 |
|
---|
| 6 | ;
|
---|
[96407] | 7 | ; Copyright (C) 2006-2022 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
|
---|
| 55 | Delete "$DESKTOP\${PRODUCT_NAME} Guest Additions.lnk"
|
---|
| 56 | Delete "$SMPROGRAMS\${PRODUCT_NAME} Guest Additions\Uninstall.lnk"
|
---|
| 57 | Delete "$SMPROGRAMS\${PRODUCT_NAME} Guest Additions\Website.lnk"
|
---|
| 58 | RMDIR "$SMPROGRAMS\${PRODUCT_NAME} Guest Additions"
|
---|
| 59 |
|
---|
| 60 | ; Delete Guest Additions directory (only if completely empty)
|
---|
| 61 | RMDir /REBOOTOK "$INSTDIR"
|
---|
| 62 |
|
---|
| 63 | ; Delete vendor installation directory (only if completely empty)
|
---|
[84945] | 64 | !if $%KBUILD_TARGET_ARCH% == "x86" ; 32-bit
|
---|
[43129] | 65 | RMDir /REBOOTOK "$PROGRAMFILES32\$%VBOX_VENDOR_SHORT%"
|
---|
| 66 | !else ; 64-bit
|
---|
| 67 | RMDir /REBOOTOK "$PROGRAMFILES64\$%VBOX_VENDOR_SHORT%"
|
---|
| 68 | !endif
|
---|
| 69 |
|
---|
| 70 | ; Remove registry entries
|
---|
| 71 | DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
|
---|
| 72 |
|
---|
| 73 | FunctionEnd
|
---|
| 74 | !macroend
|
---|
[96693] | 75 | ;!insertmacro UninstallCommon "" - only .un version used
|
---|
[43129] | 76 | !insertmacro UninstallCommon "un."
|
---|
| 77 |
|
---|
| 78 | !macro Uninstall un
|
---|
| 79 | Function ${un}Uninstall
|
---|
| 80 |
|
---|
[44417] | 81 | ${LogVerbose} "Uninstalling system files ..."
|
---|
[43129] | 82 | !ifdef _DEBUG
|
---|
[44417] | 83 | ${LogVerbose} "Detected OS version: Windows $g_strWinVersion"
|
---|
| 84 | ${LogVerbose} "System Directory: $g_strSystemDir"
|
---|
[43129] | 85 | !endif
|
---|
| 86 |
|
---|
| 87 | ; Which OS are we using?
|
---|
[84945] | 88 | !if $%KBUILD_TARGET_ARCH% == "x86" ; 32-bit
|
---|
[43129] | 89 | StrCmp $g_strWinVersion "NT4" nt4 ; Windows NT 4.0
|
---|
| 90 | !endif
|
---|
| 91 | StrCmp $g_strWinVersion "2000" w2k ; Windows 2000
|
---|
| 92 | StrCmp $g_strWinVersion "XP" w2k ; Windows XP
|
---|
| 93 | StrCmp $g_strWinVersion "2003" w2k ; Windows 2003 Server
|
---|
| 94 | StrCmp $g_strWinVersion "Vista" vista ; Windows Vista
|
---|
| 95 | StrCmp $g_strWinVersion "7" vista ; Windows 7
|
---|
| 96 | StrCmp $g_strWinVersion "8" vista ; Windows 8
|
---|
[46845] | 97 | StrCmp $g_strWinVersion "8_1" vista ; Windows 8.1 / Windows Server 2012 R2
|
---|
[53008] | 98 | StrCmp $g_strWinVersion "10" vista ; Windows 10
|
---|
[43129] | 99 |
|
---|
| 100 | ${If} $g_bForceInstall == "true"
|
---|
| 101 | Goto vista ; Assume newer OS than we know of ...
|
---|
| 102 | ${EndIf}
|
---|
| 103 |
|
---|
| 104 | Goto notsupported
|
---|
| 105 |
|
---|
[84945] | 106 | !if $%KBUILD_TARGET_ARCH% == "x86" ; 32-bit
|
---|
[43129] | 107 | nt4:
|
---|
| 108 |
|
---|
| 109 | Call ${un}NT4_Uninstall
|
---|
| 110 | goto common
|
---|
| 111 | !endif
|
---|
| 112 |
|
---|
| 113 | w2k:
|
---|
| 114 |
|
---|
| 115 | Call ${un}W2K_Uninstall
|
---|
| 116 | goto common
|
---|
| 117 |
|
---|
| 118 | vista:
|
---|
| 119 |
|
---|
| 120 | Call ${un}W2K_Uninstall
|
---|
| 121 | Call ${un}Vista_Uninstall
|
---|
| 122 | goto common
|
---|
| 123 |
|
---|
| 124 | notsupported:
|
---|
| 125 |
|
---|
| 126 | MessageBox MB_ICONSTOP $(VBOX_PLATFORM_UNSUPPORTED) /SD IDOK
|
---|
| 127 | Goto exit
|
---|
| 128 |
|
---|
| 129 | common:
|
---|
| 130 |
|
---|
| 131 | exit:
|
---|
| 132 |
|
---|
| 133 | FunctionEnd
|
---|
| 134 | !macroend
|
---|
[96694] | 135 | !ifndef UNINSTALLER_ONLY
|
---|
| 136 | !insertmacro Uninstall ""
|
---|
| 137 | !endif
|
---|
[43129] | 138 | !insertmacro Uninstall "un."
|
---|
| 139 |
|
---|
[96775] | 140 | ;;
|
---|
| 141 | ; The last step of the uninstallation where we remove all files from the
|
---|
| 142 | ; install directory and such.
|
---|
| 143 | ;
|
---|
[43129] | 144 | !macro UninstallInstDir un
|
---|
| 145 | Function ${un}UninstallInstDir
|
---|
| 146 |
|
---|
[44417] | 147 | ${LogVerbose} "Uninstalling directory ..."
|
---|
[43129] | 148 | !ifdef _DEBUG
|
---|
[44417] | 149 | ${LogVerbose} "Detected OS version: Windows $g_strWinVersion"
|
---|
| 150 | ${LogVerbose} "System Directory: $g_strSystemDir"
|
---|
[43129] | 151 | !endif
|
---|
| 152 |
|
---|
| 153 | ; Which OS are we using?
|
---|
[84945] | 154 | !if $%KBUILD_TARGET_ARCH% == "x86" ; 32-bit
|
---|
[43129] | 155 | StrCmp $g_strWinVersion "NT4" nt4 ; Windows NT 4.0
|
---|
| 156 | !endif
|
---|
| 157 | StrCmp $g_strWinVersion "2000" w2k ; Windows 2000
|
---|
| 158 | StrCmp $g_strWinVersion "XP" w2k ; Windows XP
|
---|
| 159 | StrCmp $g_strWinVersion "2003" w2k ; Windows 2003 Server
|
---|
| 160 | StrCmp $g_strWinVersion "Vista" vista ; Windows Vista
|
---|
| 161 | StrCmp $g_strWinVersion "7" vista ; Windows 7
|
---|
| 162 | StrCmp $g_strWinVersion "8" vista ; Windows 8
|
---|
[46845] | 163 | StrCmp $g_strWinVersion "8_1" vista ; Windows 8.1 / Windows Server 2012 R2
|
---|
[53008] | 164 | StrCmp $g_strWinVersion "10" vista ; Windows 10
|
---|
[43129] | 165 |
|
---|
| 166 | ${If} $g_bForceInstall == "true"
|
---|
| 167 | Goto vista ; Assume newer OS than we know of ...
|
---|
| 168 | ${EndIf}
|
---|
| 169 |
|
---|
[96775] | 170 | MessageBox MB_ICONSTOP $(VBOX_PLATFORM_UNSUPPORTED) /SD IDOK
|
---|
| 171 | Goto exit
|
---|
[43129] | 172 |
|
---|
[84945] | 173 | !if $%KBUILD_TARGET_ARCH% == "x86" ; 32-bit
|
---|
[43129] | 174 | nt4:
|
---|
| 175 |
|
---|
| 176 | Call ${un}NT4_UninstallInstDir
|
---|
| 177 | goto common
|
---|
| 178 | !endif
|
---|
| 179 |
|
---|
| 180 | w2k:
|
---|
| 181 |
|
---|
| 182 | Call ${un}W2K_UninstallInstDir
|
---|
| 183 | goto common
|
---|
| 184 |
|
---|
| 185 | vista:
|
---|
| 186 |
|
---|
| 187 | Call ${un}W2K_UninstallInstDir
|
---|
| 188 | Call ${un}Vista_UninstallInstDir
|
---|
| 189 | goto common
|
---|
| 190 |
|
---|
[96775] | 191 | common:
|
---|
[43129] | 192 |
|
---|
[96775] | 193 | Call ${un}Common_CleanupObsoleteFiles
|
---|
[43129] | 194 |
|
---|
[96775] | 195 | ; This will attempt remove the install dir, so must be last.
|
---|
[43129] | 196 | Call ${un}UninstallCommon
|
---|
| 197 |
|
---|
| 198 | exit:
|
---|
| 199 |
|
---|
| 200 | FunctionEnd
|
---|
| 201 | !macroend
|
---|
[96693] | 202 | ;!insertmacro UninstallInstDir "" - only un. version is used.
|
---|
[43129] | 203 | !insertmacro UninstallInstDir "un."
|
---|