diff options
author | Gerald Combs <gerald@wireshark.org> | 2022-06-03 10:09:40 -0700 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2022-06-03 10:26:14 -0700 |
commit | 9e7a2b76996b19149f0e74f2c3fb2a8c87b02396 (patch) | |
tree | 2018b50f25c07ac9c5e3369534262b4ece06eb1a /packaging/nsis | |
parent | 05759d3ec5160d8d7c1d955c6f073c421b2bcfc7 (diff) |
NSIS: Fix our indentation.
The NSIS project uses 2-space indentation. Make sure we conform to that.
Diffstat (limited to 'packaging/nsis')
-rw-r--r-- | packaging/nsis/uninstall-wireshark.nsi | 73 | ||||
-rw-r--r-- | packaging/nsis/wireshark-common.nsh | 123 | ||||
-rw-r--r-- | packaging/nsis/wireshark.nsi | 249 |
3 files changed, 203 insertions, 242 deletions
diff --git a/packaging/nsis/uninstall-wireshark.nsi b/packaging/nsis/uninstall-wireshark.nsi index 12ef55a4f8..bdd8090df9 100644 --- a/packaging/nsis/uninstall-wireshark.nsi +++ b/packaging/nsis/uninstall-wireshark.nsi @@ -64,23 +64,23 @@ FunctionEnd Var EXTENSION Function un.Disassociate - Push $R0 + Push $R0 !insertmacro PushFileExtensions - Pop $EXTENSION - ${DoUntil} $EXTENSION == ${FILE_EXTENSION_MARKER} - ReadRegStr $R0 HKCR $EXTENSION "" - StrCmp $R0 ${WIRESHARK_ASSOC} un.Disassociate.doDeregister - Goto un.Disassociate.end + Pop $EXTENSION + ${DoUntil} $EXTENSION == ${FILE_EXTENSION_MARKER} + ReadRegStr $R0 HKCR $EXTENSION "" + StrCmp $R0 ${WIRESHARK_ASSOC} un.Disassociate.doDeregister + Goto un.Disassociate.end un.Disassociate.doDeregister: - ; The extension is associated with Wireshark so, we must destroy this! - DeleteRegKey HKCR $EXTENSION - DetailPrint "Deregistered file type: $EXTENSION" + ; The extension is associated with Wireshark so, we must destroy this! + DeleteRegKey HKCR $EXTENSION + DetailPrint "Deregistered file type: $EXTENSION" un.Disassociate.end: - Pop $EXTENSION - ${Loop} + Pop $EXTENSION + ${Loop} - Pop $R0 + Pop $R0 FunctionEnd Section "-Required" @@ -152,15 +152,15 @@ Push "mmdbresolve" Pop $EXECUTABLE ${DoUntil} $EXECUTABLE == ${EXECUTABLE_MARKER} - ; IsWiresharkRunning should make sure everything is closed down so we *shouldn't* run - ; into any problems here. - Delete "$INSTDIR\$EXECUTABLE.exe" - IfErrors 0 deletionSuccess - MessageBox MB_OK "$EXECUTABLE.exe could not be removed. Is it in use?" /SD IDOK IDOK 0 - Abort "$EXECUTABLE.exe could not be removed. Aborting the uninstall process." + ; IsWiresharkRunning should make sure everything is closed down so we *shouldn't* run + ; into any problems here. + Delete "$INSTDIR\$EXECUTABLE.exe" + IfErrors 0 deletionSuccess + MessageBox MB_OK "$EXECUTABLE.exe could not be removed. Is it in use?" /SD IDOK IDOK 0 + Abort "$EXECUTABLE.exe could not be removed. Aborting the uninstall process." deletionSuccess: - Pop $EXECUTABLE + Pop $EXECUTABLE ${Loop} @@ -306,10 +306,10 @@ SectionIn 2 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 "Npcap $1" /SD IDOK - ExecWait '$1' $0 - DetailPrint "Npcap uninstaller returned $0" - ;SetRebootFlag true + ;MessageBox MB_OK "Npcap $1" /SD IDOK + ExecWait '$1' $0 + DetailPrint "Npcap uninstaller returned $0" + ;SetRebootFlag true ${EndIf} ;un.lbl_npcap_notinstalled: SectionEnd @@ -327,24 +327,11 @@ NoFinalErrorMsg: SectionEnd !insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN - !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUinstall} "Uninstall all ${PROGRAM_NAME} components." - !insertmacro MUI_DESCRIPTION_TEXT ${un.SecPlugins} "Uninstall all Plugins (even from previous ${PROGRAM_NAME} versions)." - !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.SecNpcap} "Call Npcap's uninstall program." - !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUSBPcap} "Call USBPcap's uninstall program." + !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUinstall} "Uninstall all ${PROGRAM_NAME} components." + !insertmacro MUI_DESCRIPTION_TEXT ${un.SecPlugins} "Uninstall all Plugins (even from previous ${PROGRAM_NAME} versions)." + !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.SecNpcap} "Call Npcap's uninstall program." + !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUSBPcap} "Call USBPcap's uninstall program." !insertmacro MUI_UNFUNCTION_DESCRIPTION_END - -; -; Editor modelines - https://www.wireshark.org/tools/modelines.html -; -; Local variables: -; c-basic-offset: 4 -; tab-width: 8 -; indent-tabs-mode: nil -; End: -; -; vi: set shiftwidth=4 tabstop=8 expandtab: -; :indentSize=4:tabSize=8:noTabs=true: -; diff --git a/packaging/nsis/wireshark-common.nsh b/packaging/nsis/wireshark-common.nsh index 4ab7cb9845..e1e1ec24c6 100644 --- a/packaging/nsis/wireshark-common.nsh +++ b/packaging/nsis/wireshark-common.nsh @@ -58,28 +58,28 @@ XPStyle on !define SHCNF_IDLIST 0 !macro UpdateIcons - Push $R0 - Push $R1 - Push $R2 + Push $R0 + Push $R1 + Push $R2 - !define UPDATEICONS_UNIQUE ${__LINE__} + !define UPDATEICONS_UNIQUE ${__LINE__} - IfFileExists "$SYSDIR\shell32.dll" UpdateIcons.ok_shell32_${UPDATEICONS_UNIQUE} UpdateIcons.error_shell32_${UPDATEICONS_UNIQUE} + IfFileExists "$SYSDIR\shell32.dll" UpdateIcons.ok_shell32_${UPDATEICONS_UNIQUE} UpdateIcons.error_shell32_${UPDATEICONS_UNIQUE} UpdateIcons.ok_shell32_${UPDATEICONS_UNIQUE}: - System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (${SHCNE_ASSOCCHANGED}, ${SHCNF_IDLIST}, 0, 0)' - Goto UpdateIcons.quit_${UPDATEICONS_UNIQUE} + System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (${SHCNE_ASSOCCHANGED}, ${SHCNF_IDLIST}, 0, 0)' + Goto UpdateIcons.quit_${UPDATEICONS_UNIQUE} UpdateIcons.error_shell32_${UPDATEICONS_UNIQUE}: - MessageBox MB_OK|MB_ICONSTOP \ - "Can't find 'shell32.dll' library. Impossible to update icons" \ - /SD IDOK - Goto UpdateIcons.quit_${UPDATEICONS_UNIQUE} + MessageBox MB_OK|MB_ICONSTOP \ + "Can't find 'shell32.dll' library. Impossible to update icons" \ + /SD IDOK + Goto UpdateIcons.quit_${UPDATEICONS_UNIQUE} UpdateIcons.quit_${UPDATEICONS_UNIQUE}: - !undef UPDATEICONS_UNIQUE - Pop $R2 - Pop $R1 - Pop $R0 + !undef UPDATEICONS_UNIQUE + Pop $R2 + Pop $R1 + Pop $R0 ; Force the icon cache to refresh ; https://superuser.com/questions/499078/refresh-icon-cache-without-rebooting @@ -100,35 +100,35 @@ Exec '"$SYSDIR\ie4uinit.exe" -ClearIconCache' !define FILE_EXTENSION_MARKER "FILE_EXTENSION_MARKER" !macro PushFileExtensions - Push "${FILE_EXTENSION_MARKER}" - Push ".wpz" - Push ".wpc" - Push ".vwr" - Push ".trc" - Push ".trace" - Push ".tr1" - Push ".tpc" - Push ".syc" - Push ".snoop" - Push ".rf5" - Push ".pkt" - Push ".pklg" - Push ".pcapng" - Push ".pcap" - Push ".out" - Push ".ntar" - Push ".mplog" - Push ".lcap" - Push ".ipfix" - Push ".fdc" - Push ".erf" - Push ".enc" - Push ".cap" - Push ".bfr" - Push ".atc" - Push ".apc" - Push ".acp" - Push ".5vw" + Push "${FILE_EXTENSION_MARKER}" + Push ".wpz" + Push ".wpc" + Push ".vwr" + Push ".trc" + Push ".trace" + Push ".tr1" + Push ".tpc" + Push ".syc" + Push ".snoop" + Push ".rf5" + Push ".pkt" + Push ".pklg" + Push ".pcapng" + Push ".pcap" + Push ".out" + Push ".ntar" + Push ".mplog" + Push ".lcap" + Push ".ipfix" + Push ".fdc" + Push ".erf" + Push ".enc" + Push ".cap" + Push ".bfr" + Push ".atc" + Push ".apc" + Push ".acp" + Push ".5vw" !macroend !macro IsWiresharkRunning @@ -136,37 +136,24 @@ Exec '"$SYSDIR\ie4uinit.exe" -ClearIconCache' ; https://nsis.sourceforge.io/Check_whether_your_application_is_running ${Do} - System::Call 'kernel32::OpenMutex(i 0x100000, b 0, t "Global\${PROGRAM_NAME}-is-running-{9CA78EEA-EA4D-4490-9240-FC01FCEF464B}") i .R0' - IntCmp $R0 0 checkRunningSession - System::Call 'kernel32::CloseHandle(i $R0)' - Goto isRunning + System::Call 'kernel32::OpenMutex(i 0x100000, b 0, t "Global\${PROGRAM_NAME}-is-running-{9CA78EEA-EA4D-4490-9240-FC01FCEF464B}") i .R0' + IntCmp $R0 0 checkRunningSession + System::Call 'kernel32::CloseHandle(i $R0)' + Goto isRunning checkRunningSession: - System::Call 'kernel32::OpenMutex(i 0x100000, b 0, t "${PROGRAM_NAME}-is-running-{9CA78EEA-EA4D-4490-9240-FC01FCEF464B}") i .R0' - IntCmp $R0 0 notRunning - System::Call 'kernel32::CloseHandle(i $R0)' + System::Call 'kernel32::OpenMutex(i 0x100000, b 0, t "${PROGRAM_NAME}-is-running-{9CA78EEA-EA4D-4490-9240-FC01FCEF464B}") i .R0' + IntCmp $R0 0 notRunning + System::Call 'kernel32::CloseHandle(i $R0)' isRunning: - ; You'd better go catch it. - MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION "${PROGRAM_NAME} or one of its associated programs is running.$\r$\nPlease close it first." /SD IDCANCEL IDRETRY continueChecking - Quit + ; You'd better go catch it. + MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION "${PROGRAM_NAME} or one of its associated programs is running.$\r$\nPlease close it first." /SD IDCANCEL IDRETRY continueChecking + Quit notRunning: - ${ExitDo} + ${ExitDo} continueChecking: ${Loop} !macroend - -; -; Editor modelines - https://www.wireshark.org/tools/modelines.html -; -; Local variables: -; c-basic-offset: 4 -; tab-width: 8 -; indent-tabs-mode: nil -; End: -; -; vi: set shiftwidth=4 tabstop=8 expandtab: -; :indentSize=4:tabSize=8:noTabs=true: -; diff --git a/packaging/nsis/wireshark.nsi b/packaging/nsis/wireshark.nsi index 94cc11c699..5ad6360cba 100644 --- a/packaging/nsis/wireshark.nsi +++ b/packaging/nsis/wireshark.nsi @@ -285,58 +285,58 @@ Function .onInit ${EndIf} !endif - ; Get the Windows version - ${GetWindowsVersion} $R0 - - ; This should match the following: - ; - The NTDDI_VERSION and _WIN32_WINNT parts of cmakeconfig.h.in - ; - The <compatibility><application> section in image\wireshark.exe.manifest.in - ; - The VersionNT parts of packaging\wix\Prerequisites.wxi - - ; Uncomment to test. - ; MessageBox MB_OK "You're running Windows $R0." - - ; Check if we're able to run with this version - StrCmp $R0 '95' lbl_winversion_unsupported - StrCmp $R0 '98' lbl_winversion_unsupported - StrCmp $R0 'ME' lbl_winversion_unsupported - StrCmp $R0 'NT 4.0' lbl_winversion_unsupported_nt4 - StrCmp $R0 '2000' lbl_winversion_unsupported_2000 - StrCmp $R0 'XP' lbl_winversion_unsupported_xp_2003 - StrCmp $R0 '2003' lbl_winversion_unsupported_xp_2003 - StrCmp $R0 'Vista' lbl_winversion_unsupported_vista_2008 - StrCmp $R0 '2008' lbl_winversion_unsupported_vista_2008 - Goto lbl_winversion_supported + ; Get the Windows version + ${GetWindowsVersion} $R0 + + ; This should match the following: + ; - The NTDDI_VERSION and _WIN32_WINNT parts of cmakeconfig.h.in + ; - The <compatibility><application> section in image\wireshark.exe.manifest.in + ; - The VersionNT parts of packaging\wix\Prerequisites.wxi + + ; Uncomment to test. + ; MessageBox MB_OK "You're running Windows $R0." + + ; Check if we're able to run with this version + StrCmp $R0 '95' lbl_winversion_unsupported + StrCmp $R0 '98' lbl_winversion_unsupported + StrCmp $R0 'ME' lbl_winversion_unsupported + StrCmp $R0 'NT 4.0' lbl_winversion_unsupported_nt4 + StrCmp $R0 '2000' lbl_winversion_unsupported_2000 + StrCmp $R0 'XP' lbl_winversion_unsupported_xp_2003 + StrCmp $R0 '2003' lbl_winversion_unsupported_xp_2003 + StrCmp $R0 'Vista' lbl_winversion_unsupported_vista_2008 + StrCmp $R0 '2008' lbl_winversion_unsupported_vista_2008 + Goto lbl_winversion_supported lbl_winversion_unsupported: - MessageBox MB_OK \ - "Windows $R0 is no longer supported.$\nPlease install Ethereal 0.99.0 instead." \ - /SD IDOK - Quit + MessageBox MB_OK \ + "Windows $R0 is no longer supported.$\nPlease install Ethereal 0.99.0 instead." \ + /SD IDOK + Quit lbl_winversion_unsupported_nt4: - MessageBox MB_OK \ - "Windows $R0 is no longer supported.$\nPlease install Wireshark 0.99.4 instead." \ - /SD IDOK - Quit + MessageBox MB_OK \ + "Windows $R0 is no longer supported.$\nPlease install Wireshark 0.99.4 instead." \ + /SD IDOK + Quit lbl_winversion_unsupported_2000: - MessageBox MB_OK \ - "Windows $R0 is no longer supported.$\nPlease install Wireshark 1.2 or 1.0 instead." \ - /SD IDOK - Quit + MessageBox MB_OK \ + "Windows $R0 is no longer supported.$\nPlease install Wireshark 1.2 or 1.0 instead." \ + /SD IDOK + Quit lbl_winversion_unsupported_xp_2003: - MessageBox MB_OK \ - "Windows $R0 is no longer supported.$\nPlease install ${PROGRAM_NAME} 1.12 or 1.10 instead." \ - /SD IDOK - Quit + MessageBox MB_OK \ + "Windows $R0 is no longer supported.$\nPlease install ${PROGRAM_NAME} 1.12 or 1.10 instead." \ + /SD IDOK + Quit lbl_winversion_unsupported_vista_2008: - MessageBox MB_OK \ - "Windows $R0 is no longer supported.$\nPlease install ${PROGRAM_NAME} 2.2 instead." \ - /SD IDOK - Quit + MessageBox MB_OK \ + "Windows $R0 is no longer supported.$\nPlease install ${PROGRAM_NAME} 2.2 instead." \ + /SD IDOK + Quit lbl_winversion_supported: !insertmacro IsWiresharkRunning @@ -946,19 +946,19 @@ File "${EXTRA_INSTALLER_DIR}\USBPcapSetup-${USBPCAP_PACKAGE_VERSION}.exe" ExecWait '"$INSTDIR\USBPcapSetup-${USBPCAP_PACKAGE_VERSION}.exe"' $0 DetailPrint "USBPcap installer returned $0" ${If} $0 == "0" - ${If} ${RunningX64} - ${DisableX64FSRedirection} - SetRegView 64 - ${EndIf} - ReadRegStr $USBPCAP_UNINSTALL HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\USBPcap" "UninstallString" - ${If} ${RunningX64} - ${EnableX64FSRedirection} - SetRegView 32 - ${EndIf} - ${StrRep} $0 '$USBPCAP_UNINSTALL' 'Uninstall.exe' 'USBPcapCMD.exe' - ${StrRep} $1 '$0' '"' '' - CopyFiles /SILENT $1 $INSTDIR\extcap - SetRebootFlag true + ${If} ${RunningX64} + ${DisableX64FSRedirection} + SetRegView 64 + ${EndIf} + ReadRegStr $USBPCAP_UNINSTALL HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\USBPcap" "UninstallString" + ${If} ${RunningX64} + ${EnableX64FSRedirection} + SetRegView 32 + ${EndIf} + ${StrRep} $0 '$USBPCAP_UNINSTALL' 'Uninstall.exe' 'USBPcapCMD.exe' + ${StrRep} $1 '$0' '"' '' + CopyFiles /SILENT $1 $INSTDIR\extcap + SetRebootFlag true ${EndIf} SecRequired_skip_USBPcap: @@ -1329,94 +1329,81 @@ Var USBPCAP_NAME ; DisplayName from USBPcap installation Function myShowCallback - ClearErrors - ; detect if WinPcap should be 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 - ; 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 Npcap or WinPcap versions)" - Goto lbl_npcap_done + ClearErrors + ; detect if WinPcap should be 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 + ; 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 Npcap or WinPcap versions)" + Goto lbl_npcap_done lbl_npcap_installed: - ReadRegStr $NPCAP_DISPLAY_VERSION HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\NpcapInst" "DisplayVersion" - WriteINIStr "$PLUGINSDIR\NpcapPage.ini" "Field 1" "Text" "Currently installed Npcap version" - StrCmp $NPCAP_NAME "Npcap" 0 +3 - WriteINIStr "$PLUGINSDIR\NpcapPage.ini" "Field 2" "Text" "Npcap $NPCAP_DISPLAY_VERSION" - Goto +2 - WriteINIStr "$PLUGINSDIR\NpcapPage.ini" "Field 2" "Text" "$NPCAP_NAME" - - ; Compare the installed build against the one we have. - StrCmp $NPCAP_DISPLAY_VERSION "" lbl_npcap_do_install ; Npcap wasn't installed improperly? - ${VersionConvert} $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 Npcap, please uninstall $NPCAP_NAME manually first." - WriteINIStr "$PLUGINSDIR\NpcapPage.ini" "Field 5" "Flags" "DISABLED" - Goto lbl_npcap_done + ReadRegStr $NPCAP_DISPLAY_VERSION HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\NpcapInst" "DisplayVersion" + WriteINIStr "$PLUGINSDIR\NpcapPage.ini" "Field 1" "Text" "Currently installed Npcap version" + StrCmp $NPCAP_NAME "Npcap" 0 +3 + WriteINIStr "$PLUGINSDIR\NpcapPage.ini" "Field 2" "Text" "Npcap $NPCAP_DISPLAY_VERSION" + Goto +2 + WriteINIStr "$PLUGINSDIR\NpcapPage.ini" "Field 2" "Text" "$NPCAP_NAME" + + ; Compare the installed build against the one we have. + StrCmp $NPCAP_DISPLAY_VERSION "" lbl_npcap_do_install ; Npcap wasn't installed improperly? + ${VersionConvert} $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 Npcap, 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" "1" - WriteINIStr "$PLUGINSDIR\NpcapPage.ini" "Field 5" "Text" "The currently installed $WINPCAP_NAME may be uninstalled first." - Goto lbl_npcap_done + WriteINIStr "$PLUGINSDIR\NpcapPage.ini" "Field 2" "Text" "$WINPCAP_NAME" + WriteINIStr "$PLUGINSDIR\NpcapPage.ini" "Field 4" "State" "1" + WriteINIStr "$PLUGINSDIR\NpcapPage.ini" "Field 5" "Text" "The currently installed $WINPCAP_NAME may be uninstalled first." + Goto lbl_npcap_done lbl_npcap_do_install: - ; seems to be an old version, install newer one - WriteINIStr "$PLUGINSDIR\NpcapPage.ini" "Field 4" "State" "1" - StrCmp $NPCAP_NAME "Npcap" 0 +3 - WriteINIStr "$PLUGINSDIR\NpcapPage.ini" "Field 5" "Text" "The currently installed Npcap $NPCAP_DISPLAY_VERSION will be uninstalled first." - Goto +2 - WriteINIStr "$PLUGINSDIR\NpcapPage.ini" "Field 5" "Text" "The currently installed $NPCAP_NAME will be uninstalled first." + ; seems to be an old version, install newer one + WriteINIStr "$PLUGINSDIR\NpcapPage.ini" "Field 4" "State" "1" + StrCmp $NPCAP_NAME "Npcap" 0 +3 + WriteINIStr "$PLUGINSDIR\NpcapPage.ini" "Field 5" "Text" "The currently installed Npcap $NPCAP_DISPLAY_VERSION will be uninstalled first." + Goto +2 + WriteINIStr "$PLUGINSDIR\NpcapPage.ini" "Field 5" "Text" "The currently installed $NPCAP_NAME will be uninstalled first." lbl_npcap_done: - ; detect if USBPcap should be installed - WriteINIStr "$PLUGINSDIR\USBPcapPage.ini" "Field 4" "Text" "Install USBPcap ${USBPCAP_PACKAGE_VERSION}" - ${If} ${RunningX64} - ${DisableX64FSRedirection} - SetRegView 64 - ${EndIf} - ReadRegStr $USBPCAP_NAME HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\USBPcap" "DisplayName" - ${If} ${RunningX64} - ${EnableX64FSRedirection} - SetRegView 32 - ${EndIf} - IfErrors 0 lbl_usbpcap_installed ;if RegKey is available, USBPcap is already installed - WriteINIStr "$PLUGINSDIR\USBPcapPage.ini" "Field 2" "Text" "USBPcap is currently not installed" - WriteINIStr "$PLUGINSDIR\USBPcapPage.ini" "Field 2" "Flags" "DISABLED" - WriteINIStr "$PLUGINSDIR\USBPcapPage.ini" "Field 5" "Text" "(Use Add/Remove Programs first to uninstall any undetected old USBPcap versions)" - Goto lbl_usbpcap_done + ; detect if USBPcap should be installed + WriteINIStr "$PLUGINSDIR\USBPcapPage.ini" "Field 4" "Text" "Install USBPcap ${USBPCAP_PACKAGE_VERSION}" + ${If} ${RunningX64} + ${DisableX64FSRedirection} + SetRegView 64 + ${EndIf} + ReadRegStr $USBPCAP_NAME HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\USBPcap" "DisplayName" + ${If} ${RunningX64} + ${EnableX64FSRedirection} + SetRegView 32 + ${EndIf} + IfErrors 0 lbl_usbpcap_installed ;if RegKey is available, USBPcap is already installed + WriteINIStr "$PLUGINSDIR\USBPcapPage.ini" "Field 2" "Text" "USBPcap is currently not installed" + WriteINIStr "$PLUGINSDIR\USBPcapPage.ini" "Field 2" "Flags" "DISABLED" + WriteINIStr "$PLUGINSDIR\USBPcapPage.ini" "Field 5" "Text" "(Use Add/Remove Programs first to uninstall any undetected old USBPcap versions)" + Goto lbl_usbpcap_done 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_PACKAGE_VERSION}, please uninstall $USBPCAP_NAME manually first." - WriteINIStr "$PLUGINSDIR\USBPcapPage.ini" "Field 5" "Flags" "DISABLED" - Goto lbl_usbpcap_done + 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_PACKAGE_VERSION}, please uninstall $USBPCAP_NAME manually first." + WriteINIStr "$PLUGINSDIR\USBPcapPage.ini" "Field 5" "Flags" "DISABLED" + Goto lbl_usbpcap_done lbl_usbpcap_done: FunctionEnd - -; -; Editor modelines - https://www.wireshark.org/tools/modelines.html -; -; Local variables: -; c-basic-offset: 4 -; tab-width: 8 -; indent-tabs-mode: nil -; End: -; -; vi: set shiftwidth=4 tabstop=8 expandtab: -; :indentSize=4:tabSize=8:noTabs=true: -; |