From 2bcc8dbf267bb33aae5c62d93653b0e1d3105a1b Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Wed, 28 Nov 2018 17:08:27 -0800 Subject: NSIS: Install NPcap instead of WinPcap. Install NPcap 0.99-r7 instead of WinPcap in the NSIS installer. Update and/or remove installer text, variables, and variable names accordingly. Change-Id: Ied36f00c2516127969894f55698e70401dfffb4f Reviewed-on: https://code.wireshark.org/review/30829 Petri-Dish: Anders Broman Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- packaging/nsis/CMakeLists.txt | 11 ++- packaging/nsis/NpcapPage.ini | 61 +++++++++++++++++ packaging/nsis/VersionCompare.nsh | 91 ------------------------ packaging/nsis/WinPcapPage.ini | 61 ----------------- packaging/nsis/config.nsh.in | 5 +- packaging/nsis/uninstall.nsi | 18 ++--- packaging/nsis/wireshark.nsi | 141 ++++++++++++++++---------------------- packaging/wix/CMakeLists.txt | 11 --- 8 files changed, 136 insertions(+), 263 deletions(-) create mode 100644 packaging/nsis/NpcapPage.ini delete mode 100644 packaging/nsis/VersionCompare.nsh delete mode 100644 packaging/nsis/WinPcapPage.ini (limited to 'packaging') diff --git a/packaging/nsis/CMakeLists.txt b/packaging/nsis/CMakeLists.txt index 36e8b2fca6..d2013d9148 100644 --- a/packaging/nsis/CMakeLists.txt +++ b/packaging/nsis/CMakeLists.txt @@ -24,7 +24,7 @@ set(NSIS_FILES GetWindowsVersion.nsh servicelib.nsh AdditionalTasksPage.ini - WinPcapPage.ini + NpcapPage.ini USBPcapPage.ini ${NSIS_GENERATED_FILES} PARENT_SCOPE @@ -45,16 +45,15 @@ else() endif() set (MMDBRESOLVE_EXE ${MAXMINDDB_FOUND}) -# Path to the WinPcap installer. +# Path to the Npcap installer. # XXX Come up with a better variable, e.g. cache WIRESHARK_LIB_DIR in FindWSWinLibs. file(TO_NATIVE_PATH "${GLIB2_DLL_DIR}/../.." _wireshark_lib_dir) set(WIRESHARK_LIB_DIR "${_wireshark_lib_dir}") -# Must match ${WIRESHARK_LIB_DIR}/WinPcap_X_Y_Z.exe -set(WINPCAP_PACKAGE_VERSION ${WINPCAP_VERSION}) -string(REPLACE "_" "." PCAP_DISPLAY_VERSION "${WINPCAP_PACKAGE_VERSION}") +# Must match ${WIRESHARK_LIB_DIR}/Npcap-X.Y.Z.exe +set(NPCAP_PACKAGE_VERSION "0.99-r7") -set(USBPCAP_DISPLAY_VERSION "1.2.0.4") +set(USBPCAP_PACKAGE_VERSION "1.2.0.4") set(PRODUCT_VERSION ${PROJECT_MAJOR_VERSION}.${PROJECT_MINOR_VERSION}.${PROJECT_PATCH_VERSION}.${PROJECT_BUILD_VERSION}) diff --git a/packaging/nsis/NpcapPage.ini b/packaging/nsis/NpcapPage.ini new file mode 100644 index 0000000000..ce7f2ab5c1 --- /dev/null +++ b/packaging/nsis/NpcapPage.ini @@ -0,0 +1,61 @@ +[Settings] +NumFields=7 + +[Field 1] +Type=GroupBox +Left=0 +Right=-1 +Top=0 +Bottom=25 +Text=Currently installed Npcap or WinPcap version + +[Field 2] +Type=Label +Left=10 +Right=250 +Top=10 +Bottom=18 +Text=This text will be replaced with current Npcap installer version + +[Field 3] +Type=GroupBox +Left=0 +Right=-1 +Top=30 +Bottom=65 +Text=Install + +[Field 4] +Type=CheckBox +Left=10 +Right=250 +Top=40 +Bottom=48 +Text=This text will be replaced, depending on current Npcap version in wireshark.nsi +State=1 + +[Field 5] +Type=Label +Left=20 +Right=290 +Top=50 +Bottom=58 +Text=This text will be replaced, depending on whether Npcap is already installed + +[Field 6] +Type=Link +Left=0 +Right=290 +Top=112 +Bottom=120 +Text=Get WinPcap +State=https://www.winpcap.org/ + +[Field 7] +Type=Link +Left=0 +Right=290 +Top=127 +Bottom=135 +Text=Learn more about Npcap and WinPcap +State=https://wiki.wireshark.org/WinPcap diff --git a/packaging/nsis/VersionCompare.nsh b/packaging/nsis/VersionCompare.nsh deleted file mode 100644 index d2cfe75b8b..0000000000 --- a/packaging/nsis/VersionCompare.nsh +++ /dev/null @@ -1,91 +0,0 @@ -; -; VersionCompare - Compare Windows version numbers -; -; Copied from http://nsis.sourceforge.net/VersionCompare -; -; By Instructor (http://nsis.sourceforge.net/User:Instructor) - -Function VersionCompare - !define VersionCompare `!insertmacro VersionCompareCall` - - !macro VersionCompareCall _VER1 _VER2 _RESULT - Push `${_VER1}` - Push `${_VER2}` - Call VersionCompare - Pop ${_RESULT} - !macroend - - Exch $1 - Exch - Exch $0 - Exch - Push $2 - Push $3 - Push $4 - Push $5 - Push $6 - Push $7 - - begin: - StrCpy $2 -1 - IntOp $2 $2 + 1 - StrCpy $3 $0 1 $2 - StrCmp $3 '' +2 - StrCmp $3 '.' 0 -3 - StrCpy $4 $0 $2 - IntOp $2 $2 + 1 - StrCpy $0 $0 '' $2 - - StrCpy $2 -1 - IntOp $2 $2 + 1 - StrCpy $3 $1 1 $2 - StrCmp $3 '' +2 - StrCmp $3 '.' 0 -3 - StrCpy $5 $1 $2 - IntOp $2 $2 + 1 - StrCpy $1 $1 '' $2 - - StrCmp $4$5 '' equal - - StrCpy $6 -1 - IntOp $6 $6 + 1 - StrCpy $3 $4 1 $6 - StrCmp $3 '0' -2 - StrCmp $3 '' 0 +2 - StrCpy $4 0 - - StrCpy $7 -1 - IntOp $7 $7 + 1 - StrCpy $3 $5 1 $7 - StrCmp $3 '0' -2 - StrCmp $3 '' 0 +2 - StrCpy $5 0 - - StrCmp $4 0 0 +2 - StrCmp $5 0 begin newer2 - StrCmp $5 0 newer1 - IntCmp $6 $7 0 newer1 newer2 - - StrCpy $4 '1$4' - StrCpy $5 '1$5' - IntCmp $4 $5 begin newer2 newer1 - - equal: - StrCpy $0 0 - goto end - newer1: - StrCpy $0 1 - goto end - newer2: - StrCpy $0 2 - - end: - Pop $7 - Pop $6 - Pop $5 - Pop $4 - Pop $3 - Pop $2 - Pop $1 - Exch $0 -FunctionEnd diff --git a/packaging/nsis/WinPcapPage.ini b/packaging/nsis/WinPcapPage.ini deleted file mode 100644 index 4a27b661e2..0000000000 --- a/packaging/nsis/WinPcapPage.ini +++ /dev/null @@ -1,61 +0,0 @@ -[Settings] -NumFields=7 - -[Field 1] -Type=GroupBox -Left=0 -Right=-1 -Top=0 -Bottom=25 -Text=Currently installed Npcap or WinPcap version - -[Field 2] -Type=Label -Left=10 -Right=250 -Top=10 -Bottom=18 -Text=This text will be replaced with current WinPcap installer version - -[Field 3] -Type=GroupBox -Left=0 -Right=-1 -Top=30 -Bottom=65 -Text=Install - -[Field 4] -Type=CheckBox -Left=10 -Right=250 -Top=40 -Bottom=48 -Text=This text will be replaced, depending on current WinPcap version in wireshark.nsi -State=1 - -[Field 5] -Type=Label -Left=20 -Right=290 -Top=50 -Bottom=58 -Text=This text will be replaced, depending if WinPcap is already installed - -[Field 6] -Type=Link -Left=0 -Right=290 -Top=112 -Bottom=120 -Text=Get Npcap -State=https://nmap.org/npcap - -[Field 7] -Type=Link -Left=0 -Right=290 -Top=127 -Bottom=135 -Text=Learn more about Npcap and WinPcap -State=https://wiki.wireshark.org/WinPcap diff --git a/packaging/nsis/config.nsh.in b/packaging/nsis/config.nsh.in index a080ef540e..349b558e46 100644 --- a/packaging/nsis/config.nsh.in +++ b/packaging/nsis/config.nsh.in @@ -11,9 +11,8 @@ !define WIRESHARK_TARGET_PLATFORM @WIRESHARK_TARGET_PLATFORM@ !define TARGET_MACHINE @TARGET_MACHINE@ !define WIRESHARK_LIB_DIR "@WIRESHARK_LIB_DIR@" -!define WINPCAP_PACKAGE_VERSION @WINPCAP_PACKAGE_VERSION@ -!define PCAP_DISPLAY_VERSION @PCAP_DISPLAY_VERSION@ -!define USBPCAP_DISPLAY_VERSION "1.2.0.4" +!define NPCAP_PACKAGE_VERSION @NPCAP_PACKAGE_VERSION@ +!define USBPCAP_PACKAGE_VERSION @USBPCAP_PACKAGE_VERSION@ !define VERSION @VERSION@ !define VERSION_MAJOR @VERSION_MAJOR@ !define VERSION_MINOR @VERSION_MINOR@ diff --git a/packaging/nsis/uninstall.nsi b/packaging/nsis/uninstall.nsi index cf9ba4341d..b33f082865 100644 --- a/packaging/nsis/uninstall.nsi +++ b/packaging/nsis/uninstall.nsi @@ -15,7 +15,7 @@ SetCompress off OutFile "${STAGING_DIR}\uninstall_installer.exe" RequestExecutionLevel user -InstType "un.Default (keep Personal Settings and WinPcap)" +InstType "un.Default (keep Personal Settings and Npcap)" InstType "un.All (remove all)" ; Uninstaller icon @@ -339,20 +339,20 @@ RMDir "$APPDATA\${PROGRAM_NAME}" DeleteRegKey HKCU "Software\${PROGRAM_NAME}" SectionEnd -;VAR un.WINPCAP_UNINSTALL +;VAR un.NPCAP_UNINSTALL -Section /o "Un.WinPcap" un.SecWinPcap +Section /o "Un.Npcap" un.SecNpcap ;------------------------------------------- SectionIn 2 -ReadRegStr $1 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "UninstallString" -;IfErrors un.lbl_winpcap_notinstalled ;if RegKey is unavailable, WinPcap is not installed +ReadRegStr $1 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\NpcapInst" "UninstallString" +;IfErrors un.lbl_npcap_notinstalled ;if RegKey is unavailable, Npcap is not installed ${If} $1 != "" - ;MessageBox MB_OK "WinPcap $1" /SD IDOK + ;MessageBox MB_OK "Npcap $1" /SD IDOK ExecWait '$1' $0 - DetailPrint "WinPcap uninstaller returned $0" + DetailPrint "Npcap uninstaller returned $0" ;SetRebootFlag true ${EndIf} -;un.lbl_winpcap_notinstalled: +;un.lbl_npcap_notinstalled: SectionEnd Section "-Un.Finally" @@ -373,7 +373,7 @@ SectionEnd !insertmacro MUI_DESCRIPTION_TEXT ${un.SecProfiles} "Uninstall all global configuration profiles." !insertmacro MUI_DESCRIPTION_TEXT ${un.SecGlobalSettings} "Uninstall global settings like: $INSTDIR\cfilters" !insertmacro MUI_DESCRIPTION_TEXT ${un.SecPersonalSettings} "Uninstall personal settings like your preferences file from your profile: $PROFILE." - !insertmacro MUI_DESCRIPTION_TEXT ${un.SecWinPcap} "Call WinPcap's uninstall program." + !insertmacro MUI_DESCRIPTION_TEXT ${un.SecNpcap} "Call Npcap's uninstall program." !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUSBPcap} "Call USBPcap's uninstall program." !insertmacro MUI_UNFUNCTION_DESCRIPTION_END diff --git a/packaging/nsis/wireshark.nsi b/packaging/nsis/wireshark.nsi index b3244a02b1..5a38fe8402 100644 --- a/packaging/nsis/wireshark.nsi +++ b/packaging/nsis/wireshark.nsi @@ -13,6 +13,8 @@ SetCompressorDictSize 64 ; MB !include "common.nsh" !include 'LogicLib.nsh' !include "StrFunc.nsh" +!include "WordFunc.nsh" + ${StrRep} ; See http://nsis.sourceforge.net/Check_if_a_file_exists_at_compile_time for documentation @@ -59,8 +61,8 @@ BrandingText "Wireshark${U+00ae} Installer" !define MUI_COMPONENTSPAGE_SMALLDESC !define MUI_FINISHPAGE_NOAUTOCLOSE !define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of ${PROGRAM_NAME}.$\r$\n$\r$\nBefore starting the installation, make sure ${PROGRAM_NAME} is not running.$\r$\n$\r$\nClick 'Next' to continue." -;!define MUI_FINISHPAGE_LINK "Install WinPcap to be able to capture packets from a network." -;!define MUI_FINISHPAGE_LINK_LOCATION "https://www.winpcap.org" +;!define MUI_FINISHPAGE_LINK "Install Npcap to be able to capture packets from a network." +;!define MUI_FINISHPAGE_LINK_LOCATION "https://nmap.org/npcap/" ; NSIS shows Readme files by opening the Readme file with the default application for ; the file's extension. "README.win32" won't work in most cases, because extension "win32" @@ -85,7 +87,7 @@ BrandingText "Wireshark${U+00ae} Installer" Page custom DisplayAdditionalTasksPage LeaveAdditionalTasksPage !endif !insertmacro MUI_PAGE_DIRECTORY -Page custom DisplayWinPcapPage +Page custom DisplayNpcapPage Page custom DisplayUSBPcapPage !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_FINISH @@ -106,7 +108,7 @@ Page custom DisplayUSBPcapPage ; Old Modern 1 UI: http://nsis.sourceforge.net/Docs/Modern%20UI/Readme.html ; To do: Upgrade to the Modern 2 UI: ;ReserveFile "AdditionalTasksPage.ini" - ReserveFile "WinPcapPage.ini" + ReserveFile "NpcapPage.ini" ReserveFile "USBPcapPage.ini" ReserveFile /plugin InstallOptions.dll @@ -442,7 +444,7 @@ done: ;Extract InstallOptions INI files ;!insertmacro INSTALLOPTIONS_EXTRACT "AdditionalTasksPage.ini" - !insertmacro INSTALLOPTIONS_EXTRACT "WinpcapPage.ini" + !insertmacro INSTALLOPTIONS_EXTRACT "NpcapPage.ini" !insertmacro INSTALLOPTIONS_EXTRACT "USBPcapPage.ini" FunctionEnd @@ -452,9 +454,9 @@ Function DisplayAdditionalTasksPage FunctionEnd !endif -Function DisplayWinPcapPage +Function DisplayNpcapPage !insertmacro MUI_HEADER_TEXT "Packet Capture" "Wireshark requires either Npcap or WinPcap to capture live network data." - !insertmacro INSTALLOPTIONS_DISPLAY "WinPcapPage.ini" + !insertmacro INSTALLOPTIONS_DISPLAY "NpcapPage.ini" FunctionEnd Function DisplayUSBPcapPage @@ -466,7 +468,6 @@ FunctionEnd ; Installation execution commands ; ============================================================================ -Var WINPCAP_UNINSTALL ;declare variable for holding the value of a registry key Var USBPCAP_UNINSTALL ;declare variable for holding the value of a registry key ;Var WIRESHARK_UNINSTALL ;declare variable for holding the value of a registry key @@ -872,24 +873,17 @@ Call Associate ; AdditionalTasks page ${Endif} -; if running as a silent installer, don't try to install winpcap -IfSilent SecRequired_skip_Winpcap - -; Install WinPcap (depending on winpcap page setting) -ReadINIStr $0 "$PLUGINSDIR\WinPcapPage.ini" "Field 4" "State" -StrCmp $0 "0" SecRequired_skip_Winpcap -; Uninstall old WinPcap first -ReadRegStr $WINPCAP_UNINSTALL HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "UninstallString" -IfErrors lbl_winpcap_notinstalled ;if RegKey is unavailable, WinPcap is not installed -; from released version 3.1, WinPcap will uninstall an old version by itself -;ExecWait '$WINPCAP_UNINSTALL' $0 -;DetailPrint "WinPcap uninstaller returned $0" -lbl_winpcap_notinstalled: +; if running as a silent installer, don't try to install npcap +IfSilent SecRequired_skip_Npcap + +; Install Npcap (depending on npcap page setting) +ReadINIStr $0 "$PLUGINSDIR\NpcapPage.ini" "Field 4" "State" +StrCmp $0 "0" SecRequired_skip_Npcap SetOutPath $INSTDIR -File "${WIRESHARK_LIB_DIR}\WinPcap_${WINPCAP_PACKAGE_VERSION}.exe" -ExecWait '"$INSTDIR\WinPcap_${WINPCAP_PACKAGE_VERSION}.exe"' $0 -DetailPrint "WinPcap installer returned $0" -SecRequired_skip_Winpcap: +File "${WIRESHARK_LIB_DIR}\npcap-${NPCAP_PACKAGE_VERSION}.exe" +ExecWait '"$INSTDIR\npcap-${NPCAP_PACKAGE_VERSION}.exe"' $0 +DetailPrint "Npcap installer returned $0" +SecRequired_skip_Npcap: ; If running as a silent installer, don't try to install USBPcap IfSilent SecRequired_skip_USBPcap @@ -897,8 +891,8 @@ IfSilent SecRequired_skip_USBPcap ReadINIStr $0 "$PLUGINSDIR\USBPcapPage.ini" "Field 4" "State" StrCmp $0 "0" SecRequired_skip_USBPcap SetOutPath $INSTDIR -File "${WIRESHARK_LIB_DIR}\USBPcapSetup-${USBPCAP_DISPLAY_VERSION}.exe" -ExecWait '"$INSTDIR\USBPcapSetup-${USBPCAP_DISPLAY_VERSION}.exe"' $0 +File "${WIRESHARK_LIB_DIR}\USBPcapSetup-${USBPCAP_PACKAGE_VERSION}.exe" +ExecWait '"$INSTDIR\USBPcapSetup-${USBPCAP_PACKAGE_VERSION}.exe"' $0 DetailPrint "USBPcap installer returned $0" ${If} $0 == "0" ${If} ${RunningX64} @@ -1245,77 +1239,60 @@ FunctionEnd !endif ; QT_DIR -!include "VersionCompare.nsh" - -Var WINPCAP_NAME ; DisplayName from WinPcap installation -Var WINWINPCAP_VERSION ; DisplayVersion from WinPcap installation Var NPCAP_NAME ; DisplayName from Npcap installation +Var WINPCAP_NAME ; DisplayName from WinPcap installation +Var REG_NPCAP_DISPLAY_VERSION ; DisplayVersion from WinPcap installation Var USBPCAP_NAME ; DisplayName from USBPcap installation Function myShowCallback ClearErrors ; detect if WinPcap should be installed - WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 4" "Text" "Install WinPcap ${PCAP_DISPLAY_VERSION}" - ReadRegStr $WINPCAP_NAME HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "DisplayName" - IfErrors 0 lbl_winpcap_installed ;if RegKey is available, WinPcap is already installed - ; check also if Npcap is installed + WriteINIStr "$PLUGINSDIR\NpcapPage.ini" "Field 4" "Text" "Install Npcap ${NPCAP_PACKAGE_VERSION}" ReadRegStr $NPCAP_NAME HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\NpcapInst" "DisplayName" IfErrors 0 lbl_npcap_installed - WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 2" "Text" "Neither of these are installed" - WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 2" "Flags" "DISABLED" - WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 5" "Text" "(Use Add/Remove Programs first to uninstall any undetected old WinPcap versions)" - Goto lbl_winpcap_done - -lbl_winpcap_installed: - WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 2" "Text" "$WINPCAP_NAME" - ; Compare the installed build against the one we have. - ReadRegStr $WINWINPCAP_VERSION HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "DisplayVersion" - StrCmp $WINWINPCAP_VERSION "" lbl_winpcap_do_install ; WinPcap is really old(?) or installed improperly. - ${VersionCompare} $WINWINPCAP_VERSION "4.1.0.2980" $1 ; WinPcap 4.1.3 - StrCmp $1 "2" lbl_winpcap_do_install - -;lbl_winpcap_dont_install: - ; The installed version is >= to what we have, so don't install - WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 4" "State" "0" - WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 5" "Text" "If selected, the currently installed $WINPCAP_NAME will be uninstalled first." - Goto lbl_winpcap_done - -;lbl_winpcap_dont_upgrade: - ; force the user to upgrade by hand - WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 4" "State" "0" - WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 4" "Flags" "DISABLED" - WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 5" "Text" "If you wish to install WinPcap ${PCAP_DISPLAY_VERSION}, please uninstall $WINPCAP_NAME manually first." - WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 5" "Flags" "DISABLED" - Goto lbl_winpcap_done + ; check also if WinPcap is installed + ReadRegStr $WINPCAP_NAME HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "DisplayName" + IfErrors 0 lbl_winpcap_installed ;if RegKey is available, WinPcap is already installed + WriteINIStr "$PLUGINSDIR\NpcapPage.ini" "Field 2" "Text" "Neither of these are installed" + WriteINIStr "$PLUGINSDIR\NpcapPage.ini" "Field 2" "Flags" "DISABLED" + WriteINIStr "$PLUGINSDIR\NpcapPage.ini" "Field 5" "Text" "(Use Add/Remove Programs first to uninstall any undetected old WinPcap versions)" + Goto lbl_npcap_done lbl_npcap_installed: ReadRegDWORD $0 HKEY_LOCAL_MACHINE "SOFTWARE\Npcap" "WinPcapCompatible" - WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 1" "Text" "Currently installed Npcap version" - ${If} $0 == "0" - ; Npcap is installed without WinPcap API-compatible mode; WinPcap can be installed - WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 2" "Text" "$NPCAP_NAME is currently installed without WinPcap API-compatible mode" - WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 4" "State" "0" - WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 5" "Text" "If you still wish to install WinPcap ${PCAP_DISPLAY_VERSION}, please check this option." - ${Else} - ; Npcap is installed with WinPcap API-compatible mode; WinPcap must not be installed - WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 2" "Text" "$NPCAP_NAME" - WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 4" "State" "0" - WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 4" "Flags" "DISABLED" - WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 5" "Text" "If you wish to install WinPcap ${PCAP_DISPLAY_VERSION}, please uninstall $NPCAP_NAME manually first." - WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 5" "Flags" "DISABLED" - ${EndIf} - Goto lbl_winpcap_done + WriteINIStr "$PLUGINSDIR\NpcapPage.ini" "Field 1" "Text" "Currently installed Npcap version" + WriteINIStr "$PLUGINSDIR\NpcapPage.ini" "Field 2" "Text" "$NPCAP_NAME" + + ; Compare the installed build against the one we have. + ReadRegStr $REG_NPCAP_DISPLAY_VERSION HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\NpcapInst" "DisplayVersion" + StrCmp $REG_NPCAP_DISPLAY_VERSION "" lbl_npcap_do_install ; Npcap wasn't installed improperly? + ${VersionConvert} $REG_NPCAP_DISPLAY_VERSION "" $R0 ; 0.99-r7 -> 0.99.114.7 + ${VersionConvert} "${NPCAP_PACKAGE_VERSION}" "" $R1 + ${VersionCompare} $R0 $R1 $1 + StrCmp $1 "2" lbl_npcap_do_install + + WriteINIStr "$PLUGINSDIR\NpcapPage.ini" "Field 4" "State" "0" + WriteINIStr "$PLUGINSDIR\NpcapPage.ini" "Field 4" "Flags" "DISABLED" + WriteINIStr "$PLUGINSDIR\NpcapPage.ini" "Field 5" "Text" "If you wish to install WinPcap, please uninstall $NPCAP_NAME manually first." + WriteINIStr "$PLUGINSDIR\NpcapPage.ini" "Field 5" "Flags" "DISABLED" + Goto lbl_npcap_done + +lbl_winpcap_installed: + WriteINIStr "$PLUGINSDIR\NpcapPage.ini" "Field 2" "Text" "$WINPCAP_NAME" + WriteINIStr "$PLUGINSDIR\NpcapPage.ini" "Field 4" "State" "0" + WriteINIStr "$PLUGINSDIR\NpcapPage.ini" "Field 5" "Text" "If selected, the currently installed $WINPCAP_NAME will be uninstalled first." + Goto lbl_npcap_done -lbl_winpcap_do_install: +lbl_npcap_do_install: ; seems to be an old version, install newer one - WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 4" "State" "1" - WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 5" "Text" "The currently installed $WINPCAP_NAME will be uninstalled first." + WriteINIStr "$PLUGINSDIR\NpcapPage.ini" "Field 4" "State" "1" + WriteINIStr "$PLUGINSDIR\NpcapPage.ini" "Field 5" "Text" "The currently installed $NPCAP_NAME will be uninstalled first." -lbl_winpcap_done: +lbl_npcap_done: ; detect if USBPcap should be installed - WriteINIStr "$PLUGINSDIR\USBPcapPage.ini" "Field 4" "Text" "Install USBPcap ${USBPCAP_DISPLAY_VERSION}" + WriteINIStr "$PLUGINSDIR\USBPcapPage.ini" "Field 4" "Text" "Install USBPcap ${USBPCAP_PACKAGE_VERSION}" ${If} ${RunningX64} ${DisableX64FSRedirection} SetRegView 64 @@ -1335,7 +1312,7 @@ lbl_usbpcap_installed: WriteINIStr "$PLUGINSDIR\USBPcapPage.ini" "Field 2" "Text" "$USBPCAP_NAME" WriteINIStr "$PLUGINSDIR\USBPcapPage.ini" "Field 4" "State" "0" WriteINIStr "$PLUGINSDIR\USBPcapPage.ini" "Field 4" "Flags" "DISABLED" - WriteINIStr "$PLUGINSDIR\USBPcapPage.ini" "Field 5" "Text" "If you wish to install USBPcap ${USBPCAP_DISPLAY_VERSION}, please uninstall $USBPCAP_NAME manually first." + WriteINIStr "$PLUGINSDIR\USBPcapPage.ini" "Field 5" "Text" "If you wish to install USBPcap ${USBPCAP_PACKAGE_VERSION}, please uninstall $USBPCAP_NAME manually first." WriteINIStr "$PLUGINSDIR\USBPcapPage.ini" "Field 5" "Flags" "DISABLED" Goto lbl_usbpcap_done diff --git a/packaging/wix/CMakeLists.txt b/packaging/wix/CMakeLists.txt index 508b86275d..ec4bf067d7 100644 --- a/packaging/wix/CMakeLists.txt +++ b/packaging/wix/CMakeLists.txt @@ -67,17 +67,6 @@ else() message(FATAL_ERROR "Your mysterious moon-man architecture \"${WIRESHARK_TARGET_PLATFORM}\" frightens and confuses us.") endif() -# Path to the WinPcap installer. -# XXX Come up with a better variable, e.g. cache WIRESHARK_LIB_DIR in FindWSWinLibs. -file(TO_NATIVE_PATH "${GLIB2_DLL_DIR}/../.." _wireshark_lib_dir) -set(WIRESHARK_LIB_DIR "${_wireshark_lib_dir}") - -# Must match ${WIRESHARK_LIB_DIR}/WinPcap_X_Y_Z.exe -set(WINPCAP_PACKAGE_VERSION ${WINPCAP_VERSION}) -string(REPLACE "_" "." PCAP_DISPLAY_VERSION "${WINPCAP_PACKAGE_VERSION}") - -set(USBPCAP_DISPLAY_VERSION "1.2.0.4") - set(PRODUCT_VERSION ${PROJECT_MAJOR_VERSION}.${PROJECT_MINOR_VERSION}.${PROJECT_PATCH_VERSION}.${PROJECT_BUILD_VERSION}) # To do: -- cgit v1.2.3