Skip to content

Commit

Permalink
Added "/no_kill" option to uninstaller, if it's set to "yes", uninsta…
Browse files Browse the repository at this point in the history
…ller in Silent mode will abort if any applications are still in use of Npcap.
  • Loading branch information
hsluoyz committed Dec 10, 2016
1 parent 71c26ca commit e3e0a99
Showing 1 changed file with 37 additions and 9 deletions.
46 changes: 37 additions & 9 deletions installer/Npcap-for-nmap.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ Var /GLOBAL sha2_signed
Var /GLOBAL cmd_line
Var /GLOBAL service_name

; Installer options:
Var /GLOBAL npf_startup
Var /GLOBAL loopback_support
Var /GLOBAL dlt_null
Expand All @@ -71,7 +72,11 @@ Var /GLOBAL vlan_support
Var /GLOBAL winpcap_mode
Var /GLOBAL sign_mode

; Uninstaller options:
Var /GLOBAL no_confirm
Var /GLOBAL no_kill

; For internal use:
Var /GLOBAL err_flag
Var /GLOBAL cur_system_folder
Var /GLOBAL install_ok
Expand Down Expand Up @@ -323,7 +328,8 @@ FunctionEnd

Function un.getInstallOptions
StrCpy $no_confirm "no"

StrCpy $no_kill "no"

${GetParameters} $cmd_line ; An example: $cmd_line = '/Q'

${GetOptions} $cmd_line "/Q" $R0
Expand All @@ -332,6 +338,12 @@ Function un.getInstallOptions
${Else}
StrCpy $no_confirm "yes"
${EndIf}

${GetOptions} $cmd_line "/no_kill=" $R0
${If} $R0 S== "yes"
${OrIf} $R0 S== "no"
StrCpy $no_kill $R0
${EndIf}
FunctionEnd

; This function is called on startup. IfSilent checks
Expand Down Expand Up @@ -1779,8 +1791,12 @@ Section "Uninstall"
ExecWait '"$INSTDIR\NPFInstall.exe" -n -kill_proc' $0
Goto terminate_back_1
${Else}
ExecWait '"$INSTDIR\NPFInstall.exe" -n -kill_proc_polite' $0
ExecWait '"$INSTDIR\NPFInstall.exe" -n -d' $0
${If} $no_kill == "no"
ExecWait '"$INSTDIR\NPFInstall.exe" -n -kill_proc_polite' $0
ExecWait '"$INSTDIR\NPFInstall.exe" -n -d' $0
${Else}
Goto uninstall_fail
${EndIf}
${EndIf}
${EndIf}
${EndIf}
Expand Down Expand Up @@ -1810,8 +1826,12 @@ Section "Uninstall"
ExecWait '"$INSTDIR\NPFInstall.exe" -n -kill_proc' $0
Goto terminate_back_2
${Else}
ExecWait '"$INSTDIR\NPFInstall.exe" -n -kill_proc_polite' $0
Call un.remove_win7_XXbit_system_dlls
${If} $no_kill == "no"
ExecWait '"$INSTDIR\NPFInstall.exe" -n -kill_proc_polite' $0
Call un.remove_win7_XXbit_system_dlls
${Else}
Goto uninstall_fail
${EndIf}
${EndIf}
${EndIf}

Expand All @@ -1837,8 +1857,12 @@ Section "Uninstall"
ExecWait '"$INSTDIR\NPFInstall.exe" -n -kill_proc' $0
Goto terminate_back_3
${Else}
ExecWait '"$INSTDIR\NPFInstall.exe" -n -kill_proc_polite' $0
Call un.remove_win7_XXbit_system_dlls
${If} $no_kill == "no"
ExecWait '"$INSTDIR\NPFInstall.exe" -n -kill_proc_polite' $0
Call un.remove_win7_XXbit_system_dlls
${Else}
Goto uninstall_fail
${EndIf}
${EndIf}
${EndIf}

Expand All @@ -1863,8 +1887,12 @@ Section "Uninstall"
ExecWait '"$INSTDIR\NPFInstall.exe" -n -kill_proc' $0
Goto terminate_back_4
${Else}
ExecWait '"$INSTDIR\NPFInstall.exe" -n -kill_proc_polite' $0
Call un.remove_win7_XXbit_system_dlls
${If} $no_kill == "no"
ExecWait '"$INSTDIR\NPFInstall.exe" -n -kill_proc_polite' $0
Call un.remove_win7_XXbit_system_dlls
${Else}
Goto uninstall_fail
${EndIf}
${EndIf}
${EndIf}

Expand Down

0 comments on commit e3e0a99

Please sign in to comment.