Skip to content

Commit

Permalink
The installer will show unsuccessful finish page when install fails.
Browse files Browse the repository at this point in the history
  • Loading branch information
hsluoyz committed Dec 9, 2016
1 parent 992e1bc commit 949f5ca
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions installer/Npcap-for-nmap.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ Var /GLOBAL sign_mode
Var /GLOBAL no_confirm
Var /GLOBAL err_flag
Var /GLOBAL cur_system_folder
Var /GLOBAL install_ok

Var /GLOBAL restore_point_success
Var /GLOBAL has_wlan_card
Expand Down Expand Up @@ -1098,6 +1099,7 @@ ${!defineifexist} SHA2_CERT_EXISTS "C:\Insecure-SHA2.cer"
DetailPrint "Failed to create the npcap service for Win7, Win8 and Win10"
${IfNot} ${Silent}
MessageBox MB_OK "Failed to create the npcap service for Win7, Win8 and Win10. Please try installing Npcap again, or use the official Npcap installer from https://github.com/nmap/npcap/releases"
StrCpy $install_ok "no"
${EndIf}
${EndIf}

Expand All @@ -1114,11 +1116,12 @@ ${!defineifexist} SHA2_CERT_EXISTS "C:\Insecure-SHA2.cer"

; check the driver install result
${If} $0 == "0"
DetailPrint "The npcap2 service for Win7, Win8 and Win10 was successfully created"
DetailPrint "The npf service for Win7, Win8 and Win10 was successfully created"
${Else}
DetailPrint "Failed to create the npcap2 service for Win7, Win8 and Win10"
DetailPrint "Failed to create the npf service for Win7, Win8 and Win10"
${IfNot} ${Silent}
MessageBox MB_OK "Failed to create the npcap2 service for Win7, Win8 and Win10. Please try installing Npcap again, or use the official Npcap installer from https://github.com/nmap/npcap/releases"
MessageBox MB_OK "Failed to create the npf service for Win7, Win8 and Win10. Please try installing Npcap again, or use the official Npcap installer from https://github.com/nmap/npcap/releases"
StrCpy $install_ok "no"
${EndIf}
${EndIf}
${EndIf}
Expand All @@ -1136,6 +1139,7 @@ Function un.uninstall_win7_XXbit_driver
DetailPrint "The npcap service for Win7, Win8 and Win10 was successfully deleted"
${Else}
DetailPrint "Failed to delete the npcap service for Win7, Win8 and Win10"
StrCpy $install_ok "no"
${EndIf}

${If} $winpcap_mode == "yes"
Expand All @@ -1147,9 +1151,10 @@ Function un.uninstall_win7_XXbit_driver

; check the driver uninstall result
${If} $0 == "0"
DetailPrint "The npcap2 service for Win7, Win8 and Win10 was successfully deleted"
DetailPrint "The npf service for Win7, Win8 and Win10 was successfully deleted"
${Else}
DetailPrint "Failed to delete the npcap2 service for Win7, Win8 and Win10"
DetailPrint "Failed to delete the npf service for Win7, Win8 and Win10"
StrCpy $install_ok "no"
${EndIf}
${EndIf}
FunctionEnd
Expand Down Expand Up @@ -1437,7 +1442,8 @@ FunctionEnd */

;--------------------------------
; The stuff to install
Section "WinPcap" SecWinPcap
Section "WinPcap" SecWinPcap
StrCpy $install_ok "yes"
; stop the service, in case it's still registered, so files can be
; safely overwritten and the service can be deleted.
Call stop_driver_service
Expand Down Expand Up @@ -1466,6 +1472,7 @@ Section "WinPcap" SecWinPcap
Call uninstallWinPcap
${If} $R0 == "false"
DetailPrint "Error occured when uninstalling WinPcap, Npcap installation quits"
StrCpy $install_ok "no"
Goto install_fail
${EndIf}
${EndIf}
Expand Down Expand Up @@ -1643,13 +1650,18 @@ install_fail:
DetailPrint "Error occured when finishing setting system restore point, return value=|$0|"
${EndIf}
${EndIf}

${If} $install_ok == "no"
Abort
${EndIf}
SectionEnd ; end the section


;--------------------------------
;Uninstaller Section

Section "Uninstall"
StrCpy $install_ok "yes"
; Delete the system restore point, disabled for now.
; This is because not many softwares delete restore points, this job should be done by users themselves.
; DetailPrint "Delete system restore point: ${RESTORE_POINT_NAME_INSTALL}"
Expand Down Expand Up @@ -1888,5 +1900,8 @@ Section "Uninstall"
uninstall_fail:
Abort
uninstall_ok:
${If} $install_ok == "no"
Abort
${EndIf}

SectionEnd

0 comments on commit 949f5ca

Please sign in to comment.