1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 20:51:30 +00:00

NSIS: disable Npcap install if installed version is newer or same.

This commit is contained in:
dmiller
2021-12-13 20:51:08 +00:00
parent 8d4c078394
commit 77fcbeca27

View File

@@ -39,6 +39,7 @@
!include "MUI.nsh"
!include "AddToPath.nsh"
!include "FileFunc.nsh"
!include "WordFunc.nsh"
!include "Sections.nsh"
;--------------------------------
@@ -266,7 +267,7 @@ Section "Npcap ${NPCAP_VERSION}" SecNpcap
SectionEnd
!endif
Section /o "Check for newer Npcap" SecNewNpcap
Section /o "Check online for newer Npcap" SecNewNpcap
ExecShell "open" "https://npcap.org/#download"
SectionEnd
@@ -422,6 +423,18 @@ Function .onInit
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "final.ini"
; Check if Npcap is already installed.
ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\NpcapInst" "DisplayVersion"
${If} $0 != ""
${VersionCompare} $0 ${NPCAP_VERSION} $1
; If our version is not newer than the installed version, don't offer to install Npcap.
${If} $1 != 2
SectionGetFlags ${SecNpcap} $2
IntOp $2 $2 & ${SECTION_OFF}
SectionSetFlags ${SecNpcap} $2
${EndIf}
${EndIf}
;Disable section checkboxes based on options. For example /ZENMAP=NO to avoid
;installing Zenmap.
${GetParameters} $0