Skip to content

Commit

Permalink
Reapply clobbered commit
Browse files Browse the repository at this point in the history
Fixed the issue that WFP callout driver fails to uninstall because the WFP INF is already deleted.

Conflicts:
	installer/Npcap-for-nmap.nsi
  • Loading branch information
hsluoyz authored and bonsaiviking committed Jan 5, 2017
1 parent 8648d5e commit fc53545
Showing 1 changed file with 57 additions and 27 deletions.
84 changes: 57 additions & 27 deletions installer/Npcap-for-nmap.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -1649,34 +1649,64 @@ Section "Uninstall"
${EndIf}
${EndIf}

; delete the driver
Call un.remove_win7_driver
; delete the DLLs and EXEs in home folder
Call un.remove_win7_XXbit_home_dlls
; uninstall_win7_64bit
${Else}
; delete the 32-bit DLLs and EXEs in System folder
StrCpy $cur_system_folder "SysWOW64"
terminate_back_3:
Call un.remove_win7_XXbit_system_dlls
${If} $err_flag != ""
; get the processes that are using Npcap
nsExec::ExecToStack '"$INSTDIR\NPFInstall.exe" -n -check_dll'
Pop $0
Pop $1
StrCpy $1 $1 -2
DetailPrint "Failed to delete: $err_flag. Please close programs: $1 which may be using Npcap and try again."
StrCpy $err_flag ""
${IfNot} ${Silent}
MessageBox MB_YESNO "Failed to uninstall Npcap because it is in use by application(s): $1. You may choose the Yes button to terminate that software now, or hit No, close the software manually, and restart the Npcap uninstaller." IDYES terminate_retry_3 IDNO uninstall_fail
terminate_retry_3:
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
${EndIf}
${EndIf}

; delete the DLLs and EXEs in home folder
Call un.remove_win7_XXbit_home_dlls
; uninstall_win7_64bit
${Else}
; delete the 32-bit DLLs and EXEs in System folder
StrCpy $cur_system_folder "SysWOW64"
terminate_back_3:
Call un.remove_win7_XXbit_system_dlls
${If} $err_flag != ""
; get the processes that are using Npcap
nsExec::ExecToStack '"$INSTDIR\NPFInstall.exe" -n -check_dll'
Pop $0
Pop $1
StrCpy $1 $1 -2
DetailPrint "Failed to delete: $err_flag. Please close programs: $1 which may be using Npcap and try again."
StrCpy $err_flag ""
${IfNot} ${Silent}
MessageBox MB_YESNO "Failed to uninstall Npcap because it is in use by application(s): $1. You may choose the Yes button to terminate that software now, or hit No, close the software manually, and restart the Npcap uninstaller." IDYES terminate_retry_3 IDNO uninstall_fail
terminate_retry_3:
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
; disable Wow64FsRedirection
System::Call kernel32::Wow64EnableWow64FsRedirection(i0)

; delete the 64-bit DLLs and EXEs in System folder
StrCpy $cur_system_folder "System32"
terminate_back_4:
Call un.remove_win7_XXbit_system_dlls
${If} $err_flag != ""
; get the processes that are using Npcap
nsExec::ExecToStack '"$INSTDIR\NPFInstall.exe" -n -check_dll'
Pop $0
Pop $1
StrCpy $1 $1 -2
DetailPrint "Failed to delete: $err_flag. Please close programs: $1 which may be using Npcap and try again."
StrCpy $err_flag ""
${IfNot} ${Silent}
MessageBox MB_YESNO "Failed to uninstall Npcap because it is in use by application(s): $1. You may choose the Yes button to terminate that software now, or hit No, close the software manually, and restart the Npcap uninstaller." IDYES terminate_retry_4 IDNO uninstall_fail
terminate_retry_4:
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
${EndIf}
${EndIf}

; re-enable Wow64FsRedirection
System::Call kernel32::Wow64EnableWow64FsRedirection(i1)

; delete the DLLs and EXEs in home folder
Call un.remove_win7_XXbit_home_dlls
${EndIf}

; disable Wow64FsRedirection
Expand Down Expand Up @@ -1719,7 +1749,7 @@ Section "Uninstall"
Call un.registerServiceAPI_win7

; Remove "Npcap Loopback Adapter" if it exists
ExecWait '"$INSTDIR\NPFInstall.exe" -n -ul' $0
ExecWait '"$INSTDIR\NPFInstall.exe" -n -ul' $0

; Delete our winpcap-nmap and any WinPcapInst registry keys
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\npcap-nmap"
Expand Down

0 comments on commit fc53545

Please sign in to comment.