InstallOptions and aborting the uninstaller
Hi all,
I need to do the following: when uninstalling, a custom page should be shown with 2 radio buttons:
a)- if one is selected I have to check that the user is admin and in case it is go further, if not abort the uninstaller with an error
b)- if the other radio-button is selected I have to run an .exe from the installation directory and abort right away the uninstaller (doesn't need to wait until the exe is finished)
What I did:
=============
- defined the page:
UninstPage custom un.UninstallModePage un.ValidateSelection ;Custom page
- reserve:
ReserveFile "UninstallMode.ini"
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
- Extract InstallOptions INI files
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "UninstallMode.ini"
- show it:
Function un.UninstallModePage ;UninstallModePage defined with Page command
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "UninstallMode.ini"
FunctionEnd
- I added the un.ValidateSelection in order to do here the needed things for a) and b)
Function un.ValidateSelection ; when the user finished with the selection
; check if the selection is the second radio button and if yes for now do a MsgBox and abort the whole uninstaller
!insertmacro MUI_INSTALLOPTIONS_READ $INI_VALUE "UninstallMode.ini" "Field 2" "State"
StrCmp $INI_VALUE "1" 0 +3
MessageBox MB_OK "Here we should run another exe and then abort"
Abort ; abort somehow the whole uninstaller !!!
; check if the selection is the first radio button and if yes check that the current user is admin otherwise abort the whole uninstaller
!insertmacro MUI_INSTALLOPTIONS_READ $INI_VALUE "UninstallMode.ini" "Field 1" "State"
StrCmp $INI_VALUE "1" 0 done
ClearErrors
UserInfo::GetAccountType
Pop $1
StrCmp $1 "Admin" 0 +3
MessageBox MB_OK 'User is in the Administrators group'
Goto done
MessageBox MB_OK 'User is NOT in the Administrators group, so we should ABORT here somehow'
Abort ; abort somehow the whole uninstaller !!!
done:
FunctionEnd
Problems:
===========
- In both cases a) and b) I need to at some point completely abort the uninstaller. Those points are showed in un.ValidateSelection, check for "abort somehow the whole uninstaller !!!". How can I abort the whole uninstaller in those cases? For b) with no error message, and for a) with a MsgBox saying that the current user needs to be admin?
- In case of b) where and how should I run the exe just before aborting the whole uninstaller?
Sorry for the long post and thx in advance,
Viv