From: Brian S. <xue...@us...> - 2007-07-13 21:36:01
|
Update of /cvsroot/popfile/windows In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13597 Modified Files: Tag: b0_22_2 getssl.nsh installer.nsi Log Message: The 0.22.5 installer did not work very well when run from a 'standard' account in Vista. Use the UAC plugin to allow part of the installer to run at 'admin' level and the remainder to run at the current 'user' level. This lets the installer work properly when it is run from a 'standard' account in Vista. Index: installer.nsi =================================================================== RCS file: /cvsroot/popfile/windows/installer.nsi,v retrieving revision 1.242.4.10 retrieving revision 1.242.4.11 diff -C2 -d -r1.242.4.10 -r1.242.4.11 *** installer.nsi 12 May 2007 17:16:05 -0000 1.242.4.10 --- installer.nsi 13 Jul 2007 21:35:51 -0000 1.242.4.11 *************** *** 100,103 **** --- 100,121 ---- #-------------------------------------------------------------------------- + ;------------------------------------------------ + ; This script requires the 'UAC' NSIS plugin + ;------------------------------------------------ + + ; The new 'User Account Control' (UAC) feature in Windows Vista makes it difficult to install + ; POPFile from a 'standard' user account. This script uses a special NSIS plugin (UAC) which + ; allows the 'POPFile program files' part of the installation to be run at the 'admin' level + ; and the user-specific POPFile configuration part to be run at the 'user' level. + ; + ; The 'NSIS Wiki' page for the 'UAC' plugin (description, example and download links): + ; http://nsis.sourceforge.net/UAC_plug-in + ; + ; To compile this script, copy the 'UAC.dll' file to the standard NSIS plugins folder + ; (${NSISDIR}\Plugins\). The 'UAC' source and example files can be unzipped to the + ; appropriate ${NSISDIR} sub-folders if you wish, but this step is entirely optional. + ; + ; Tested with version v0.0.6b of the 'UAC' plugin. + #-------------------------------------------------------------------------- # Compile-time command-line switches (used by 'makensis.exe') *************** *** 230,236 **** ;-------------------------------------------------------------------------- ; Windows Vista expects to find a manifest specifying the execution level ;-------------------------------------------------------------------------- ! RequestExecutionLevel admin ;---------------------------------------------------------------------- --- 248,270 ---- ;-------------------------------------------------------------------------- ; Windows Vista expects to find a manifest specifying the execution level + ; + ; The POPFile installer has two stages; the first stage (setup.exe) installs the + ; POPFile program and then calls the second stage (adduser.exe) to configure POPFile + ; for the current user. + ; + ; The first stage has to be able to write to the default installation folder + ; (C:\Program Files\POPFile, or its equivalent) and be able to create/update + ; some HKLM registry entries so it requires 'administrator' privileges. The + ; second stage creates user-specific environment variables and HKCU registry + ; entries so it requires 'current user' privileges. + ; + ; A special NSIS plugin (UAC) is used to allow these two stages of the + ; installer to run with the required privileges. Although this script is + ; used to create the 'administrator' privileges stage of the installer + ; the UAC plugin requires this script to specify 'user' instead of 'admin' + ; when requesting the execution level. ;-------------------------------------------------------------------------- ! RequestExecutionLevel user ;---------------------------------------------------------------------- *************** *** 242,246 **** !define C_PERL_VERSION "5.8.8" !define C_PERL_BUILD "820" ! ;---------------------------------------------------------------------- ; Recently there have been some significant changes to the structure and --- 276,280 ---- !define C_PERL_VERSION "5.8.8" !define C_PERL_BUILD "820" ! ;---------------------------------------------------------------------- ; Recently there have been some significant changes to the structure and *************** *** 254,273 **** !system '".\toolkit\ap-vcheck.exe" ${C_PERL_DIR}' !include /NONFATAL ".\ap-version.nsh" ! ; The above '!system' call can fail on older (slower/Win9x?) systems so if the expected ; output file is not found we try a safer version of the '!system' call. If this call ; also fails then the NSIS compiler will stop with a fatal error. ! !ifndef C_AP_STATUS !system 'start /w toolkit\ap-vcheck.exe ${C_PERL_DIR}' !include ".\ap-version.nsh" !endif ! ; Delete the "include" file after it has been read ! !delfile ".\ap-version.nsh" ! ; Now we can check that the location defined in ${C_PERL_DIR} is suitable ! !if "${C_AP_STATUS}" == "failure" !error "${MB_NL}${MB_NL}Fatal error:${MB_NL}\ --- 288,307 ---- !system '".\toolkit\ap-vcheck.exe" ${C_PERL_DIR}' !include /NONFATAL ".\ap-version.nsh" ! ; The above '!system' call can fail on older (slower/Win9x?) systems so if the expected ; output file is not found we try a safer version of the '!system' call. If this call ; also fails then the NSIS compiler will stop with a fatal error. ! !ifndef C_AP_STATUS !system 'start /w toolkit\ap-vcheck.exe ${C_PERL_DIR}' !include ".\ap-version.nsh" !endif ! ; Delete the "include" file after it has been read ! !delfile ".\ap-version.nsh" ! ; Now we can check that the location defined in ${C_PERL_DIR} is suitable ! !if "${C_AP_STATUS}" == "failure" !error "${MB_NL}${MB_NL}Fatal error:${MB_NL}\ *************** *** 275,281 **** ${MB_NL} (${C_AP_ERRORMSG})${MB_NL}" !endif ! ; For this build of the installer we require an exact match for the ActivePerl version number _and_ build number ! !if "${C_AP_VERSION}.${C_AP_BUILD}" != "${C_PERL_VERSION}.${C_PERL_BUILD}" !error "${MB_NL}${MB_NL}Fatal error:${MB_NL}\ --- 309,315 ---- ${MB_NL} (${C_AP_ERRORMSG})${MB_NL}" !endif ! ; For this build of the installer we require an exact match for the ActivePerl version number _and_ build number ! !if "${C_AP_VERSION}.${C_AP_BUILD}" != "${C_PERL_VERSION}.${C_PERL_BUILD}" !error "${MB_NL}${MB_NL}Fatal error:${MB_NL}\ *************** *** 284,288 **** ${MB_NL} $\"${C_AP_FOLDER}$\" folder${MB_NL}" !endif ! !echo "${MB_NL}\ ${MB_NL} ActivePerl version ${C_AP_VERSION} Build ${C_AP_BUILD} will be used to prepare the minimal Perl${MB_NL}${MB_NL}" --- 318,322 ---- ${MB_NL} $\"${C_AP_FOLDER}$\" folder${MB_NL}" !endif ! !echo "${MB_NL}\ ${MB_NL} ActivePerl version ${C_AP_VERSION} Build ${C_AP_BUILD} will be used to prepare the minimal Perl${MB_NL}${MB_NL}" *************** *** 735,739 **** ReserveFile "ioG.ini" ReserveFile "${C_RELEASE_NOTES}" ! ReserveFile "SSL_pm.pat" #-------------------------------------------------------------------------- --- 769,774 ---- ReserveFile "ioG.ini" ReserveFile "${C_RELEASE_NOTES}" ! ReserveFile "${C_POPFILE_MAJOR_VERSION}.${C_POPFILE_MINOR_VERSION}.${C_POPFILE_REVISION}.pcf" ! ; ReserveFile "SSL_pm.pat" ; 0.22.5 does not need any SSL patches so there's no need for a built-in copy #-------------------------------------------------------------------------- *************** *** 743,746 **** --- 778,812 ---- Function .onInit + ; Use the UAC plugin to ensure that this installer runs with 'administrator' privileges + ; (UAC = Vista's new "User Account Control" feature). + ; + ; WARNING: The UAC plugin uses $0, $1, $2 and $3 registers + + UAC_Elevate: + UAC::RunElevated + StrCmp 1223 $0 UAC_ElevationAborted ; UAC dialog aborted by user? + StrCmp 0 $0 0 UAC_Err ; Error? + StrCmp 1 $1 0 UAC_Success ; Are we the real deal or just the wrapper? + Quit + + UAC_Err: + MessageBox mb_iconstop "Unable to elevate , error $0" + Abort + + UAC_ElevationAborted: + MessageBox mb_iconstop "This installer requires admin access, aborting!" + Abort + + UAC_Success: + # if $0==0 && $1==0, UAC not supported (Probably <NT6), run as normal? + # if $0==0 && $1==3, we can try to elevate again + # if $0==0 && $3==1, we are a member of the admin group (Any OS) + StrCmp 1 $3 continue ; Admin? + StrCmp 3 $1 0 UAC_ElevationAborted ; Try again? + MessageBox mb_iconstop "This installer requires admin access, try again" + goto UAC_Elevate + + continue: + ; The reason why '.onInit' preserves the registers it uses is that it makes debugging easier! *************** *** 793,796 **** --- 859,883 ---- FunctionEnd + + #-------------------------------------------------------------------------- + # Installer Function: .OnInstFailed (required by UAC plugin) + #-------------------------------------------------------------------------- + + Function .OnInstFailed + + UAC::Unload ; Must call unload! + + FunctionEnd + + #-------------------------------------------------------------------------- + # Installer Function: .OnInstSuccess (required by UAC plugin) + #-------------------------------------------------------------------------- + + Function .OnInstSuccess + + UAC::Unload ; Must call unload! + + FunctionEnd + #-------------------------------------------------------------------------- # Installer Function: PFIGUIInit *************** *** 858,864 **** StrCpy $G_SSL_ONLY "0" ; assume a full installation is required ! Call PFI_GetParameters ! Pop ${L_RESERVED} ! StrCmp ${L_RESERVED} "/SSL" 0 exit StrCpy $G_SSL_ONLY "1" ; just download and install the SSL support files --- 945,958 ---- StrCpy $G_SSL_ONLY "0" ; assume a full installation is required ! Call PFI_GetParameters ; The UAC plugin may modify the command-line ! Push "/SSL" ; so we need to check for "/SSL" anywhere on ! Call PFI_StrStr ; the command-line (instead of assuming the ! Pop ${L_RESERVED} ; command-line is either /SSL or empty) ! StrCmp ${L_RESERVED} "" exit ! StrCpy ${L_RESERVED} ${L_RESERVED} 5 ! StrCmp ${L_RESERVED} "/SSL" sslonly ! StrCmp ${L_RESERVED} "/SSL " 0 exit ! ! sslonly: StrCpy $G_SSL_ONLY "1" ; just download and install the SSL support files *************** *** 1982,1991 **** ; [Future builds may pass more than just a command-line switch to the wizard] IfRebootFlag special_case ! Exec '"$G_ROOTDIR\adduser.exe" /install' Abort special_case: ! Exec '"$G_ROOTDIR\adduser.exe" /installreboot' Abort --- 2076,2090 ---- ; [Future builds may pass more than just a command-line switch to the wizard] + ; Use the UAC plugin to ensure that adduser.exe runs with 'current user' privileges + ; (UAC = Vista's new "User Account Control" feature). + ; + ; WARNING: The UAC plugin uses $0, $1, $2 and $3 registers + IfRebootFlag special_case ! UAC::Exec "" "$G_ROOTDIR\adduser.exe" "/install" "" Abort special_case: ! UAC::Exec "" "$G_ROOTDIR\adduser.exe" "/installreboot" "" Abort Index: getssl.nsh =================================================================== RCS file: /cvsroot/popfile/windows/getssl.nsh,v retrieving revision 1.6.2.13 retrieving revision 1.6.2.14 diff -C2 -d -r1.6.2.13 -r1.6.2.14 *** getssl.nsh 13 Jun 2007 23:26:35 -0000 1.6.2.13 --- getssl.nsh 13 Jul 2007 21:35:51 -0000 1.6.2.14 *************** *** 149,152 **** --- 149,153 ---- !define C_PATCH_WEBSITE "http://getpopfile.org/ssl-patch" + !ifdef INSTALLER !define C_PATCH_CTRL_FILE "${C_POPFILE_MAJOR_VERSION}.${C_POPFILE_MINOR_VERSION}.${C_POPFILE_REVISION}.pcf" *************** *** 554,557 **** --- 555,559 ---- ; 0.22.5 release does not need any SSL patches so "SSL_pm.pat" is not needed here + ; File /nonfatal "/oname=$PLUGINSDIR\SSL_pm.pat" "SSL_pm.pat" !else |