2006-07-12 11:03:00 +00:00
|
|
|
/*
|
|
|
|
|
|
|
|
Checks for Windows version
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2006-10-02 17:21:20 +00:00
|
|
|
;--------------------------------
|
|
|
|
;Macros
|
2006-07-12 11:03:00 +00:00
|
|
|
|
2006-10-02 17:21:20 +00:00
|
|
|
!macro CheckPrivileges
|
2006-07-12 11:03:00 +00:00
|
|
|
|
|
|
|
Push $R0
|
|
|
|
|
|
|
|
UserInfo::GetAccountType
|
|
|
|
Pop $R0
|
|
|
|
|
|
|
|
${if} $R0 == "Admin"
|
|
|
|
StrCpy $AdminOrPowerUser ${TRUE}
|
|
|
|
${elseif} $R0 == "Power"
|
|
|
|
StrCpy $AdminOrPowerUser ${TRUE}
|
|
|
|
${else}
|
|
|
|
StrCpy $AdminOrPowerUser ${FALSE}
|
|
|
|
${endif}
|
|
|
|
|
2006-10-02 17:21:20 +00:00
|
|
|
Pop $R0
|
|
|
|
|
|
|
|
!macroend
|
|
|
|
|
|
|
|
!macro CommandLineParameter UNINSTALL
|
|
|
|
|
|
|
|
Exch $R0
|
|
|
|
Push $R1
|
|
|
|
Push $R2
|
|
|
|
|
|
|
|
StrLen $R1 $R0
|
|
|
|
|
|
|
|
Push $CMDLINE
|
|
|
|
Push $R0
|
|
|
|
Call ${UNINSTALL}StrStr
|
|
|
|
Pop $R2
|
|
|
|
|
|
|
|
StrCpy $R2 $R2 $R1
|
|
|
|
|
|
|
|
${if} $R2 == $R0
|
|
|
|
StrCpy $R0 ${TRUE}
|
|
|
|
${else}
|
|
|
|
StrCpy $R0 ${FALSE}
|
2006-07-12 11:03:00 +00:00
|
|
|
${endif}
|
|
|
|
|
2006-10-02 17:21:20 +00:00
|
|
|
Push $R2
|
|
|
|
Push $R1
|
|
|
|
Exch $R0
|
|
|
|
|
|
|
|
!macroend
|
|
|
|
|
|
|
|
;--------------------------------
|
|
|
|
;Functions
|
|
|
|
|
|
|
|
Function CheckPrivileges
|
|
|
|
!insertmacro CheckPrivileges
|
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
Function un.CheckPrivileges
|
|
|
|
!insertmacro CheckPrivileges
|
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
Function CommandLineParameter
|
|
|
|
!insertmacro CommandLineParameter ""
|
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
Function un.CommandLineParameter
|
|
|
|
!insertmacro CommandLineParameter un.
|
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
Function CheckWindows
|
|
|
|
|
|
|
|
Push $R0
|
|
|
|
Push $R1
|
|
|
|
|
|
|
|
;Check for Windows NT 5.0 or later (2000, XP, 2003 etc.)
|
|
|
|
|
|
|
|
ReadRegStr $R0 HKLM "Software\Microsoft\Windows NT\CurrentVersion" "CurrentVersion"
|
|
|
|
${VersionCompare} $R0 "5.0" $R1
|
2006-07-12 11:03:00 +00:00
|
|
|
|
2006-10-02 17:21:20 +00:00
|
|
|
${if} $R1 == "2"
|
|
|
|
MessageBox MB_OK|MB_ICONSTOP "${APP_NAME} ${APP_VERSION} only supports Windows 2000, XP, 2003 and later."
|
|
|
|
Quit
|
|
|
|
${endif}
|
|
|
|
|
|
|
|
Pop $R1
|
|
|
|
Pop $R0
|
|
|
|
|
2006-07-12 11:03:00 +00:00
|
|
|
FunctionEnd
|
|
|
|
|
2006-09-22 22:30:06 +00:00
|
|
|
Function UpdatePathEnvironment
|
|
|
|
|
|
|
|
Push $R0
|
|
|
|
Push $R1
|
|
|
|
|
|
|
|
;Updates the path environment variable of the instaler process to the latest system value
|
|
|
|
|
|
|
|
ReadRegStr $R0 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" Path
|
|
|
|
ReadRegStr $R1 HKCU "Environment" Path
|
|
|
|
|
|
|
|
System::Call 'kernel32::SetEnvironmentVariableA(t, t) i("Path", "$R0;$R1").r0'
|
|
|
|
|
|
|
|
Pop $R1
|
|
|
|
Pop $R0
|
|
|
|
|
|
|
|
FunctionEnd
|
|
|
|
|
2006-10-02 17:21:20 +00:00
|
|
|
Function InitInstaller
|
2006-07-12 11:03:00 +00:00
|
|
|
|
|
|
|
Push $R0
|
|
|
|
|
2006-10-02 17:21:20 +00:00
|
|
|
Push "/CurrentUser"
|
|
|
|
Call CommandLineParameter
|
|
|
|
Pop $CurrentUserInstall
|
2006-07-12 11:03:00 +00:00
|
|
|
|
2006-10-02 17:21:20 +00:00
|
|
|
${if} $CurrentUserInstall == ${TRUE}
|
2006-07-12 11:03:00 +00:00
|
|
|
|
2006-10-02 17:21:20 +00:00
|
|
|
SetShellVarContext current
|
2006-07-12 11:03:00 +00:00
|
|
|
|
2006-10-02 17:21:20 +00:00
|
|
|
${else}
|
2006-09-19 23:07:00 +00:00
|
|
|
|
2006-10-02 17:21:20 +00:00
|
|
|
${if} $AdminOrPowerUser == ${TRUE}
|
|
|
|
|
|
|
|
SetShellVarContext all
|
|
|
|
|
|
|
|
${else}
|
2006-09-19 23:07:00 +00:00
|
|
|
|
2006-10-02 17:21:20 +00:00
|
|
|
;Display an error when the /AllUsers command line parameter is used
|
|
|
|
;by a user without Administrator or Power User priviledges
|
|
|
|
|
|
|
|
Push "/AllUsers"
|
|
|
|
Call CommandLineParameter
|
|
|
|
Pop $R0
|
|
|
|
|
|
|
|
${if} $R0 == ${TRUE}
|
|
|
|
MessageBox MB_OK|MB_ICONSTOP "You need Administrator or Power User privileges to install ${APP_NAME} for all users."
|
2006-09-19 23:07:00 +00:00
|
|
|
Quit
|
|
|
|
${endif}
|
|
|
|
|
2006-10-02 17:21:20 +00:00
|
|
|
SetShellVarContext current
|
|
|
|
|
2006-07-12 11:03:00 +00:00
|
|
|
${endif}
|
2006-09-19 23:07:00 +00:00
|
|
|
|
2006-10-02 17:21:20 +00:00
|
|
|
${endif}
|
2006-09-19 23:07:00 +00:00
|
|
|
|
2006-10-02 17:21:20 +00:00
|
|
|
${if} ${silent}
|
|
|
|
Call InitUser
|
2006-07-12 11:03:00 +00:00
|
|
|
${endif}
|
|
|
|
|
|
|
|
Pop $R0
|
2006-10-02 17:21:20 +00:00
|
|
|
|
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
Function un.InitUnInstaller
|
|
|
|
|
|
|
|
;Set the correct shell context depending on whether LyX has been installed
|
|
|
|
;for the current user or all users
|
|
|
|
|
|
|
|
Push "/CurrentUser"
|
|
|
|
Call un.CommandLineParameter
|
|
|
|
Pop $CurrentUserInstall
|
|
|
|
|
|
|
|
${if} $CurrentUserInstall == ${TRUE}
|
|
|
|
|
|
|
|
SetShellVarContext current
|
|
|
|
|
|
|
|
${else}
|
2006-07-12 11:03:00 +00:00
|
|
|
|
2006-10-02 17:21:20 +00:00
|
|
|
${if} $AdminOrPowerUser == ${FALSE}
|
|
|
|
MessageBox MB_OK|MB_ICONSTOP "${APP_NAME} has been installed for all users. Therefore you need Administrator or Power User privileges to uninstall."
|
|
|
|
Quit
|
|
|
|
${else}
|
|
|
|
SetShellVarContext all
|
|
|
|
${endif}
|
|
|
|
|
|
|
|
${endif}
|
|
|
|
|
2006-07-12 11:03:00 +00:00
|
|
|
FunctionEnd
|
2006-10-02 17:21:20 +00:00
|
|
|
|