Bug 387385 - Remove files from the VirtualStore on uninstall / in-place upgrade / software update. r=sspitzer

This commit is contained in:
rob_strong@exchangecode.com 2007-07-17 11:11:18 -07:00
Родитель dce32c7e6e
Коммит c0ad1616f3
4 изменённых файлов: 98 добавлений и 0 удалений

Просмотреть файл

@ -107,6 +107,7 @@ VIAddVersionKey "FileDescription" "${BrandShortName} Installer"
!insertmacro CreateRegKey
!insertmacro CanWriteToInstallDir
!insertmacro CheckDiskSpace
!insertmacro CleanVirtualStore
!insertmacro AddHandlerValues
!insertmacro GetSingleInstallPath
@ -253,6 +254,10 @@ Section "-Application" Section1
StrCpy $0 "Software\Microsoft\Windows\CurrentVersion\Uninstall\${BrandFullNameInternal} (${AppVersion})"
DeleteRegKey HKLM "$0"
; Remove files that may be left behind by the application in the
; VirtualStore directory.
${CleanVirtualStore}
${If} $InstallType != 1
; Custom installs.
; If DOMi is installed and this install includes DOMi remove it from

Просмотреть файл

@ -54,6 +54,10 @@
${SetUninstallKeys}
${FixClassKeys}
; Remove files that may be left behind by the application in the
; VirtualStore directory.
${CleanVirtualStore}
!macroend
!define PostUpdate "!insertmacro PostUpdate"

Просмотреть файл

@ -83,12 +83,14 @@ Var TmpVal
VIAddVersionKey "FileDescription" "${BrandShortName} Helper"
!insertmacro AddHandlerValues
!insertmacro CleanVirtualStore
!insertmacro RegCleanMain
!insertmacro RegCleanUninstall
!insertmacro WriteRegStr2
!insertmacro WriteRegDWORD2
!insertmacro un.RegCleanMain
!insertmacro un.RegCleanUninstall
!insertmacro un.CleanVirtualStore
!insertmacro un.CloseApp
!insertmacro un.GetSecondInstallPath
@ -252,6 +254,10 @@ Section "Uninstall"
${RemoveDir} "$INSTDIR"
${EndIf}
; Remove files that may be left behind by the application in the
; VirtualStore directory.
${un.CleanVirtualStore}
; Refresh desktop icons otherwise the start menu internet item won't be
; removed and other ugly things will happen like recreation of the registry
; key by the OS under some conditions.

Просмотреть файл

@ -1990,3 +1990,86 @@ Exch $R9 ; exchange the new $R9 value with the top of the stack
!endif
!macroend
/**
* If present removes the VirtualStore directory for this installation. Uses the
* program files directory path and the current install location to determine
* the sub-directory in the VirtualStore directory.
*/
!macro CleanVirtualStore
!ifndef ${_MOZFUNC_UN}CleanVirtualStore
!verbose push
!verbose ${_MOZFUNC_VERBOSE}
!define ${_MOZFUNC_UN}CleanVirtualStore "!insertmacro ${_MOZFUNC_UN}CleanVirtualStoreCall"
Function ${_MOZFUNC_UN}CleanVirtualStore
Push $R9
Push $R8
Push $R7
StrLen $R9 "$INSTDIR"
; Get the installation's directory name including the preceding slash
start:
IntOp $R8 $R8 - 1
IntCmp $R8 -$R9 end end 0
StrCpy $R7 "$INSTDIR" 1 $R8
StrCmp $R7 "\" 0 start
StrCpy $R9 "$INSTDIR" "" $R8
ClearErrors
GetFullPathName $R8 "$PROGRAMFILES$R9"
IfErrors end
GetFullPathName $R7 "$INSTDIR"
; Compare the installation's directory path with the path created by
; concatenating the installation's directory name and the path to the
; program files directory.
StrCmp "$R7" "$R8" 0 end
StrCpy $R8 "$PROGRAMFILES" "" 2 ; Remove the drive letter and colon
StrCpy $R7 "$PROFILE\AppData\Local\VirtualStore$R8$R9"
IfFileExists "$R7" 0 end
RmDir /r "$R7"
end:
ClearErrors
Pop $R7
Pop $R8
Pop $R9
FunctionEnd
!verbose pop
!endif
!macroend
!macro CleanVirtualStoreCall
!verbose push
!verbose ${_MOZFUNC_VERBOSE}
Call CleanVirtualStore
!verbose pop
!macroend
!macro un.CleanVirtualStoreCall
!verbose push
!verbose ${_MOZFUNC_VERBOSE}
Call un.CleanVirtualStore
!verbose pop
!macroend
!macro un.CleanVirtualStore
!ifndef un.CleanVirtualStore
!verbose push
!verbose ${_MOZFUNC_VERBOSE}
!undef _MOZFUNC_UN
!define _MOZFUNC_UN "un."
!insertmacro CleanVirtualStore
!undef _MOZFUNC_UN
!define _MOZFUNC_UN
!verbose pop
!endif
!macroend