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!ifdef VBOX_WITH_LICENSE_INSTALL_RTF
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
DetailPrint "Uninstalling system files ..."
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}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}NT_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."