Bug 720521 - MozillaMaintenance service does not get uninstalled when Firefox is uninstalled. r=jimm

This commit is contained in:
Brian R. Bondy 2012-02-06 13:44:31 -05:00
Родитель acd7c82e00
Коммит 8903e11f21
1 изменённых файлов: 45 добавлений и 0 удалений

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

@ -60,6 +60,9 @@ RequestExecutionLevel user
; prevents compiling of the reg write logging.
!define NO_LOG
!define MaintUninstallKey \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\MozillaMaintenanceService"
Var TmpVal
Var MaintCertKey
@ -200,6 +203,47 @@ UninstPage custom un.preConfirm un.leaveConfirm
; Use the default dialog for IDD_VERIFY for a simple Banner
ChangeUI IDD_VERIFY "${NSISDIR}\Contrib\UIs\default.exe"
; This function is used to uninstall the maintenance service if the
; application currently being uninstalled is the last application to use the
; maintenance service.
Function un.UninstallServiceIfNotUsed
; $0 will store if a subkey exists
; $1 will store the first subkey if it exists or an empty string if it doesn't
; Backup the old values
Push $0
Push $1
; The maintenance service always uses the 64-bit registry on x64 systems
SetRegView 64
; Figure out the number of subkeys
StrCpy $0 0
loop:
EnumRegKey $1 HKLM "Software\Mozilla\MaintenanceService" $0
StrCmp $1 "" doneCount
IntOp $0 $0 + 1
goto loop
doneCount:
; Restore back the registry view
SetRegView lastUsed
${If} $0 == 0
; Get the path of the maintenance service uninstaller
ReadRegStr $1 HKLM ${MaintUninstallKey} "UninstallString"
; If the uninstall string does not exist, skip executing it
StrCmp $1 "" doneUninstall
; $1 is already a quoted string pointing to the install path
; so we're already protected against paths with spaces
nsExec::Exec "$1 /S"
doneUninstall:
${EndIf}
; Restore the old value of $1 and $0
Pop $1
Pop $0
FunctionEnd
################################################################################
# Install Sections
; Empty section required for the installer to compile as an uninstaller
@ -395,6 +439,7 @@ Section "Uninstall"
DeleteRegKey HKLM "$MaintCertKey\"
SetRegView lastused
${EndIf}
Call un.UninstallServiceIfNotUsed
!endif
SectionEnd