|
From: <xue...@us...> - 2003-06-12 17:12:17
|
Update of /cvsroot/popfile/windows
In directory sc8-pr-cvs1:/tmp/cvs-serv32698
Modified Files:
installer.nsi
Log Message:
Uninstaller now shuts down POPFile before uninstalling it.
Index: installer.nsi
===================================================================
RCS file: /cvsroot/popfile/windows/installer.nsi,v
retrieving revision 1.59
retrieving revision 1.60
diff -C2 -d -r1.59 -r1.60
*** installer.nsi 12 Jun 2003 15:04:48 -0000 1.59
--- installer.nsi 12 Jun 2003 17:12:13 -0000 1.60
***************
*** 148,151 ****
--- 148,152 ----
OutFile "setup.exe"
+
; Ensure CRC checking cannot be turned off using the command-line switch
***************
*** 629,633 ****
Pop ${L_OLDUI}
! ; Save the UI port settings found in popfile.cfg for later use by the 'MakeItSafe' function
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioA.ini" "UI Port" "NewStyle" "${GUI}"
--- 630,634 ----
Pop ${L_OLDUI}
! ; Save the UI port settings (from popfile.cfg) for later use by the 'MakeItSafe' function
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioA.ini" "UI Port" "NewStyle" "${GUI}"
***************
*** 1313,1320 ****
#--------------------------------------------------------------------------
! # Installer Function: StrCheckDecimal
#
! # Checks that a given string contains only the digits 0 to 9.
! # (if string contains any invalid characters, "" is returned)
#
# Inputs:
--- 1314,1325 ----
#--------------------------------------------------------------------------
! # Macro: StrCheckDecimal
#
! # The installation process and the uninstall process both use a function which checks if
! # a given string contains a decimal number. This macro makes maintenance easier by ensuring
! # that both processes use identical functions, with the only difference being their names.
! #
! # The 'StrCheckDecimal' and 'un.StrCheckDecimal' functions check that a given string contains
! # only the digits 0 to 9. (if the string contains any invalid characters, "" is returned)
#
# Inputs:
***************
*** 1331,1378 ****
#
#--------------------------------------------------------------------------
! Function StrCheckDecimal
! !define DECIMAL_DIGIT "0123456789"
! Exch $0 ; The input string
! Push $1 ; Holds the result: either "" (if input is invalid) or the input string (if valid)
! Push $2 ; A character from the input string
! Push $3 ; The offset to a character in the "validity check" string
! Push $4 ; A character from the "validity check" string
! Push $5 ; Holds the current "validity check" string
! StrCpy $1 ""
! next_input_char:
! StrCpy $2 $0 1 ; Get the next character from the input string
! StrCmp $2 "" done
! StrCpy $5 ${DECIMAL_DIGIT}$2 ; Add it to end of "validity check" to guarantee a match
! StrCpy $0 $0 "" 1
! StrCpy $3 -1
! next_valid_char:
! IntOp $3 $3 + 1
! StrCpy $4 $5 1 $3 ; Extract next "valid" character (from "validity check" string)
! StrCmp $2 $4 0 next_valid_char
! IntCmp $3 10 invalid 0 invalid ; If match is with the char we added, input string is bad
! StrCpy $1 $1$4 ; Add "valid" character to the result
! goto next_input_char
! invalid:
! StrCpy $1 ""
! done:
! StrCpy $0 $1 ; Result is either a string of decimal digits or ""
! Pop $5
! Pop $4
! Pop $3
! Pop $2
! Pop $1
! Exch $0 ; place result on top of the stack
! !undef DECIMAL_DIGIT
! FunctionEnd
#--------------------------------------------------------------------------
--- 1336,1400 ----
#
#--------------------------------------------------------------------------
+ !macro StrCheckDecimal UN
+ Function ${UN}StrCheckDecimal
! !define DECIMAL_DIGIT "0123456789"
! Exch $0 ; The input string
! Push $1 ; Holds the result: either "" (if input is invalid) or the input string (if valid)
! Push $2 ; A character from the input string
! Push $3 ; The offset to a character in the "validity check" string
! Push $4 ; A character from the "validity check" string
! Push $5 ; Holds the current "validity check" string
! StrCpy $1 ""
! next_input_char:
! StrCpy $2 $0 1 ; Get the next character from the input string
! StrCmp $2 "" done
! StrCpy $5 ${DECIMAL_DIGIT}$2 ; Add it to end of "validity check" to guarantee a match
! StrCpy $0 $0 "" 1
! StrCpy $3 -1
! next_valid_char:
! IntOp $3 $3 + 1
! StrCpy $4 $5 1 $3 ; Extract next "valid" character (from "validity check" string)
! StrCmp $2 $4 0 next_valid_char
! IntCmp $3 10 invalid 0 invalid ; If match is with the char we added, input string is bad
! StrCpy $1 $1$4 ; Add "valid" character to the result
! goto next_input_char
! invalid:
! StrCpy $1 ""
! done:
! StrCpy $0 $1 ; Result is either a string of decimal digits or ""
! Pop $5
! Pop $4
! Pop $3
! Pop $2
! Pop $1
! Exch $0 ; place result on top of the stack
! !undef DECIMAL_DIGIT
! FunctionEnd
! !macroend
! #--------------------------------------------------------------------------
! # Installer Function: StrCheckDecimal
! #
! # This function is used during the installation process
! #--------------------------------------------------------------------------
!
! !insertmacro StrCheckDecimal ""
!
! #--------------------------------------------------------------------------
! # Uninstaller Function: un.StrCheckDecimal
! #
! # This function is used during the uninstall process
! #--------------------------------------------------------------------------
!
! !insertmacro StrCheckDecimal "un."
#--------------------------------------------------------------------------
***************
*** 1422,1426 ****
#--------------------------------------------------------------------------
! # Uninstaller Function: unTrimNewlines
#
# This function is used during the uninstall process
--- 1444,1448 ----
#--------------------------------------------------------------------------
! # Uninstaller Function: un.TrimNewlines
#
# This function is used during the uninstall process
***************
*** 1435,1438 ****
--- 1457,1466 ----
Section "Uninstall"
+ !define L_LNE $R4
+ !define L_REG_KEY $R5
+ !define L_REG_SUBKEY $R6
+ !define L_REG_VALUE $R7
+ !define L_TEMP $R8
+
IfFileExists $INSTDIR\popfile.pl skip_confirmation
MessageBox MB_YESNO "It does not appear that POPFile is installed in the \
***************
*** 1441,1444 ****
--- 1469,1502 ----
skip_confirmation:
+ ; Shutdown POPFile before uninstalling it
+
+ ClearErrors
+
+ FileOpen ${CFG} $INSTDIR\popfile.cfg r
+
+ loop:
+ FileRead ${CFG} ${L_LNE}
+ IfErrors done
+
+ StrCpy ${L_TEMP} ${L_LNE} 10
+ StrCmp ${L_TEMP} "html_port " got_html_port
+ Goto loop
+
+ got_html_port:
+ StrCpy ${GUI} ${L_LNE} 5 10
+ Goto loop
+
+ done:
+ FileClose ${CFG}
+
+ Push ${GUI}
+ Call un.TrimNewlines
+ Call un.StrCheckDecimal
+ Pop ${GUI}
+ StrCmp ${GUI} "" skip_shutdown
+ NSISdl::download_quiet http://127.0.0.1:${GUI}/shutdown "$PLUGINSDIR\shutdown.htm"
+ Pop ${L_TEMP}
+
+ skip_shutdown:
Delete $SMPROGRAMS\POPFile\Support\*.url
RMDir $SMPROGRAMS\POPFile\Support
***************
*** 1464,1483 ****
IfErrors skip_registry_restore
restore_loop:
! FileRead ${CFG} $R5
! Push $R5
Call un.TrimNewlines
! Pop $R5
IfErrors skip_registry_restore
! FileRead ${CFG} $R6
! Push $R6
Call un.TrimNewlines
! Pop $R6
IfErrors skip_registry_restore
! FileRead ${CFG} $R7
! Push $R7
Call un.TrimNewlines
! Pop $R7
IfErrors skip_registry_restore
! WriteRegStr HKCU $R5 $R6 $R7
goto restore_loop
--- 1522,1541 ----
IfErrors skip_registry_restore
restore_loop:
! FileRead ${CFG} ${L_REG_KEY}
! Push ${L_REG_KEY}
Call un.TrimNewlines
! Pop ${L_REG_KEY}
IfErrors skip_registry_restore
! FileRead ${CFG} ${L_REG_SUBKEY}
! Push ${L_REG_SUBKEY}
Call un.TrimNewlines
! Pop ${L_REG_SUBKEY}
IfErrors skip_registry_restore
! FileRead ${CFG} ${L_REG_VALUE}
! Push ${L_REG_VALUE}
Call un.TrimNewlines
! Pop ${L_REG_VALUE}
IfErrors skip_registry_restore
! WriteRegStr HKCU ${L_REG_KEY} ${L_REG_SUBKEY} ${L_REG_VALUE}
goto restore_loop
***************
*** 1558,1562 ****
MessageBox MB_YESNO|MB_ICONQUESTION \
"Do you want to remove all files in your POPFile directory? (If you have anything \
! you created that you want to keep, click No)" IDNO Removed
Delete $INSTDIR\*.* ; this would be skipped if the user hits no
RMDir /r $INSTDIR
--- 1616,1620 ----
MessageBox MB_YESNO|MB_ICONQUESTION \
"Do you want to remove all files in your POPFile directory? (If you have anything \
! you created that you want to keep, click No)" IDNO Removed
Delete $INSTDIR\*.* ; this would be skipped if the user hits no
RMDir /r $INSTDIR
***************
*** 1566,1569 ****
--- 1624,1632 ----
Removed:
+ !undef L_LNE
+ !undef L_REG_KEY
+ !undef L_REG_SUBKEY
+ !undef L_REG_VALUE
+ !undef L_TEMP
SectionEnd
|