2N/A;* Copyright (C) 2011 Oracle Corporation
2N/A;* This file is part of VirtualBox Open Source Edition (OSE), as
2N/A;* you can redistribute it
and/or modify it under the terms of the GNU
2N/A;* General Public License (GPL) as published by the Free Software
2N/A;* Foundation, in version 2 as it comes in the "COPYING" file of the
2N/A;* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
2N/A;* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
2N/A!macro UninstallCommon un
2N/AFunction ${un}UninstallCommon
2N/A Delete /REBOOTOK "$INSTDIR\${PRODUCT_NAME}.url"
2N/A ; Remove common files
2N/A!ifdef VBOX_SIGN_ADDITIONS
2N/A!if $%VBOX_WITH_LICENSE_INSTALL_RTF% == "1"
2N/A Delete /REBOOTOK "$INSTDIR\${LICENSE_FILE_RTF}"
2N/A ; Delete registry keys
2N/A DeleteRegKey /ifempty HKLM "${PRODUCT_INSTALL_KEY}"
2N/A DeleteRegKey /ifempty HKLM "${VENDOR_ROOT_KEY}"
2N/A ; Delete desktop & start menu entries
2N/A RMDIR "$SMPROGRAMS\${PRODUCT_NAME} Guest Additions"
2N/A ; Delete Guest Additions directory (only if completely empty)
2N/A RMDir /REBOOTOK "$INSTDIR"
2N/A ; Delete vendor installation directory (only if completely empty)
2N/A!if $%BUILD_TARGET_ARCH% == "x86" ; 32-bit
2N/A RMDir /REBOOTOK "$PROGRAMFILES32\$%VBOX_VENDOR_SHORT%"
2N/A RMDir /REBOOTOK "$PROGRAMFILES64\$%VBOX_VENDOR_SHORT%"
2N/A ; Remove registry entries
2N/A DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
2N/A!insertmacro UninstallCommon ""
2N/A!insertmacro UninstallCommon "un."
2N/AFunction ${un}Uninstall
2N/A DetailPrint "Uninstalling system files ..."
2N/A DetailPrint "Detected OS version: Windows $g_strWinVersion"
2N/A DetailPrint "System Directory: $g_strSystemDir"
!if $%BUILD_TARGET_ARCH% == "x86" ; 32-bit
StrCmp $g_strWinVersion "NT4" nt4 ; Windows NT 4.0
StrCmp $g_strWinVersion "2000" w2k ; Windows 2000
StrCmp $g_strWinVersion "XP" w2k ; Windows XP
StrCmp $g_strWinVersion "2003" w2k ; Windows 2003 Server
StrCmp $g_strWinVersion "Vista" vista ; Windows Vista
StrCmp $g_strWinVersion "7" vista ; Windows 7
${If} $g_bForceInstall == "true"
Goto vista ; Assume newer OS than we know of ...
!if $%BUILD_TARGET_ARCH% == "x86" ; 32-bit
Call ${un}Vista_Uninstall
MessageBox MB_ICONSTOP $(VBOX_PLATFORM_UNSUPPORTED) /SD IDOK
!insertmacro Uninstall ""
!insertmacro Uninstall "un."
!macro UninstallInstDir un
Function ${un}UninstallInstDir
DetailPrint "Uninstalling directory ..."
DetailPrint "Detected OS version: Windows $g_strWinVersion"
DetailPrint "System Directory: $g_strSystemDir"
!if $%BUILD_TARGET_ARCH% == "x86" ; 32-bit
StrCmp $g_strWinVersion "NT4" nt4 ; Windows NT 4.0
StrCmp $g_strWinVersion "2000" w2k ; Windows 2000
StrCmp $g_strWinVersion "XP" w2k ; Windows XP
StrCmp $g_strWinVersion "2003" w2k ; Windows 2003 Server
StrCmp $g_strWinVersion "Vista" vista ; Windows Vista
StrCmp $g_strWinVersion "7" vista ; Windows 7
${If} $g_bForceInstall == "true"
Goto vista ; Assume newer OS than we know of ...
!if $%BUILD_TARGET_ARCH% == "x86" ; 32-bit
Call ${un}NT4_UninstallInstDir
Call ${un}W2K_UninstallInstDir
Call ${un}W2K_UninstallInstDir
Call ${un}Vista_UninstallInstDir
MessageBox MB_ICONSTOP $(VBOX_PLATFORM_UNSUPPORTED) /SD IDOK
Call ${un}UninstallCommon
!insertmacro UninstallInstDir ""
!insertmacro UninstallInstDir "un."