Check for admin privileges in UninstallOld installer routine (#4750)

This commit is contained in:
Tom Najdek 2024-10-14 07:37:00 +02:00 committed by GitHub
parent c14896a640
commit 7ac4c8d667
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -236,7 +236,19 @@ Function UninstallOld
Delete /REBOOTOK "$3\platform.ini"
Delete /REBOOTOK "$3\precomplete"
Delete /REBOOTOK "$3\voucher.bin"
RMDir $3
RMDir /REBOOTOK $3
${If} ${FileExists} "$3"
# If the directory still exists, check if current user is Admin.
# For Admin users, /REBOOTOK works and directory will be removed after reboot
# For non-Admin users, we display a message and quit
UserInfo::GetAccountType
pop $0
StrCmp $0 "Admin" continue_installation
MessageBox mb_iconstop "The previous installation of Zotero could not be removed. Please manually delete the following folder, and then run the installer again: $\n$\n$3"
Quit
${EndIf}
continue_installation:
; End uninstallation
SetShellVarContext current