summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPascal Quantin <pascal.quantin@gmail.com>2015-08-22 20:08:31 +0200
committerPascal Quantin <pascal.quantin@gmail.com>2015-08-25 17:27:10 +0000
commitd42873255555f81273c4e6dd0a845abe9fe24962 (patch)
tree424837f6f3962de1df3cf2d97d79185820e622d8
parentce246a6b64540d18f61e396df639213914c2421b (diff)
downloadwireshark-d42873255555f81273c4e6dd0a845abe9fe24962.tar.gz
win32: add detection of Npcap to Windows installer
If Npcap is installed without WinPcap API-compatible mode, propose to install WinPcap If Npcap is installed with WinPcap API-compatible mode, do not allow to install Winpcap without manually uninstalling Npcap first Change-Id: I606f8b11c950fd54cf7fdda7f4a1886cc2580d31 Reviewed-on: https://code.wireshark.org/review/10197 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Yang Luo <hsluoyz@sohu.com> Reviewed-by: Anders Broman <a.broman58@gmail.com> (cherry picked from commit d5049eaba76055ffc1104536cec59e2163c8d003) Reviewed-on: https://code.wireshark.org/review/10255
-rwxr-xr-xpackaging/nsis/uninstall.nsi10
-rw-r--r--packaging/nsis/wireshark.nsi24
2 files changed, 29 insertions, 5 deletions
diff --git a/packaging/nsis/uninstall.nsi b/packaging/nsis/uninstall.nsi
index 3b9086f25e..45f3ab9040 100755
--- a/packaging/nsis/uninstall.nsi
+++ b/packaging/nsis/uninstall.nsi
@@ -280,10 +280,12 @@ Section /o "Un.WinPcap" un.SecWinPcap
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
-;MessageBox MB_OK "WinPcap $1" /SD IDOK
-ExecWait '$1' $0
-DetailPrint "WinPcap uninstaller returned $0"
-;SetRebootFlag true
+${If} $1 != ""
+ ;MessageBox MB_OK "WinPcap $1" /SD IDOK
+ ExecWait '$1' $0
+ DetailPrint "WinPcap uninstaller returned $0"
+ ;SetRebootFlag true
+${EndIf}
;un.lbl_winpcap_notinstalled:
SectionEnd
diff --git a/packaging/nsis/wireshark.nsi b/packaging/nsis/wireshark.nsi
index 6d4455bb91..7f8a1a4e14 100644
--- a/packaging/nsis/wireshark.nsi
+++ b/packaging/nsis/wireshark.nsi
@@ -793,7 +793,7 @@ 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
-; Uinstall old WinPcap first
+; 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
@@ -1225,6 +1225,7 @@ FunctionEnd
Var WINPCAP_NAME ; DisplayName from WinPcap installation
Var WINWINPCAP_VERSION ; DisplayVersion from WinPcap installation
+Var NPCAP_NAME ; DisplayName from Npcap installation
Function myShowCallback
@@ -1245,6 +1246,9 @@ Function myShowCallback
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
+ 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" "WinPcap is currently not 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)"
@@ -1272,6 +1276,24 @@ lbl_winpcap_installed:
WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 5" "Flags" "DISABLED"
Goto lbl_winpcap_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" "1"
+ WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 5" "Text" "(Use Add/Remove Programs first to uninstall any undetected old WinPcap versions)"
+ ${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
+
lbl_winpcap_do_install:
; seems to be an old version, install newer one
WriteINIStr "$PLUGINSDIR\WinPcapPage.ini" "Field 4" "State" "1"