From: Brian S. <xue...@us...> - 2007-10-14 17:20:28
|
Update of /cvsroot/popfile/windows In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16834 Modified Files: Tag: b0_22_2 installer-SecPOPFile-func.nsh installer-Uninstall.nsh installer.nsi WriteEnvStr.nsh Log Message: The uninstaller for the next release (1.0.0) will be able to modify an existing installation by downloading and adding SSL support to it or, if Nihongo has been selected, changing the Nihongo parser. This new feature will be accessed via the "Change" button in POPFile's "Add/Remove Programs" entry or the "Uninstall POPFile" shortcut in the Start Menu. The uninstaller now offers choice between modifying the installation or removing it. To support this new feature several sections and functions have been changed into macro-based ones to make future maintenance easier. To do: Change installer-Uninstall.nsh because the current code makes the installer about 40% bigger than before. More aggressive conditional compilation statements are required here! Index: installer.nsi =================================================================== RCS file: /cvsroot/popfile/windows/installer.nsi,v retrieving revision 1.242.4.13 retrieving revision 1.242.4.14 diff -C2 -d -r1.242.4.13 -r1.242.4.14 *** installer.nsi 5 Oct 2007 18:36:52 -0000 1.242.4.13 --- installer.nsi 14 Oct 2007 17:19:41 -0000 1.242.4.14 *************** *** 47,50 **** --- 47,51 ---- # (5) installer-Uninstall.nsh - source for the POPFile uninstaller (uninstall.exe) # (6) getssl.nsh - section & functions used to download the SSL support files + # (7) getparser.nsh - macro-based sections and functions to install the Nihongo Parser #-------------------------------------------------------------------------- *************** *** 167,171 **** # Japanese text does not use spaces between words so POPFile uses a parser to split the text # into words so the text can be analysed properly. POPFile 0.22.5 (and earlier) only supported [...1036 lines suppressed...] ! FunctionEnd ! !macroend ! ! #-------------------------------------------------------------------------- ! # Installer Function: NSIS2IO ! # ! # This function is used during the installation process ! #-------------------------------------------------------------------------- ! ! !insertmacro NSIS2IO "" ! ! #-------------------------------------------------------------------------- ! # Uninstaller Function: un.NSIS2IO ! # ! # This function is used during the uninstall process ! #-------------------------------------------------------------------------- ! ! !insertmacro NSIS2IO "un." #-------------------------------------------------------------------------- Index: installer-SecPOPFile-func.nsh =================================================================== RCS file: /cvsroot/popfile/windows/installer-SecPOPFile-func.nsh,v retrieving revision 1.1.2.6 retrieving revision 1.1.2.7 diff -C2 -d -r1.1.2.6 -r1.1.2.7 *** installer-SecPOPFile-func.nsh 21 Sep 2007 01:18:53 -0000 1.1.2.6 --- installer-SecPOPFile-func.nsh 14 Oct 2007 17:19:41 -0000 1.1.2.7 *************** *** 37,41 **** # # CheckHostsFile - # MakeRootDirSafe # MinPerlRestructure # SkinsRestructure --- 37,40 ---- *************** *** 43,46 **** --- 42,56 ---- #-------------------------------------------------------------------------- + # The following functions are used by the 'installer-SecPOPFile-body.nsh' file + # and the 'getssl.nsh' file: + # + # MakeRootDirSafe + # un.MakeRootDirSafe + # + # (this is a macro-based function, to ensure that the installer and uninstaller + # use identical functions) + #-------------------------------------------------------------------------- + + #-------------------------------------------------------------------------- # Installer Function: CheckHostsFile # *************** *** 119,346 **** #-------------------------------------------------------------------------- - # Installer Function: MakeRootDirSafe - # - # If we are installing on top of a previous installation, we try to shut it down - # (to allow the files to be overwritten without requiring a reboot) - # - # We also need to check if any of the PFI utilities are running (to avoid Abort/Retry/Ignore - # messages or the need to reboot in order to update them) - #-------------------------------------------------------------------------- - - Function MakeRootDirSafe - - ; Use HKLM as a simple workaround for the case where installer is started by a non-admin user - - Push $G_ROOTDIR - - ReadRegStr $G_ROOTDIR HKLM "Software\POPFile Project\${C_PFI_PRODUCT}\MRI" "UAC_RootDir" - StrCmp $G_ROOTDIR "" 0 check_folder_exists - MessageBox MB_OK|MB_ICONEXCLAMATION "Internal Error: UAC_RootDir not defined\ - ${MB_NL}${MB_NL}\ - Click OK to continue" - ReadRegStr $G_ROOTDIR HKLM "Software\POPFile Project\${C_PFI_PRODUCT}\MRI" "UAC_RootDir" - StrCmp $G_ROOTDIR "" try_other_entries - MessageBox MB_OK|MB_ICONINFORMATION "Good News: UAC_RootDir now defined" - Goto check_folder_exists - - try_other_entries: ; ??? - ReadRegStr $G_ROOTDIR HKCU "Software\POPFile Project\${C_PFI_PRODUCT}\MRI" "RootDir_LFN" - StrCmp $G_ROOTDIR "" 0 check_folder_exists - ReadRegStr $G_ROOTDIR HKLM "Software\POPFile Project\${C_PFI_PRODUCT}\MRI" "InstallPath" - - check_folder_exists: - DeleteRegValue HKLM "Software\POPFile Project\${C_PFI_PRODUCT}\MRI" "UAC_RootDir" - - ; If we are upgrading an existing installation we need to ensure it is not running - - IfFileExists "$G_ROOTDIR\*.exe" 0 nothing_to_check - - !define L_CFG $R9 ; file handle - !define L_EXE $R8 ; name of EXE file to be monitored - !define L_LINE $R7 - !define L_NEW_GUI $R6 - !define L_OLD_GUI $R5 - !define L_PARAM $R4 - !define L_RESULT $R3 - !define L_TEXTEND $R2 ; used to ensure correct handling of lines longer than 1023 chars - - Push ${L_CFG} - Push ${L_EXE} - Push ${L_LINE} - Push ${L_NEW_GUI} - Push ${L_OLD_GUI} - Push ${L_PARAM} - Push ${L_RESULT} - Push ${L_TEXTEND} - - ; Starting with POPfile 0.21.0 an experimental version of 'popfile-service.exe' was included - ; to allow POPFile to be run as a Windows service. - - Push "POPFile" - Call PFI_ServiceRunning - Pop ${L_RESULT} - StrCmp ${L_RESULT} "true" manual_shutdown - - ; If we are about to overwrite an existing version which is still running, - ; then one of the EXE files will be 'locked' which means we have to shutdown POPFile. - ; - ; POPFile v0.20.0 and later may be using 'popfileb.exe', 'popfilef.exe', 'popfileib.exe', - ; 'popfileif.exe', 'perl.exe' or 'wperl.exe'. - ; - ; Earlier versions of POPFile use only 'perl.exe' or 'wperl.exe'. - - Push $G_ROOTDIR - Call PFI_FindLockedPFE - Pop ${L_EXE} - StrCmp ${L_EXE} "" check_pfi_utils - - ; The program files we are about to update are in use so we need to shut POPFile down - - DetailPrint "... it is locked." - - ; Attempt to discover which POPFile UI port is used by the current user, so we can issue - ; a shutdown request. The following cases are considered: - ; - ; (a) upgrading a 0.21.0 or later installation and runpopfile.exe was used to start POPFile, - ; so POPFile is using environment variables which match the HKCU RootDir_SFN and - ; UserDir_SFN registry data (or HKCU RootDir_LFN and UserDir_LFN if short file names are - ; not supported) - ; - ; (b) upgrading a pre-0.21.0 installation, so popfile.cfg is in the $G_ROOTDIR folder. Need to - ; look for old-style and new-style UI port specifications just like the old installer did. - - ReadRegStr ${L_CFG} HKCU "Software\POPFile Project\${C_PFI_PRODUCT}\MRI" "UserDir_LFN" - StrCmp ${L_CFG} "" try_root_dir - IfFileExists "${L_CFG}\popfile.cfg" check_cfg_file - - try_root_dir: - IfFileExists "$G_ROOTDIR\popfile.cfg" 0 manual_shutdown - StrCpy ${L_CFG} "$G_ROOTDIR" - - check_cfg_file: - StrCpy ${L_NEW_GUI} "" - StrCpy ${L_OLD_GUI} "" - - ; See if we can get the current gui port from an existing configuration. - ; There may be more than one entry for this port in the file - use the last one found - ; (but give priority to any "html_port" entry). - - FileOpen ${L_CFG} "${L_CFG}\popfile.cfg" r - - found_eol: - StrCpy ${L_TEXTEND} "<eol>" - - loop: - FileRead ${L_CFG} ${L_LINE} - StrCmp ${L_LINE} "" done - StrCmp ${L_TEXTEND} "<eol>" 0 check_eol - StrCmp ${L_LINE} "$\n" loop - - StrCpy ${L_PARAM} ${L_LINE} 10 - StrCmp ${L_PARAM} "html_port " got_html_port - - StrCpy ${L_PARAM} ${L_LINE} 8 - StrCmp ${L_PARAM} "ui_port " got_ui_port - Goto check_eol - - got_ui_port: - StrCpy ${L_OLD_GUI} ${L_LINE} 5 8 - Goto check_eol - - got_html_port: - StrCpy ${L_NEW_GUI} ${L_LINE} 5 10 - - ; Now read file until we get to end of the current line - ; (i.e. until we find text ending in <CR><LF>, <CR> or <LF>) - - check_eol: - StrCpy ${L_TEXTEND} ${L_LINE} 1 -1 - StrCmp ${L_TEXTEND} "$\n" found_eol - StrCmp ${L_TEXTEND} "$\r" found_eol loop - - done: - FileClose ${L_CFG} - - Push ${L_NEW_GUI} - Call PFI_TrimNewlines - Pop ${L_NEW_GUI} - - Push ${L_OLD_GUI} - Call PFI_TrimNewlines - Pop ${L_OLD_GUI} - - StrCmp ${L_NEW_GUI} "" try_old_style - DetailPrint "$(PFI_LANG_INST_LOG_SHUTDOWN) ${L_NEW_GUI} [new style port]" - DetailPrint "$(PFI_LANG_TAKE_A_FEW_SECONDS)" - Push ${L_NEW_GUI} - Call PFI_ShutdownViaUI - Pop ${L_RESULT} - DetailPrint "PFI_ShutdownViaUI result: ${L_RESULT}" - StrCmp ${L_RESULT} "success" check_exe - StrCmp ${L_RESULT} "password?" manual_shutdown - - try_old_style: - StrCmp ${L_OLD_GUI} "" manual_shutdown - DetailPrint "$(PFI_LANG_INST_LOG_SHUTDOWN) ${L_OLD_GUI} [old style port]" - DetailPrint "$(PFI_LANG_TAKE_A_FEW_SECONDS)" - Push ${L_OLD_GUI} - Call PFI_ShutdownViaUI - Pop ${L_RESULT} - DetailPrint "PFI_ShutdownViaUI result: ${L_RESULT}" - StrCmp ${L_RESULT} "success" check_exe - Goto manual_shutdown - - check_exe: - DetailPrint "Waiting for '${L_EXE}' to unlock after NSISdl request..." - DetailPrint "Please be patient, this may take more than 30 seconds" - Push ${L_EXE} - Call PFI_WaitUntilUnlocked - DetailPrint "Checking if '${L_EXE}' is still locked after NSISdl request..." - Push "${C_EXE_END_MARKER}" - Push ${L_EXE} - Call PFI_CheckIfLocked - Pop ${L_EXE} - StrCmp ${L_EXE} "" unlocked_now - - manual_shutdown: - StrCpy $G_PLS_FIELD_1 "POPFile" - DetailPrint "Unable to shutdown $G_PLS_FIELD_1 automatically - manual intervention requested" - MessageBox MB_OK|MB_ICONEXCLAMATION|MB_TOPMOST "$(PFI_LANG_MBMANSHUT_1)\ - ${MB_NL}${MB_NL}\ - $(PFI_LANG_MBMANSHUT_2)\ - ${MB_NL}${MB_NL}\ - $(PFI_LANG_MBMANSHUT_3)" - Goto check_pfi_utils - - unlocked_now: - DetailPrint "File is now unlocked" - - check_pfi_utils: - Push $G_ROOTDIR - Call PFI_RequestPFIUtilsShutdown - - Pop ${L_TEXTEND} - Pop ${L_RESULT} - Pop ${L_PARAM} - Pop ${L_OLD_GUI} - Pop ${L_NEW_GUI} - Pop ${L_LINE} - Pop ${L_EXE} - Pop ${L_CFG} - - !undef L_CFG - !undef L_EXE - !undef L_LINE - !undef L_NEW_GUI - !undef L_OLD_GUI - !undef L_PARAM - !undef L_RESULT - !undef L_TEXTEND - - nothing_to_check: - Pop $G_ROOTDIR - FunctionEnd - - #-------------------------------------------------------------------------- # Installer Function: MinPerlRestructure # --- 129,132 ---- *************** *** 511,514 **** --- 297,534 ---- #-------------------------------------------------------------------------- + # Macro: Make_RootDir_Safe + # + # If we are installing on top of a previous installation or modifying an existing + # installation, we try to shut it down (to allow the files to be overwritten without + # requiring a reboot) + # + # We also need to check if any of the PFI utilities shipped with POPFile are running + # (to avoid Abort/Retry/Ignore messages or the need to reboot in order to update them) + # + # This macro makes maintenance easier by ensuring that both processes use identical + # functions, with the only difference being their names. + #-------------------------------------------------------------------------- + + !macro MAKE_ROOTDIR_SAFE UN + Function ${UN}MakeRootDirSafe + + ; Use HKLM as a simple workaround for the case where installer is started by a non-admin user + + Push $G_ROOTDIR + + ReadRegStr $G_ROOTDIR HKLM "Software\POPFile Project\${C_PFI_PRODUCT}\MRI" "UAC_RootDir" + StrCmp $G_ROOTDIR "" 0 check_folder_exists + MessageBox MB_OK|MB_ICONEXCLAMATION "Internal Error: UAC_RootDir not defined\ + ${MB_NL}${MB_NL}\ + Click OK to continue" + ReadRegStr $G_ROOTDIR HKLM "Software\POPFile Project\${C_PFI_PRODUCT}\MRI" "UAC_RootDir" + StrCmp $G_ROOTDIR "" try_other_entries + MessageBox MB_OK|MB_ICONINFORMATION "Good News: UAC_RootDir now defined" + Goto check_folder_exists + + try_other_entries: ; ??? + ReadRegStr $G_ROOTDIR HKCU "Software\POPFile Project\${C_PFI_PRODUCT}\MRI" "RootDir_LFN" + StrCmp $G_ROOTDIR "" 0 check_folder_exists + ReadRegStr $G_ROOTDIR HKLM "Software\POPFile Project\${C_PFI_PRODUCT}\MRI" "InstallPath" + + check_folder_exists: + DeleteRegValue HKLM "Software\POPFile Project\${C_PFI_PRODUCT}\MRI" "UAC_RootDir" + + ; If we are upgrading an existing installation we need to ensure it is not running + + IfFileExists "$G_ROOTDIR\*.exe" 0 nothing_to_check + + !define L_CFG $R9 ; file handle + !define L_EXE $R8 ; name of EXE file to be monitored + !define L_LINE $R7 + !define L_NEW_GUI $R6 + !define L_OLD_GUI $R5 + !define L_PARAM $R4 + !define L_RESULT $R3 + !define L_TEXTEND $R2 ; used to ensure correct handling of lines longer than 1023 chars + + Push ${L_CFG} + Push ${L_EXE} + Push ${L_LINE} + Push ${L_NEW_GUI} + Push ${L_OLD_GUI} + Push ${L_PARAM} + Push ${L_RESULT} + Push ${L_TEXTEND} + + ; Starting with POPfile 0.21.0 an experimental version of 'popfile-service.exe' was included + ; to allow POPFile to be run as a Windows service. + + Push "POPFile" + Call ${UN}PFI_ServiceRunning + Pop ${L_RESULT} + StrCmp ${L_RESULT} "true" manual_shutdown + + ; If we are about to overwrite an existing version which is still running, + ; then one of the EXE files will be 'locked' which means we have to shutdown POPFile. + ; + ; POPFile v0.20.0 and later may be using 'popfileb.exe', 'popfilef.exe', 'popfileib.exe', + ; 'popfileif.exe', 'perl.exe' or 'wperl.exe'. + ; + ; Earlier versions of POPFile use only 'perl.exe' or 'wperl.exe'. + + Push $G_ROOTDIR + Call ${UN}PFI_FindLockedPFE + Pop ${L_EXE} + StrCmp ${L_EXE} "" check_pfi_utils + + ; The program files we are about to update are in use so we need to shut POPFile down + + DetailPrint "... oen of them is locked." + + ; Attempt to discover which POPFile UI port is used by the current user, so we can issue + ; a shutdown request. The following cases are considered: + ; + ; (a) upgrading a 0.21.0 or later installation and runpopfile.exe was used to start POPFile, + ; so POPFile is using environment variables which match the HKCU RootDir_SFN and + ; UserDir_SFN registry data (or HKCU RootDir_LFN and UserDir_LFN if short file names are + ; not supported) + ; + ; (b) upgrading a pre-0.21.0 installation, so popfile.cfg is in the $G_ROOTDIR folder. Need to + ; look for old-style and new-style UI port specifications just like the old installer did. + + ReadRegStr ${L_CFG} HKCU "Software\POPFile Project\${C_PFI_PRODUCT}\MRI" "UserDir_LFN" + StrCmp ${L_CFG} "" try_root_dir + IfFileExists "${L_CFG}\popfile.cfg" check_cfg_file + + try_root_dir: + IfFileExists "$G_ROOTDIR\popfile.cfg" 0 manual_shutdown + StrCpy ${L_CFG} "$G_ROOTDIR" + + check_cfg_file: + StrCpy ${L_NEW_GUI} "" + StrCpy ${L_OLD_GUI} "" + + ; See if we can get the current gui port from an existing configuration. + ; There may be more than one entry for this port in the file - use the last one found + ; (but give priority to any "html_port" entry). + + FileOpen ${L_CFG} "${L_CFG}\popfile.cfg" r + + found_eol: + StrCpy ${L_TEXTEND} "<eol>" + + loop: + FileRead ${L_CFG} ${L_LINE} + StrCmp ${L_LINE} "" done + StrCmp ${L_TEXTEND} "<eol>" 0 check_eol + StrCmp ${L_LINE} "$\n" loop + + StrCpy ${L_PARAM} ${L_LINE} 10 + StrCmp ${L_PARAM} "html_port " got_html_port + + StrCpy ${L_PARAM} ${L_LINE} 8 + StrCmp ${L_PARAM} "ui_port " got_ui_port + Goto check_eol + + got_ui_port: + StrCpy ${L_OLD_GUI} ${L_LINE} 5 8 + Goto check_eol + + got_html_port: + StrCpy ${L_NEW_GUI} ${L_LINE} 5 10 + + ; Now read file until we get to end of the current line + ; (i.e. until we find text ending in <CR><LF>, <CR> or <LF>) + + check_eol: + StrCpy ${L_TEXTEND} ${L_LINE} 1 -1 + StrCmp ${L_TEXTEND} "$\n" found_eol + StrCmp ${L_TEXTEND} "$\r" found_eol loop + + done: + FileClose ${L_CFG} + + Push ${L_NEW_GUI} + Call ${UN}PFI_TrimNewlines + Pop ${L_NEW_GUI} + + Push ${L_OLD_GUI} + Call ${UN}PFI_TrimNewlines + Pop ${L_OLD_GUI} + + StrCmp ${L_NEW_GUI} "" try_old_style + DetailPrint "$(PFI_LANG_INST_LOG_SHUTDOWN) ${L_NEW_GUI} [new style port]" + DetailPrint "$(PFI_LANG_TAKE_A_FEW_SECONDS)" + Push ${L_NEW_GUI} + Call ${UN}PFI_ShutdownViaUI + Pop ${L_RESULT} + DetailPrint "PFI_ShutdownViaUI result: ${L_RESULT}" + StrCmp ${L_RESULT} "success" check_exe + StrCmp ${L_RESULT} "password?" manual_shutdown + + try_old_style: + StrCmp ${L_OLD_GUI} "" manual_shutdown + DetailPrint "$(PFI_LANG_INST_LOG_SHUTDOWN) ${L_OLD_GUI} [old style port]" + DetailPrint "$(PFI_LANG_TAKE_A_FEW_SECONDS)" + Push ${L_OLD_GUI} + Call ${UN}PFI_ShutdownViaUI + Pop ${L_RESULT} + DetailPrint "PFI_ShutdownViaUI result: ${L_RESULT}" + StrCmp ${L_RESULT} "success" check_exe + Goto manual_shutdown + + check_exe: + DetailPrint "Waiting for '${L_EXE}' to unlock after NSISdl request..." + DetailPrint "Please be patient, this may take more than 30 seconds" + Push ${L_EXE} + Call ${UN}PFI_WaitUntilUnlocked + DetailPrint "Checking if '${L_EXE}' is still locked after NSISdl request..." + Push "${C_EXE_END_MARKER}" + Push ${L_EXE} + Call ${UN}PFI_CheckIfLocked + Pop ${L_EXE} + StrCmp ${L_EXE} "" unlocked_now + + manual_shutdown: + StrCpy $G_PLS_FIELD_1 "POPFile" + DetailPrint "Unable to shutdown $G_PLS_FIELD_1 automatically - manual intervention requested" + MessageBox MB_OK|MB_ICONEXCLAMATION|MB_TOPMOST "$(PFI_LANG_MBMANSHUT_1)\ + ${MB_NL}${MB_NL}\ + $(PFI_LANG_MBMANSHUT_2)\ + ${MB_NL}${MB_NL}\ + $(PFI_LANG_MBMANSHUT_3)" + Goto check_pfi_utils + + unlocked_now: + DetailPrint "File is now unlocked" + + check_pfi_utils: + Push $G_ROOTDIR + Call ${UN}PFI_RequestPFIUtilsShutdown + + Pop ${L_TEXTEND} + Pop ${L_RESULT} + Pop ${L_PARAM} + Pop ${L_OLD_GUI} + Pop ${L_NEW_GUI} + Pop ${L_LINE} + Pop ${L_EXE} + Pop ${L_CFG} + + !undef L_CFG + !undef L_EXE + !undef L_LINE + !undef L_NEW_GUI + !undef L_OLD_GUI + !undef L_PARAM + !undef L_RESULT + !undef L_TEXTEND + + nothing_to_check: + Pop $G_ROOTDIR + FunctionEnd + !macroend + + !insertmacro MAKE_ROOTDIR_SAFE "" + + !insertmacro MAKE_ROOTDIR_SAFE "un." + + #-------------------------------------------------------------------------- # End of 'installer-SecPOPFile-func.nsh' #-------------------------------------------------------------------------- Index: WriteEnvStr.nsh =================================================================== RCS file: /cvsroot/popfile/windows/WriteEnvStr.nsh,v retrieving revision 1.12.4.4 retrieving revision 1.12.4.5 diff -C2 -d -r1.12.4.4 -r1.12.4.5 *** WriteEnvStr.nsh 5 Oct 2007 18:36:52 -0000 1.12.4.4 --- WriteEnvStr.nsh 14 Oct 2007 17:19:42 -0000 1.12.4.5 *************** *** 43,340 **** !ifndef ADDUSER #-------------------------------------------------------------------------- - # Installer Function: PFI_WriteEnv - # - # Writes an environment variable which is available to the 'current user' on a modern OS. - # On Win9x systems, AUTOEXEC.BAT is updated and the Reboot flag is set to request a reboot - # to make the new variable available for use. - # - # Inputs: - # (top of stack) - value for the new environment variable - # (top of stack - 1) - name of the new environment variable - # - # Outputs: - # none - # - # Usage: - # Push "HOMEDIR" - # Push "C:\New Home Dir" - # Call PFI_WriteEnvStr - # - #-------------------------------------------------------------------------- - - Function PFI_WriteEnvStr - - ; Registers common to Win9x and non-Win9x processing - - !define ENV_NAME $R9 ; name of the environment variable - !define ENV_VALUE $R8 ; value of the environment variable - !define TEMP $R7 - - ; Registers used only for Win9x processing - - !define DESTN $R6 ; used to access the revised AUTOEXEC.BAT file - !define ENV_FOUND $R5 ; 0 = variable not found, 1 = variable found in AUTOEXEC.BAT - !define ENV_SETLEN $R4 ; length of the string in ${ENV_SETNAME} - !define ENV_SETNAME $R3 ; left-hand side of SET command for the variable, incl '=' - !define LINE $R2 ; a line from AUTOEXEC.BAT - !define SOURCE $R1 ; used to access original AUTOEXEC.BAT file - !define TEMPFILE $R0 ; name of file used to build the revised AUTOEXEC.BAT file - - Exch ${ENV_VALUE} - Exch - Exch ${ENV_NAME} - Push ${TEMP} - - Call PFI_IsNT - Pop ${TEMP} - StrCmp ${TEMP} 1 WriteEnvStr_NT - - ; On Win9x system, so we add the new data to AUTOEXEC.BAT if it is not already there - - Push ${DESTN} - Push ${ENV_FOUND} - Push ${ENV_SETLEN} - Push ${ENV_SETNAME} - Push ${LINE} - Push ${SOURCE} - Push ${TEMPFILE} - - StrCpy ${ENV_SETNAME} "SET ${ENV_NAME}=" - StrLen ${ENV_SETLEN} ${ENV_SETNAME} - - StrCpy ${SOURCE} $WINDIR 2 ; Get the drive used for Windows (usually 'C:') - FileOpen ${SOURCE} "${SOURCE}\autoexec.bat" r - GetTempFileName ${TEMPFILE} - FileOpen ${DESTN} ${TEMPFILE} w - - StrCpy ${ENV_FOUND} 0 - - loop: - FileRead ${SOURCE} ${LINE} ; Read line from AUTOEXEC.BAT - StrCmp ${LINE} "" eof_found - Push ${LINE} - Call PFI_TrimNewlines - Pop ${LINE} - StrCmp ${LINE} "" copy_line ; Blank lines are preserved in the copy we make - StrCpy ${TEMP} ${LINE} ${ENV_SETLEN} - StrCmp ${TEMP} ${ENV_SETNAME} 0 copy_line - StrCpy ${ENV_FOUND} 1 ; Have found a match. Now check the value it defines. - StrCpy ${TEMP} ${LINE} "" ${ENV_SETLEN} - StrCmp ${TEMP} ${ENV_VALUE} 0 different_value - ReadEnvStr ${TEMP} ${ENV_NAME} ; Identical value found. Now see if it currently exists. - StrCmp ${TEMP} ${ENV_VALUE} copy_line - SetRebootFlag true ; Value does not exist, so we need to reboot - - copy_line: - FileWrite ${DESTN} "${LINE}${MB_NL}" - Goto loop - - different_value: - FileWrite ${DESTN} "REM ${LINE}${MB_NL}" ; 'Comment out' the incorrect value - FileWrite ${DESTN} "${ENV_SETNAME}${ENV_VALUE}${MB_NL}" - SetRebootFlag true - Goto loop - - eof_found: - StrCmp ${ENV_FOUND} 1 autoexec_done - FileWrite ${DESTN} "${ENV_SETNAME}${ENV_VALUE}${MB_NL}" ; Append line for the new variable - SetRebootFlag true - - autoexec_done: - FileClose ${SOURCE} - FileClose ${DESTN} - - IfRebootFlag 0 win9x_done - StrCpy ${SOURCE} $WINDIR 2 - Delete "${SOURCE}\autoexec.bat" - CopyFiles /SILENT ${TEMPFILE} "${SOURCE}\autoexec.bat" - Delete ${TEMPFILE} - - win9x_done: - Pop ${TEMPFILE} - Pop ${SOURCE} - Pop ${LINE} - Pop ${ENV_SETNAME} - Pop ${ENV_SETLEN} - Pop ${ENV_FOUND} - Pop ${DESTN} - Goto WriteEnvStr_done - - ; More modern OS case (AUTOEXEC.BAT not relevant) - - WriteEnvStr_NT: - WriteRegExpandStr HKCU "Environment" ${ENV_NAME} ${ENV_VALUE} - SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} \ - 0 "STR:Environment" /TIMEOUT=5000 - - WriteEnvStr_done: - Pop ${TEMP} - Pop ${ENV_NAME} - Pop ${ENV_VALUE} - - !undef ENV_NAME - !undef ENV_VALUE - !undef TEMP - - !undef DESTN - !undef ENV_FOUND - !undef ENV_SETLEN - !undef ENV_SETNAME - !undef LINE - !undef SOURCE - !undef TEMPFILE - - FunctionEnd - - - #-------------------------------------------------------------------------- - # Installer Function: PFI_WriteEnvNTAU - # - # Writes an environment variable which is available to all users on a modern OS. - # On Win9x systems, AUTOEXEC.BAT is updated and the Reboot flag is set to request a reboot - # to make the new variable available for use. - # - # Inputs: - # (top of stack) - value for the new environment variable - # (top of stack - 1) - name of the new environment variable - # - # Outputs: - # none - # - # Usage: - # Push "HOMEDIR" - # Push "C:\New Home Dir" - # Call PFI_WriteEnvStrNTAU - # - #-------------------------------------------------------------------------- - - Function PFI_WriteEnvStrNTAU - - ; Registers common to Win9x and non-Win9x processing - - !define ENV_NAME $R9 ; name of the environment variable - !define ENV_VALUE $R8 ; value of the environment variable - !define TEMP $R7 - - ; Registers used only for Win9x processing - - !define DESTN $R6 ; used to access the revised AUTOEXEC.BAT file - !define ENV_FOUND $R5 ; 0 = variable not found, 1 = variable found in AUTOEXEC.BAT - !define ENV_SETLEN $R4 ; length of the string in ${ENV_SETNAME} - !define ENV_SETNAME $R3 ; left-hand side of SET command for the variable, incl '=' - !define LINE $R2 ; a line from AUTOEXEC.BAT - !define SOURCE $R1 ; used to access original AUTOEXEC.BAT file - !define TEMPFILE $R0 ; name of file used to build the revised AUTOEXEC.BAT file - - Exch ${ENV_VALUE} - Exch - Exch ${ENV_NAME} - Push ${TEMP} - - Call PFI_IsNT - Pop ${TEMP} - StrCmp ${TEMP} 1 WriteEnvStr_NT - - ; On Win9x system, so we add the new data to AUTOEXEC.BAT if it is not already there - - Push ${DESTN} - Push ${ENV_FOUND} - Push ${ENV_SETLEN} - Push ${ENV_SETNAME} - Push ${LINE} - Push ${SOURCE} - Push ${TEMPFILE} - - StrCpy ${ENV_SETNAME} "SET ${ENV_NAME}=" - StrLen ${ENV_SETLEN} ${ENV_SETNAME} - - StrCpy ${SOURCE} $WINDIR 2 ; Get the drive used for Windows (usually 'C:') - FileOpen ${SOURCE} "${SOURCE}\autoexec.bat" r - GetTempFileName ${TEMPFILE} - FileOpen ${DESTN} ${TEMPFILE} w - - StrCpy ${ENV_FOUND} 0 - - loop: - FileRead ${SOURCE} ${LINE} ; Read line from AUTOEXEC.BAT - StrCmp ${LINE} "" eof_found - Push ${LINE} - Call PFI_TrimNewlines - Pop ${LINE} - StrCmp ${LINE} "" copy_line ; Blank lines are preserved in the copy we make - StrCpy ${TEMP} ${LINE} ${ENV_SETLEN} - StrCmp ${TEMP} ${ENV_SETNAME} 0 copy_line - StrCpy ${ENV_FOUND} 1 ; Have found a match. Now check the value it defines. - StrCpy ${TEMP} ${LINE} "" ${ENV_SETLEN} - StrCmp ${TEMP} ${ENV_VALUE} 0 different_value - ReadEnvStr ${TEMP} ${ENV_NAME} ; Identical value found. Now see if it currently exists. - StrCmp ${TEMP} ${ENV_VALUE} copy_line - SetRebootFlag true ; Value does not exist, so we need to reboot - - copy_line: - FileWrite ${DESTN} "${LINE}${MB_NL}" - Goto loop - - different_value: - FileWrite ${DESTN} "REM ${LINE}${MB_NL}" ; 'Comment out' the incorrect value - FileWrite ${DESTN} "${ENV_SETNAME}${ENV_VALUE}${MB_NL}" - SetRebootFlag true - Goto loop - - eof_found: - StrCmp ${ENV_FOUND} 1 autoexec_done - FileWrite ${DESTN} "${ENV_SETNAME}${ENV_VALUE}${MB_NL}" ; Append line for the new variable - SetRebootFlag true - - autoexec_done: - FileClose ${SOURCE} - FileClose ${DESTN} - - IfRebootFlag 0 win9x_done - StrCpy ${SOURCE} $WINDIR 2 - Delete "${SOURCE}\autoexec.bat" - CopyFiles /SILENT ${TEMPFILE} "${SOURCE}\autoexec.bat" - Delete ${TEMPFILE} - - win9x_done: - Pop ${TEMPFILE} - Pop ${SOURCE} - Pop ${LINE} - Pop ${ENV_SETNAME} - Pop ${ENV_SETLEN} - Pop ${ENV_FOUND} - Pop ${DESTN} - Goto WriteEnvStr_done - - ; More modern OS case (AUTOEXEC.BAT not relevant) - - WriteEnvStr_NT: - WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" \ - ${ENV_NAME} ${ENV_VALUE} - SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} \ - 0 "STR:Environment" /TIMEOUT=5000 - - WriteEnvStr_done: - Pop ${TEMP} - Pop ${ENV_NAME} - Pop ${ENV_VALUE} - - !undef ENV_NAME - !undef ENV_VALUE - !undef TEMP - - !undef DESTN - !undef ENV_FOUND - !undef ENV_SETLEN - !undef ENV_SETNAME - !undef LINE - !undef SOURCE - !undef TEMPFILE - - FunctionEnd - !endif - - !ifndef ADDUSER - #-------------------------------------------------------------------------- # Uninstaller Function: un.PFI_DeleteEnvStr # --- 43,46 ---- *************** *** 517,522 **** # # NOTE: ! # The !insertmacro PFI_IsNT "" and !insertmacro PFI_IsNT "un." commands are included in this file so ! # 'installer.nsi' can use 'Call PFI_IsNT' and 'Call un.PFI_IsNT' without additional preparation. # # Inputs: --- 223,228 ---- # # NOTE: ! # The !insertmacro PFI_IsNT "" and !insertmacro PFI_IsNT "un." commands are included in this file ! # so 'installer.nsi' can use 'Call PFI_IsNT' and 'Call un.PFI_IsNT' without additional preparation. # # Inputs: *************** *** 569,572 **** --- 275,633 ---- !insertmacro PFI_IsNT "un." + + #-------------------------------------------------------------------------- + # Macro: PFI_WriteEnvStr + # + # The installation process and the uninstall process both use a function which + # writes an environment variable which is available to the 'current user' on a + # modern OS. On Win9x systems, AUTOEXEC.BAT is updated and the Reboot flag is set + # to request a reboot to make the new variable available for use. This macro makes + # maintenance easier by ensuring that both processes use identical functions, with + # the only difference being their names. + # + # NOTE: + # The !insertmacro PFI_WriteEnvStr "" and !insertmacro PFI_WriteEnvStr "un." commands + # are included in this file so 'installer.nsi' can use 'Call PFI_WriteEnvStr' and + # 'Call un.PFI_WriteEnvStr' without additional preparation. + # + # Inputs: + # (top of stack) - value for the new environment variable + # (top of stack - 1) - name of the new environment variable + # + # Outputs: + # none + # + # Usage (after macro has been 'inserted'): + # + # Push "HOMEDIR" + # Push "C:\New Home Dir" + # Call PFI_WriteEnvStr + # + #-------------------------------------------------------------------------- + + !macro PFI_WriteEnvStr UN + Function ${UN}PFI_WriteEnvStr + + ; Registers common to Win9x and non-Win9x processing + + !define ENV_NAME $R9 ; name of the environment variable + !define ENV_VALUE $R8 ; value of the environment variable + !define TEMP $R7 + + ; Registers used only for Win9x processing + + !define DESTN $R6 ; used to access the revised AUTOEXEC.BAT file + !define ENV_FOUND $R5 ; 0 = variable not found, 1 = variable found in AUTOEXEC.BAT + !define ENV_SETLEN $R4 ; length of the string in ${ENV_SETNAME} + !define ENV_SETNAME $R3 ; left-hand side of SET command for the variable, incl '=' + !define LINE $R2 ; a line from AUTOEXEC.BAT + !define SOURCE $R1 ; used to access original AUTOEXEC.BAT file + !define TEMPFILE $R0 ; name of file used to build the revised AUTOEXEC.BAT file + + Exch ${ENV_VALUE} + Exch + Exch ${ENV_NAME} + Push ${TEMP} + + Call ${UN}PFI_IsNT + Pop ${TEMP} + StrCmp ${TEMP} 1 WriteEnvStr_NT + + ; On Win9x system, so we add the new data to AUTOEXEC.BAT if it is not already there + + Push ${DESTN} + Push ${ENV_FOUND} + Push ${ENV_SETLEN} + Push ${ENV_SETNAME} + Push ${LINE} + Push ${SOURCE} + Push ${TEMPFILE} + + StrCpy ${ENV_SETNAME} "SET ${ENV_NAME}=" + StrLen ${ENV_SETLEN} ${ENV_SETNAME} + + StrCpy ${SOURCE} $WINDIR 2 ; Get the drive used for Windows (usually 'C:') + FileOpen ${SOURCE} "${SOURCE}\autoexec.bat" r + GetTempFileName ${TEMPFILE} + FileOpen ${DESTN} ${TEMPFILE} w + + StrCpy ${ENV_FOUND} 0 + + loop: + FileRead ${SOURCE} ${LINE} ; Read line from AUTOEXEC.BAT + StrCmp ${LINE} "" eof_found + Push ${LINE} + Call ${UN}PFI_TrimNewlines + Pop ${LINE} + StrCmp ${LINE} "" copy_line ; Blank lines are preserved in the copy we make + StrCpy ${TEMP} ${LINE} ${ENV_SETLEN} + StrCmp ${TEMP} ${ENV_SETNAME} 0 copy_line + StrCpy ${ENV_FOUND} 1 ; Have found a match. Now check the value it defines. + StrCpy ${TEMP} ${LINE} "" ${ENV_SETLEN} + StrCmp ${TEMP} ${ENV_VALUE} 0 different_value + ReadEnvStr ${TEMP} ${ENV_NAME} ; Identical value found. Now see if it currently exists. + StrCmp ${TEMP} ${ENV_VALUE} copy_line + SetRebootFlag true ; Value does not exist, so we need to reboot + + copy_line: + FileWrite ${DESTN} "${LINE}${MB_NL}" + Goto loop + + different_value: + FileWrite ${DESTN} "REM ${LINE}${MB_NL}" ; 'Comment out' the incorrect value + FileWrite ${DESTN} "${ENV_SETNAME}${ENV_VALUE}${MB_NL}" + SetRebootFlag true + Goto loop + + eof_found: + StrCmp ${ENV_FOUND} 1 autoexec_done + FileWrite ${DESTN} "${ENV_SETNAME}${ENV_VALUE}${MB_NL}" ; Append line for the new variable + SetRebootFlag true + + autoexec_done: + FileClose ${SOURCE} + FileClose ${DESTN} + + IfRebootFlag 0 win9x_done + StrCpy ${SOURCE} $WINDIR 2 + Delete "${SOURCE}\autoexec.bat" + CopyFiles /SILENT ${TEMPFILE} "${SOURCE}\autoexec.bat" + Delete ${TEMPFILE} + + win9x_done: + Pop ${TEMPFILE} + Pop ${SOURCE} + Pop ${LINE} + Pop ${ENV_SETNAME} + Pop ${ENV_SETLEN} + Pop ${ENV_FOUND} + Pop ${DESTN} + Goto WriteEnvStr_done + + ; More modern OS case (AUTOEXEC.BAT not relevant) + + WriteEnvStr_NT: + WriteRegExpandStr HKCU "Environment" ${ENV_NAME} ${ENV_VALUE} + SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} \ + 0 "STR:Environment" /TIMEOUT=5000 + + WriteEnvStr_done: + Pop ${TEMP} + Pop ${ENV_NAME} + Pop ${ENV_VALUE} + + !undef ENV_NAME + !undef ENV_VALUE + !undef TEMP + + !undef DESTN + !undef ENV_FOUND + !undef ENV_SETLEN + !undef ENV_SETNAME + !undef LINE + !undef SOURCE + !undef TEMPFILE + + FunctionEnd + !macroend + + !ifndef ADDUSER + + #-------------------------------------------------------------------------- + # Installer Function: PFI_WriteEnvStr + # + # This function is used during the installation process + #-------------------------------------------------------------------------- + + !insertmacro PFI_WriteEnvStr "" + + #-------------------------------------------------------------------------- + # Uninstaller Function: un.PFI_WriteEnvStr + # + # This function is used during the uninstall process + #-------------------------------------------------------------------------- + + !insertmacro PFI_WriteEnvStr "un." + + !endif + + + #-------------------------------------------------------------------------- + # Macro: PFI_WriteEnvStrNTAU + # + # The installation process and the uninstall process both use a function which + # writes an environment variable which is available to all users on a modern OS. + # On Win9x systems, AUTOEXEC.BAT is updated and the Reboot flag is set to request + # a reboot to make the new variable available for use. This macro is used to make + # maintenance easier by ensuring that both processes use identical functions, with + # the only difference being their names. + # + # NOTE: + # The !insertmacro PFI_WriteEnvStrNTAU "" and !insertmacro PFI_WriteEnvStrNTAU "un." + # commands are included in this file so 'installer.nsi' can use 'Call PFI_WriteEnvStrNTAU' + # and 'Call un.PFI_WriteEnvStrNTAU' without additional preparation. + # + # Inputs: + # (top of stack) - value for the new environment variable + # (top of stack - 1) - name of the new environment variable + # + # Outputs: + # none + # + # Usage (after macro has been 'inserted'): + # + # Push "HOMEDIR" + # Push "C:\New Home Dir" + # Call PFI_WriteEnvStrNTAU + # + #-------------------------------------------------------------------------- + + !macro PFI_WriteEnvStrNTAU UN + Function ${UN}PFI_WriteEnvStrNTAU + + ; Registers common to Win9x and non-Win9x processing + + !define ENV_NAME $R9 ; name of the environment variable + !define ENV_VALUE $R8 ; value of the environment variable + !define TEMP $R7 + + ; Registers used only for Win9x processing + + !define DESTN $R6 ; used to access the revised AUTOEXEC.BAT file + !define ENV_FOUND $R5 ; 0 = variable not found, 1 = variable found in AUTOEXEC.BAT + !define ENV_SETLEN $R4 ; length of the string in ${ENV_SETNAME} + !define ENV_SETNAME $R3 ; left-hand side of SET command for the variable, incl '=' + !define LINE $R2 ; a line from AUTOEXEC.BAT + !define SOURCE $R1 ; used to access original AUTOEXEC.BAT file + !define TEMPFILE $R0 ; name of file used to build the revised AUTOEXEC.BAT file + + Exch ${ENV_VALUE} + Exch + Exch ${ENV_NAME} + Push ${TEMP} + + Call ${UN}PFI_IsNT + Pop ${TEMP} + StrCmp ${TEMP} 1 WriteEnvStr_NT + + ; On Win9x system, so we add the new data to AUTOEXEC.BAT if it is not already there + + Push ${DESTN} + Push ${ENV_FOUND} + Push ${ENV_SETLEN} + Push ${ENV_SETNAME} + Push ${LINE} + Push ${SOURCE} + Push ${TEMPFILE} + + StrCpy ${ENV_SETNAME} "SET ${ENV_NAME}=" + StrLen ${ENV_SETLEN} ${ENV_SETNAME} + + StrCpy ${SOURCE} $WINDIR 2 ; Get the drive used for Windows (usually 'C:') + FileOpen ${SOURCE} "${SOURCE}\autoexec.bat" r + GetTempFileName ${TEMPFILE} + FileOpen ${DESTN} ${TEMPFILE} w + + StrCpy ${ENV_FOUND} 0 + + loop: + FileRead ${SOURCE} ${LINE} ; Read line from AUTOEXEC.BAT + StrCmp ${LINE} "" eof_found + Push ${LINE} + Call ${UN}PFI_TrimNewlines + Pop ${LINE} + StrCmp ${LINE} "" copy_line ; Blank lines are preserved in the copy we make + StrCpy ${TEMP} ${LINE} ${ENV_SETLEN} + StrCmp ${TEMP} ${ENV_SETNAME} 0 copy_line + StrCpy ${ENV_FOUND} 1 ; Have found a match. Now check the value it defines. + StrCpy ${TEMP} ${LINE} "" ${ENV_SETLEN} + StrCmp ${TEMP} ${ENV_VALUE} 0 different_value + ReadEnvStr ${TEMP} ${ENV_NAME} ; Identical value found. Now see if it currently exists. + StrCmp ${TEMP} ${ENV_VALUE} copy_line + SetRebootFlag true ; Value does not exist, so we need to reboot + + copy_line: + FileWrite ${DESTN} "${LINE}${MB_NL}" + Goto loop + + different_value: + FileWrite ${DESTN} "REM ${LINE}${MB_NL}" ; 'Comment out' the incorrect value + FileWrite ${DESTN} "${ENV_SETNAME}${ENV_VALUE}${MB_NL}" + SetRebootFlag true + Goto loop + + eof_found: + StrCmp ${ENV_FOUND} 1 autoexec_done + FileWrite ${DESTN} "${ENV_SETNAME}${ENV_VALUE}${MB_NL}" ; Append line for the new variable + SetRebootFlag true + + autoexec_done: + FileClose ${SOURCE} + FileClose ${DESTN} + + IfRebootFlag 0 win9x_done + StrCpy ${SOURCE} $WINDIR 2 + Delete "${SOURCE}\autoexec.bat" + CopyFiles /SILENT ${TEMPFILE} "${SOURCE}\autoexec.bat" + Delete ${TEMPFILE} + + win9x_done: + Pop ${TEMPFILE} + Pop ${SOURCE} + Pop ${LINE} + Pop ${ENV_SETNAME} + Pop ${ENV_SETLEN} + Pop ${ENV_FOUND} + Pop ${DESTN} + Goto WriteEnvStr_done + + ; More modern OS case (AUTOEXEC.BAT not relevant) + + WriteEnvStr_NT: + WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" \ + ${ENV_NAME} ${ENV_VALUE} + SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} \ + 0 "STR:Environment" /TIMEOUT=5000 + + WriteEnvStr_done: + Pop ${TEMP} + Pop ${ENV_NAME} + Pop ${ENV_VALUE} + + !undef ENV_NAME + !undef ENV_VALUE + !undef TEMP + + !undef DESTN + !undef ENV_FOUND + !undef ENV_SETLEN + !undef ENV_SETNAME + !undef LINE + !undef SOURCE + !undef TEMPFILE + + FunctionEnd + !macroend + + !ifndef ADDUSER + + #-------------------------------------------------------------------------- + # Installer Function: PFI_WriteEnvStrNTAU + # + # This function is used during the installation process + #-------------------------------------------------------------------------- + + !insertmacro PFI_WriteEnvStrNTAU "" + + #-------------------------------------------------------------------------- + # Uninstaller Function: un.PFI_WriteEnvStrNTAU + # + # This function is used during the uninstall process + #-------------------------------------------------------------------------- + + !insertmacro PFI_WriteEnvStrNTAU "un." + + !endif + #-------------------------------------------------------------------------- # End of 'WriteEnvStr.nsh' Index: installer-Uninstall.nsh =================================================================== RCS file: /cvsroot/popfile/windows/installer-Uninstall.nsh,v retrieving revision 1.4.2.10 retrieving revision 1.4.2.11 diff -C2 -d -r1.4.2.10 -r1.4.2.11 *** installer-Uninstall.nsh 5 Oct 2007 18:36:52 -0000 1.4.2.10 --- installer-Uninstall.nsh 14 Oct 2007 17:19:41 -0000 1.4.2.11 *************** *** 50,53 **** --- 50,60 ---- ##################################################################################### + #-------------------------------------------------------------------------- + # User Registers (Global) + #-------------------------------------------------------------------------- + + ; This script uses 'User Variables' (with names starting with 'G_') to hold GLOBAL data. + + Var G_UNINST_MODE ; Uninstaller mode ("change" or "uninstall") #-------------------------------------------------------------------------- *************** *** 100,107 **** Call un.SetGlobalUserVariables FunctionEnd #-------------------------------------------------------------------------- ! # Installer Function: un.OnUninstFailed (required by UAC plugin) #-------------------------------------------------------------------------- --- 107,117 ---- Call un.SetGlobalUserVariables + !insertmacro MUI_INSTALLOPTIONS_EXTRACT "ioP.ini" + !insertmacro MUI_INSTALLOPTIONS_EXTRACT "ioUM.ini" + FunctionEnd #-------------------------------------------------------------------------- ! # Uninstaller Function: un.OnUninstFailed (required by UAC plugin) #-------------------------------------------------------------------------- *************** *** 113,117 **** #-------------------------------------------------------------------------- ! # Installer Function: un.OnUninstSuccess (required by UAC plugin) #-------------------------------------------------------------------------- --- 123,127 ---- #-------------------------------------------------------------------------- ! # Uninstaller Function: un.OnUninstSuccess (required by UAC plugin) #-------------------------------------------------------------------------- *************** *** 123,127 **** #-------------------------------------------------------------------------- ! # Uninstaller Sections (this build uses all of these and executes them in the order shown) # # (1) un.Uninstall Begin - requests confirmation if appropriate --- 133,374 ---- #-------------------------------------------------------------------------- ! # Uninstaller Function: un.PFIGUIInit ! # (custom un.onGUIInit function) ! # ! # Used to complete the initialization of the installer. ! # This code was moved from '.onInit' in order to permit the use of language-specific strings ! # (the selected language is not available inside the '.onInit' function) ! #-------------------------------------------------------------------------- ! ! Function un.PFIGUIInit ! ! !define L_RESERVED $1 ; used in the system.dll call ! ! !define L_OPTIONLIST $R9 ! !define L_PARAMETER $R8 ! ! Push ${L_RESERVED} ! Push ${L_OPTIONLIST} ! Push ${L_PARAMETER} ! ! ; Ensure only one copy of this installer is running ! ! System::Call 'kernel32::CreateMutexA(i 0, i 0, t "OnlyOnePFI_mutex") i .r1 ?e' ! Pop ${L_RESERVED} ! StrCmp ${L_RESERVED} 0 mutex_ok ! MessageBox MB_OK|MB_ICONEXCLAMATION "$(PFI_LANG_INSTALLER_MUTEX)" ! Abort ! ! mutex_ok: ! ! ; If 'Nihongo' (Japanese) language has been selected for the installer, ensure the ! ; 'Nihongo Parser' entry is shown on the COMPONENTS page to confirm that a parser will ! ; be installed. The "Nihongo Parser Selection" page appears immediately before the ! ; COMPONENTS page. ! ! Call un.ShowOrHideNihongoParser ! ! ; If the mode option has been supplied on the command-line ! ; preset the appropriate radiobutton, otherwise deselect both. ! ; ! ; The UAC plugin may modify the command-line so we need to ! ; check for the option anywhere on the command-line (instead ! ; of assuming the command-line is empty or only contains ! ; the /MODIFY or /UNINSTALL option) ! ! Call un.PFI_GetParameters ! Pop ${L_OPTIONLIST} ! ! Push ${L_OPTIONLIST} ! Push "/UNINSTALL" ! Call un.PFI_StrStr ! Pop ${L_PARAMETER} ! StrCmp ${L_PARAMETER} "" try_modify ! StrCpy ${L_PARAMETER} ${L_PARAMETER} 11 ! StrCmp ${L_PARAMETER} "/UNINSTALL" uninstall_mode ! StrCmp ${L_PARAMETER} "/UNINSTALL " uninstall_mode ! ! try_modify: ! Push ${L_OPTIONLIST} ! Push "/MODIFY" ! Call un.PFI_StrStr ! Pop ${L_PARAMETER} ! StrCmp ${L_PARAMETER} "" undefined_mode ! StrCpy ${L_PARAMETER} ${L_PARAMETER} 8 ! StrCmp ${L_PARAMETER} "/MODIFY" modify_mode ! StrCmp ${L_PARAMETER} "/MODIFY " modify_mode ! ! undefined_mode: ! !insertmacro MUI_INSTALLOPTIONS_WRITE "ioUM.ini" "Field 1" "State" 0 ! !insertmacro MUI_INSTALLOPTIONS_WRITE "ioUM.ini" "Field 2" "State" 0 ! Goto insert_lang_strings ! ! modify_mode: ! !insertmacro MUI_INSTALLOPTIONS_WRITE "ioUM.ini" "Field 1" "State" 1 ! !insertmacro MUI_INSTALLOPTIONS_WRITE "ioUM.ini" "Field 2" "State" 0 ! Goto insert_lang_strings ! ! uninstall_mode: ! !insertmacro MUI_INSTALLOPTIONS_WRITE "ioUM.ini" "Field 1" "State" 0 ! !insertmacro MUI_INSTALLOPTIONS_WRITE "ioUM.ini" "Field 2" "State" 1 ! ! insert_lang_strings: ! ! ; Insert appropriate language strings into the custom page's INI file ! ! Call un.SelectMode_Init ! ! Pop ${L_PARAMETER} ! Pop ${L_OPTIONLIST} ! ! Pop ${L_RESERVED} ! ! !undef L_OPTIONLIST ! !undef L_PARAMETER ! ! !undef L_RESERVED ! ! FunctionEnd ! ! #-------------------------------------------------------------------------- ! # Uninstaller Function: un.SelectMode_Init ! # ! # This function adds language texts to the INI file for the custom page used ! # to select the uninstaller mode (to make the custom page use the language ! # selected by the user for the installer) ! #-------------------------------------------------------------------------- ! ! Function un.SelectMode_Init ! ! ; Ensure custom page matches the selected language (left-to-right or right-to-left order) ! ! !insertmacro MUI_INSTALLOPTIONS_WRITE "ioUM.ini" "Settings" "RTL" "$(^RTL)" ! ! ; Identify and describe the two radio buttons used to select the uninstaller mode ! ! !insertmacro PFI_IO_TEXT "ioUM.ini" "1" "$(PFI_LANG_UN_IO_MODE_RADIO)" ! !insertmacro PFI_IO_TEXT "ioUM.ini" "3" "$(PFI_LANG_UN_IO_MODE_LABEL)" ! ! !insertmacro PFI_IO_TEXT "ioUM.ini" "2" "$(PFI_LANG_UN_IO_UNINST_RADIO)" ! !insertmacro PFI_IO_TEXT "ioUM.ini" "4" "$(PFI_LANG_UN_IO_UNINST_LABEL)" ! ! FunctionEnd ! ! ! #-------------------------------------------------------------------------- ! # Uninstaller Function: un.SelectMode ! # ! # Starting with the 1.0.0 release the POPFile uninstaller offers two modes: ! # (1) Change the existing installation (add SSL Support, change the Nihongo parser) ! # (2) Uninstall the POPFile program ! #-------------------------------------------------------------------------- ! ! Function un.SelectMode ! ! !define L_RESULT $R9 ! ! Push ${L_RESULT} ! ! ; Ensure custom page matches the selected language (left-to-right or right-to-left order) ! ! !insertmacro MUI_INSTALLOPTIONS_WRITE "ioUM.ini" "Settings" "RTL" "$(^RTL)" ! ! !insertmacro MUI_HEADER_TEXT "$(PFI_LANG_UN_MODE_TITLE)" "$(PFI_LANG_UN_MODE_SUBTITLE)" ! ! loop: ! !insertmacro MUI_INSTALLOPTIONS_DISPLAY_RETURN "ioUM.ini" ! Pop ${L_RESULT} ! StrCmp ${L_RESULT} "success" check_selection ! Abort ! ! check_selection: ! !insertmacro MUI_INSTALLOPTIONS_READ "$G_UNINST_MODE " "ioUM.ini" "Field 1" "State" ! StrCmp $G_UNINST_MODE 0 try_other_button ! StrCpy $G_UNINST_MODE "change" ! Goto exit ! ! try_other_button: ! !insertmacro MUI_INSTALLOPTIONS_READ "$G_UNINST_MODE " "ioUM.ini" "Field 2" "State" ! StrCmp $G_UNINST_MODE 0 loop ! StrCpy $G_UNINST_MODE "uninstall" ! ! exit: ! Pop ${L_RESULT} ! ! !undef L_RESULT ! ! FunctionEnd ! ! #-------------------------------------------------------------------------- ! # Uninstaller Function: un.ComponentsCheckModeFlag ! # ! # The "pre" function for the uninstaller's COMPONENTS page ! # which is only shown when modifying the existing installation ! #-------------------------------------------------------------------------- ! ! Function un.ComponentsCheckModeFlag ! ! StrCmp $G_UNINST_MODE "change" exit ! StrCmp $G_UNINST_MODE "uninstall" skip_page ! MessageBox MB_OK "Internal Error: unexpected mode ($G_UNINST_MODE)" ! ! skip_page: ! Abort ! ! exit: ! FunctionEnd ! ! #-------------------------------------------------------------------------- ! # Uninstaller Function: un.DirectoryCheckModeFlag ! # ! # The "pre" function for the uninstaller's DIRECTORY page ! # which is only shown when modifying the existing installation ! #-------------------------------------------------------------------------- ! ! Function un.DirectoryCheckModeFlag ! ! StrCmp $G_UNINST_MODE "change" exit ! Abort ! ! exit: ! FunctionEnd ! ! #-------------------------------------------------------------------------- ! # Uninstaller Function: un.UninstallCheckModeFlag ! # ! # The "pre" function for the uninstaller's confirmation page ! # which is only shown when uninstalling the POPFile program ! #-------------------------------------------------------------------------- ! ! Function un.UninstallCheckModeFlag ! ! StrCmp $G_UNINST_MODE "uninstall" exit ! StrCmp $G_UNINST_MODE "change" skip_page ! MessageBox MB_OK "Internal Error: unexpected mode ($G_UNINST_MODE)" ! ! skip_page: ! Abort ! ! exit: ! FunctionEnd ! ! #-------------------------------------------------------------------------- ! # Sections used to modify an existing installation (executed in the order shown) ! # ! # (0) Custom Page (SelectMode) offering "Modify" or "Uninstall" options ! # ! # (1) un.Uninstall Begin - requests confirmation if appropriate ! # (2) un.Shutdown POPFile - shutdown POPFile if necessary (to avoid the need to reboot) ! # (3) un.AddSSLSupport - downloads and installs the SSL support files ! # (4) un.Nihongo Parser - offers a choice of 3 parsers (Kakasi, MeCab and internal) ! # (5) un.Kakasi - installs Kakasi package and creates its environment variables ! # (6) un.MeCab - downloads and installs MeCab package and its environment variables ! # (7) un.Internal - installs support for the internal parser ! # ! # Note: Only one of the three Nihongo parsers can be added at a time (re-run to add more) ! #-------------------------------------------------------------------------- ! # Sections used to uninstall POPFile (executed in the order shown) ! # ! # (0) Custom Page (SelectMode) offering "Modify" or "Uninstall" options # # (1) un.Uninstall Begin - requests confirmation if appropriate *************** *** 133,140 **** # (7) un.Languages - uninstall POPFile UI languages # (8) un.QuickStart Guide - uninstall POPFile English QuickStart Guide ! # (9) un.Kakasi - uninstall Kakasi package and remove its environment variables ! # (10) un.Minimal Perl - uninstall minimal Perl, including all of the optional modules ! # (11) un.Registry Entries - remove 'Add/Remove Program' data and other registry entries ! # (12) un.Uninstall End - remove remaining files/folders (if it is safe to do so) # #-------------------------------------------------------------------------- --- 380,388 ---- # (7) un.Languages - uninstall POPFile UI languages # (8) un.QuickStart Guide - uninstall POPFile English QuickStart Guide ! # (9) un.Remove Kakasi - uninstall Kakasi package and remove its environment variables ! # (10) un.Remove MeCab - uninstall MeCab package and remove its environment variables ! # (11) un.Minimal Perl - uninstall minimal Perl, including all of the optional modules ! # (12) un.Registry Entries - remove 'Add/Remove Program' data and other registry entries ! # (13) un.Uninstall End - remove remaining files/folders (if it is safe to do so) # #-------------------------------------------------------------------------- *************** *** 144,148 **** #-------------------------------------------------------------------------- ! Section "un.Uninstall Begin" UnSecBegin !define L_TEMP $R9 --- 392,396 ---- #-------------------------------------------------------------------------- ! Section "-un.Uninstall Begin" UnSecBegin !define L_TEMP $R9 *************** *** 170,174 **** #-------------------------------------------------------------------------- ! Section "un.Local User Data" UnSecUserData !define L_RESULT $R9 --- 418,424 ---- #-------------------------------------------------------------------------- ! Section "-un.Local User Data" UnSecUserData ! ! StrCmp $G_UNINST_MODE "change" skip_section !define L_RESULT $R9 *************** *** 221,224 **** --- 471,475 ---- !undef L_RESULT + skip_section: SectionEnd *************** *** 227,231 **** #-------------------------------------------------------------------------- ! Section "un.Shutdown POPFile" UnSecShutdown !define L_TEMP $R9 --- 478,482 ---- #-------------------------------------------------------------------------- ! Section "-un.Shutdown POPFile" UnSecShutdown !define L_TEMP $R9 *************** *** 278,285 **** #-------------------------------------------------------------------------- # Uninstaller Section: 'un.Start Menu Entries' #-------------------------------------------------------------------------- ! Section "un.Start Menu Entries" UnSecStartMenu !define L_TEMP $R9 --- 529,579 ---- #-------------------------------------------------------------------------- + # Uninstaller Section: 'un.SecSSL' + #-------------------------------------------------------------------------- + + !insertmacro HANDLE_ADDING_SSL_SUPPORT + + #-------------------------------------------------------------------------- + # Uninstaller Section: 'un.Nihongo Parser' + #-------------------------------------------------------------------------- + + !insertmacro SECTION_NIHONGO_PARSER "un." + + #-------------------------------------------------------------------------- + # Uninstaller Section: 'un.Kakasi' + #-------------------------------------------------------------------------- + + !insertmacro SECTION_KAKASI "un." + + #-------------------------------------------------------------------------- + # Uninstaller Section: 'un.MeCab' + #-------------------------------------------------------------------------- + + !insertmacro SECTION_MECAB "un." + + #-------------------------------------------------------------------------- + # Uninstaller Function: un.GetMeCabFile + # + # Inputs: + # (top of stack) - full URL used to download the MeCab file + # Outputs: + # (top of stack) - status returned by the download plugin + #-------------------------------------------------------------------------- + + !insertmacro FUNCTION_GETMECABFILE "un." + + #-------------------------------------------------------------------------- + # Uninstaller Section: 'un.Internal' + #-------------------------------------------------------------------------- + + !insertmacro SECTION_INTERNALPARSER "un." + + #-------------------------------------------------------------------------- # Uninstaller Section: 'un.Start Menu Entries' #-------------------------------------------------------------------------- ! Section "-un.Start Menu Entries" UnSecStartMenu ! ! StrCmp $G_UNINST_MODE "change" skip_section !define L_TEMP $R9 *************** *** 339,342 **** --- 633,637 ---- !undef L_TEMP + skip_section: SectionEnd *************** *** 350,354 **** #-------------------------------------------------------------------------- ! Section "un.POPFile Core" UnSecCore SetDetailsPrint textonly --- 645,651 ---- #-------------------------------------------------------------------------- ! Section "-un.POPFile Core" UnSecCore ! ! StrCmp $G_UNINST_MODE "change" skip_section SetDetailsPrint textonly *************** *** 438,441 **** --- 735,739 ---- SetDetailsPrint listonly + skip_section: SectionEnd *************** *** 444,448 **** #-------------------------------------------------------------------------- ! Section "un.Skins" UnSecSkins SetDetailsPrint textonly --- 742,748 ---- #-------------------------------------------------------------------------- ! Section "-un.Skins" UnSecSkins ! ! StrCmp $G_UNINST_MODE "change" skip_section SetDetailsPrint textonly *************** *** 486,489 **** --- 786,790 ---- SetDetailsPrint listonly + skip_section: SectionEnd *************** *** 492,496 **** #-------------------------------------------------------------------------- ! Section "un.Languages" UnSecLangs SetDetailsPrint textonly --- 793,799 ... [truncated message content] |