From 056fd8a1e3e67dc13835d8a79c8964bc65a23882 Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Thu, 2 Jun 2022 15:07:09 -0700 Subject: NSIS: Update some target and filenames. Rename the following build targets, similar to the recent macOS target name changes: nsis_package_prep to wireshark_nsis_prep nsis_package to wireshark_nsis Rename some NSIS files to reflect that they're specific to Wireshark. Update the documentation and CI configurations. --- .gitlab-ci.yml | 4 +- CMakeLists.txt | 8 +- appveyor.yml | 4 +- docbook/wsdg_src/WSDG_chapter_quick_setup.adoc | 8 +- docbook/wsdg_src/WSDG_chapter_sources.adoc | 18 +- packaging/nsis/CMakeLists.txt | 79 ++--- packaging/nsis/common.nsh | 172 ----------- packaging/nsis/makeUninstall.ps1 | 14 +- packaging/nsis/uninstall-wireshark.nsi | 350 +++++++++++++++++++++ packaging/nsis/uninstall.nsi | 402 ------------------------- packaging/nsis/windeployqt-to-nsis.ps1 | 4 +- packaging/nsis/wireshark-common.nsh | 172 +++++++++++ packaging/nsis/wireshark.nsi | 6 +- packaging/portableapps/CMakeLists.txt | 3 +- packaging/wix/CMakeLists.txt | 2 + wiretap/file_access.c | 2 +- 16 files changed, 599 insertions(+), 649 deletions(-) delete mode 100644 packaging/nsis/common.nsh create mode 100644 packaging/nsis/uninstall-wireshark.nsi delete mode 100644 packaging/nsis/uninstall.nsi create mode 100644 packaging/nsis/wireshark-common.nsh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9f520b542f..eed579804e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -334,10 +334,10 @@ Win64 Package: - cmake -G "Visual Studio 17 2022" -A x64 -DUSE_qt6=ON -DENABLE_LTO=off .. - msbuild /verbosity:minimal "/consoleloggerparameters:PerformanceSummary;NoSummary" /maxcpucount Wireshark.sln - msbuild /verbosity:minimal /maxcpucount test-programs.vcxproj - - msbuild /verbosity:minimal /maxcpucount nsis_package_prep.vcxproj + - msbuild /verbosity:minimal /maxcpucount wireshark_nsis_prep.vcxproj - msbuild /verbosity:minimal /maxcpucount wix_package_prep.vcxproj - C:\gitlab-builds\bin\sign-files.ps1 -Recurse -Path run\RelWithDebInfo - - msbuild /verbosity:minimal nsis_package.vcxproj + - msbuild /verbosity:minimal wireshark_nsis.vcxproj - C:\gitlab-builds\bin\sign-files.ps1 -Path packaging\nsis - msbuild /verbosity:minimal wix_package.vcxproj - C:\gitlab-builds\bin\sign-files.ps1 -Path packaging\wix diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d877ecbfe..0ddc11b964 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3131,8 +3131,8 @@ if (WIN32) if(MAKENSIS_EXECUTABLE) add_subdirectory( packaging/nsis EXCLUDE_FROM_ALL ) - ADD_NSIS_UNINSTALLER_TARGET() - ADD_NSIS_PACKAGE_TARGET() + ADD_NSIS_UNINSTALLER_TARGETS() + ADD_NSIS_PACKAGE_TARGETS() endif() find_package( WiX ) @@ -3339,7 +3339,7 @@ if(ENABLE_APPLICATION_BUNDLE AND BUILD_wireshark) ADD_CUSTOM_TARGET( wireshark_dmg COMMAND bash -x ${CMAKE_BINARY_DIR}/packaging/macosx/osx-dmg.sh - # Unlike nsis_package_prep + nsis_package, we can add a direct + # Unlike wireshark_nsis_prep + wireshark_nsis, we can add a direct # dependency here. DEPENDS wireshark_dmg_prep # We create Wireshark.app in "run". Do our work there. @@ -3393,7 +3393,7 @@ if(ENABLE_APPLICATION_BUNDLE AND BUILD_logwolf) # ADD_CUSTOM_TARGET( logwolf_dmg # COMMAND bash -x ${CMAKE_BINARY_DIR}/packaging/macosx/osx-dmg.sh - # # Unlike nsis_package_prep + nsis_package, we can add a direct + # # Unlike wireshark_nsis_prep + wireshark_nsis, we can add a direct # # dependency here. # DEPENDS wireshark_dmg_prep # # We create Wireshark.app in "run". Do our work there. diff --git a/appveyor.yml b/appveyor.yml index df9e15d962..f2709cdd4c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -44,8 +44,8 @@ before_build: - cmake -E time cmake -DCMAKE_SYSTEM_VERSION=10.0.20348.0 -G "%CMAKE_GENERATOR%" .. after_build: - - msbuild /m nsis_package_prep.vcxproj - - msbuild /m nsis_package.vcxproj + - msbuild /m wireshark_nsis_prep.vcxproj + - msbuild /m wireshark_nsis.vcxproj # Publish installers only for development branches to avoid exceeding the # artifact storage limit of 50 GB. - ps: | diff --git a/docbook/wsdg_src/WSDG_chapter_quick_setup.adoc b/docbook/wsdg_src/WSDG_chapter_quick_setup.adoc index 63469b9b49..9461c912d9 100644 --- a/docbook/wsdg_src/WSDG_chapter_quick_setup.adoc +++ b/docbook/wsdg_src/WSDG_chapter_quick_setup.adoc @@ -667,12 +667,12 @@ If you've closed the Visual Studio Command Prompt < msbuild /m /p:Configuration=RelWithDebInfo nsis_package_prep.vcxproj -> msbuild /m /p:Configuration=RelWithDebInfo nsis_package.vcxproj +> msbuild /m /p:Configuration=RelWithDebInfo wireshark_nsis_prep.vcxproj +> msbuild /m /p:Configuration=RelWithDebInfo wireshark_nsis.vcxproj ---- -to build a Wireshark installer. If you sign your executables you should do -so between the “nsis_package_prep” and “nsis_package” steps. +to build a Wireshark installer. +If you sign your executables you should do so between the “wireshark_nsis_prep” and “wireshark_nsis” steps. Run diff --git a/docbook/wsdg_src/WSDG_chapter_sources.adoc b/docbook/wsdg_src/WSDG_chapter_sources.adoc index 8f46ad0048..94610709e4 100644 --- a/docbook/wsdg_src/WSDG_chapter_sources.adoc +++ b/docbook/wsdg_src/WSDG_chapter_sources.adoc @@ -1022,18 +1022,16 @@ to build the macOS Packages. ==== Windows: NSIS .exe Installer -The _Nullsoft Install System_ is a free installer generator for Windows -systems. Instructions on installing it can be found in <>. -NSIS is script based. You can find the main Wireshark installer -generation script at _packaging/nsis/wireshark.nsi_. +The _Nullsoft Install System_ is a free installer generator for Windows systems. +Instructions on installing it can be found in <>. +NSIS is script based. You can find the main Wireshark installer generation script at _packaging/nsis/wireshark.nsi_. -When building with CMake you must first build the _nsis_package_prep_ target, -followed by the _nsis_package_ target, e.g. +When building with CMake you must first build the _wireshark_nsis_prep_ target, followed by the _wireshark_nsis_ target, e.g. [source,cmd] ---- -> msbuild /m /p:Configuration=RelWithDebInfo nsis_package_prep.vcxproj -> msbuild /m /p:Configuration=RelWithDebInfo nsis_package.vcxproj +> msbuild /m /p:Configuration=RelWithDebInfo wireshark_nsis_prep.vcxproj +> msbuild /m /p:Configuration=RelWithDebInfo wireshark_nsis.vcxproj ---- Splitting the packaging projects in this way allows for code signing. @@ -1064,13 +1062,13 @@ will place it in `C:\PortableApps`. Add the following apps: - PortableApps.com Launcher - PortableApps.com AppCompactor -When building with CMake you must first build the _nsis_package_prep_ target +When building with CMake you must first build the _wireshark_nsis_prep_ target (which takes care of general packaging dependencies), followed by the _portableapps_package_ target, e.g. [source,cmd] ---- -> msbuild /m /p:Configuration=RelWithDebInfo nsis_package_prep.vcxproj +> msbuild /m /p:Configuration=RelWithDebInfo wireshark_nsis_prep.vcxproj > msbuild /m /p:Configuration=RelWithDebInfo portableapps_package.vcxproj ---- diff --git a/packaging/nsis/CMakeLists.txt b/packaging/nsis/CMakeLists.txt index 0d727ffbe6..c3559e4854 100644 --- a/packaging/nsis/CMakeLists.txt +++ b/packaging/nsis/CMakeLists.txt @@ -8,25 +8,25 @@ # # We should use CPack to generate the NSIS package. Even better, -# we should use CPack to create a .msi using WIX. +# we should use CPack to create a .msi using WiX. -set(NSIS_GENERATED_FILES - ${CMAKE_CURRENT_BINARY_DIR}/all-manifest.nsh +set(WIRESHARK_NSIS_GENERATED_FILES + ${CMAKE_CURRENT_BINARY_DIR}/wireshark-manifest.nsh ${CMAKE_CURRENT_BINARY_DIR}/config.nsh - ${CMAKE_CURRENT_BINARY_DIR}/qt-dll-manifest.nsh + ${CMAKE_CURRENT_BINARY_DIR}/wireshark-qt-manifest.nsh ) -set(NSIS_GENERATED_FILES ${NSIS_GENERATED_FILES} PARENT_SCOPE) +set(WIRESHARK_NSIS_GENERATED_FILES ${WIRESHARK_NSIS_GENERATED_FILES} PARENT_SCOPE) -set(NSIS_FILES +set(WIRESHARK_NSIS_FILES wireshark.nsi - uninstall.nsi - common.nsh + uninstall-wireshark.nsi + wireshark-common.nsh GetWindowsVersion.nsh servicelib.nsh AdditionalTasksPage.ini NpcapPage.ini USBPcapPage.ini - ${NSIS_GENERATED_FILES} + ${WIRESHARK_NSIS_GENERATED_FILES} PARENT_SCOPE ) @@ -140,8 +140,8 @@ string(REPLACE "#define" "!define" _config_nsh_contents "${_config_nsh_contents} string(REPLACE "#undef" "!undef" _config_nsh_contents "${_config_nsh_contents}") file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/config.nsh" "${_config_nsh_contents}") -# all-manifest.nsh. Can be created at configure time. -set(_all_manifest "${CMAKE_CURRENT_BINARY_DIR}/all-manifest.nsh") +# wireshark-manifest.nsh. Can be created at configure time. +set(_all_manifest "${CMAKE_CURRENT_BINARY_DIR}/wireshark-manifest.nsh") set(_all_manifest_contents "# Files required for all sections. Generated by CMake.\n") set(_all_manifest_contents "${_all_manifest_contents}!ifdef BUNDLE_DEBUG_DLLS\n") foreach(_dll ${GLIB2_DLLS_DEBUG}) @@ -181,32 +181,33 @@ set(NSIS_OPTIONS ) # We want to sign all of the executables that we ship in the official -# installers. This means that uninstall.exe must be built separately AND -# that building the installer itself won't overwrite uninstall.exe -macro( ADD_NSIS_UNINSTALLER_TARGET ) +# installers. This means that uninstall-wireshark.exe must be built +# separately AND that building the installer itself won't overwrite +# uninstall-wireshark.exe +macro( ADD_NSIS_UNINSTALLER_TARGETS ) + set (_nsis_source_dir ${CMAKE_SOURCE_DIR}/packaging/nsis ) + set (_nsis_binary_dir ${CMAKE_BINARY_DIR}/packaging/nsis ) + # # XXX - if we're not building Wireshark, we can't build # anything, so there's nothing to uninstall. # if(BUILD_wireshark) - set (_nsis_source_dir ${CMAKE_SOURCE_DIR}/packaging/nsis ) - set (_nsis_binary_dir ${CMAKE_BINARY_DIR}/packaging/nsis ) - - add_custom_command(OUTPUT ${DATAFILE_DIR}/uninstall.exe - DEPENDS ${_nsis_source_dir}/uninstall.nsi - ${_nsis_source_dir}/common.nsh + add_custom_command(OUTPUT ${DATAFILE_DIR}/uninstall-wireshark.exe + DEPENDS ${_nsis_source_dir}/uninstall-wireshark.nsi + ${_nsis_source_dir}/wireshark-common.nsh COMMAND ${MAKENSIS_EXECUTABLE} ${NSIS_OPTIONS} - uninstall.nsi - COMMAND ${POWERSHELL_COMMAND} "${_nsis_source_dir}/makeUninstall.ps1" ${DATAFILE_DIR}/uninstall_installer.exe - COMMAND ${CMAKE_COMMAND} -E remove ${DATAFILE_DIR}/uninstall_installer.exe + uninstall-wireshark.nsi + COMMAND ${POWERSHELL_COMMAND} "${_nsis_source_dir}/makeUninstall.ps1" ${DATAFILE_DIR}/uninstall_wireshark_installer.exe + COMMAND ${CMAKE_COMMAND} -E remove ${DATAFILE_DIR}/uninstall_wireshark_installer.exe WORKING_DIRECTORY ${_nsis_source_dir} ) else() message(WARNING "The NSIS installer cannot be built if the Wireshark program isn't built.") endif() -endmacro( ADD_NSIS_UNINSTALLER_TARGET ) +endmacro( ADD_NSIS_UNINSTALLER_TARGETS ) -macro( ADD_NSIS_PACKAGE_TARGET ) +macro( ADD_NSIS_PACKAGE_TARGETS ) # # XXX - if we're not building Wireshark, we can't build the # manifest below. On the other hand, if we're not building @@ -218,28 +219,28 @@ macro( ADD_NSIS_PACKAGE_TARGET ) if(BUILD_wireshark) #set (_nsis_package ${CMAKE_BINARY_DIR}/packaging/nsis/Wireshark-$(WIRESHARK_TARGET_PLATFORM)-$(VERSION).exe) - # qt-dll-manifest.nsh. Created using Wireshark.exe. - add_custom_command(OUTPUT ${_nsis_binary_dir}/qt-dll-manifest.nsh + # wireshark-qt-manifest.nsh. Created using Wireshark.exe. + add_custom_command(OUTPUT ${_nsis_binary_dir}/wireshark-qt-manifest.nsh COMMAND set "PATH=${QT_BIN_PATH};%PATH%" COMMAND ${POWERSHELL_COMMAND} "${_nsis_source_dir}/windeployqt-to-nsis.ps1" -Executable $ - -FilePath ${_nsis_binary_dir}/qt-dll-manifest.nsh + -FilePath ${_nsis_binary_dir}/wireshark-qt-manifest.nsh $<$:-DebugConfig> DEPENDS "${_nsis_source_dir}/windeployqt-to-nsis.ps1" ) # Build NSIS package dependencies. We build the package in - # two stages so that nsis_package below doesn't trigger + # two stages so that wireshark_nsis below doesn't trigger # any dependencies that might clobber any signed executables. - add_custom_target(nsis_package_prep + add_custom_target(wireshark_nsis_prep DEPENDS - ${NSIS_FILES} + ${WIRESHARK_NSIS_FILES} copy_data_files user_guide_html faq_html - ${DATAFILE_DIR}/uninstall.exe + ${DATAFILE_DIR}/uninstall-wireshark.exe ) - set_target_properties(nsis_package_prep PROPERTIES + set_target_properties(wireshark_nsis_prep PROPERTIES FOLDER "Packaging" EXCLUDE_FROM_DEFAULT_BUILD True ) @@ -247,25 +248,25 @@ macro( ADD_NSIS_PACKAGE_TARGET ) # Dump the installer into # ${CMAKE_CURRENT_SOURCE_DIR}/packaging/nsis # Note that executables and DLLs *must* be built separately - add_custom_target(nsis_package + add_custom_target(wireshark_nsis COMMAND ${MAKENSIS_EXECUTABLE} ${NSIS_OPTIONS} $<$:/DBUNDLE_DEBUG_DLLS> wireshark.nsi WORKING_DIRECTORY ${_nsis_source_dir} ) - set_target_properties(nsis_package PROPERTIES + set_target_properties(wireshark_nsis PROPERTIES FOLDER "Packaging" EXCLUDE_FROM_DEFAULT_BUILD True ) endif() -endmacro( ADD_NSIS_PACKAGE_TARGET ) +endmacro( ADD_NSIS_PACKAGE_TARGETS ) set(CLEAN_FILES - all-manifest.nsh + wireshark-manifest.nsh config.nsh #NEWS.txt - qt-dll-manifest.nsh + wireshark-qt-manifest.nsh #user-guide.chm - ${DATAFILE_DIR}/uninstall.exe + ${DATAFILE_DIR}/uninstall-wireshark.exe wireshark-$(WIRESHARK_TARGET_PLATFORM)-$(VERSION).exe ) diff --git a/packaging/nsis/common.nsh b/packaging/nsis/common.nsh deleted file mode 100644 index 82a7c5d1b1..0000000000 --- a/packaging/nsis/common.nsh +++ /dev/null @@ -1,172 +0,0 @@ - -; ============================================================================ -; Name and version information -; ============================================================================ - -Unicode true -; This improves the installer's appearance considerably here on a display scaled -; to 225%, but checkboxes are comically small. We might be able to fix this -; using the SysCompImg extension: -; http://forums.winamp.com/showthread.php?t=443754 -ManifestDPIAware true -; These might be correct in the future, but are currently undocumented: -; http://forums.winamp.com/showthread.php?t=452632 -; ManifestDPIAware System -; ManifestDPIAwareness "PerMonitorV2,System" - -!ifdef NSIS_INCLUDE_DIR -!addincludedir ${NSIS_INCLUDE_DIR} -!endif - -!include "config.nsh" - -!if ${WIRESHARK_TARGET_PLATFORM} == "win32" -!define BITS 32 -!else -!define BITS 64 -!endif - -!define DISPLAY_NAME "${PROGRAM_NAME} ${VERSION} ${BITS}-bit" -Name "${DISPLAY_NAME}" - -!define PROGRAM_FULL_NAME "The ${PROGRAM_NAME} Network Protocol Analyzer" -!define PROGRAM_NAME_PATH "${PROGRAM_NAME}.exe" - -!define UNINSTALLER_NAME "uninstall.exe" - -VIAddVersionKey "ProductName" "${PROGRAM_NAME}" -VIAddVersionKey "Comments" "It's a great product with a great story to tell. I'm pumped!" -VIAddVersionKey "CompanyName" "${PROGRAM_NAME} development team" -; NSIS handles U+00a9 but not a UTF-8 encoded copyright symbol. -VIAddVersionKey "LegalCopyright" "${U+00a9} Gerald Combs and many others" -VIAddVersionKey "LegalTrademarks" "Wireshark and the 'fin' logo are registered trademarks of the Wireshark Foundation" -VIAddVersionKey "FileDescription" "${PROGRAM_NAME} installer for ${BITS}-bit Windows" -VIAddVersionKey "Language" "English" -VIAddVersionKey "ProductVersion" "${PRODUCT_VERSION}" -VIAddVersionKey "FileVersion" "${PRODUCT_VERSION}" -VIProductVersion "${PRODUCT_VERSION}" - -XPStyle on - - -; ============================================================================ -; Functions and macros -; ============================================================================ - -; Used to refresh the display of file association -!define SHCNE_ASSOCCHANGED 0x08000000 -!define SHCNF_IDLIST 0 - -!macro UpdateIcons - Push $R0 - Push $R1 - Push $R2 - - !define UPDATEICONS_UNIQUE ${__LINE__} - - 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} - -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} - -UpdateIcons.quit_${UPDATEICONS_UNIQUE}: - !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 -IfFileExists "$SYSDIR\ie4uinit.exe" 0 +2 -Exec '"$SYSDIR\ie4uinit.exe" -ClearIconCache' - -!macroend - -; ============================================================================ -; Push our known file extensions onto the stack, prepended with a marker -; Note that this is a subset of dump_open_table in wiretap/file_access.c. We -; probably don't want to grab JPEG or MP3 files. -; ============================================================================ - -; Used to add associations between file extensions and Wireshark -!define WIRESHARK_ASSOC "wireshark-capture-file" - -!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" -!macroend - -!macro IsWiresharkRunning -; See if Wireshark is running -; 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 - -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)' - -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 - -notRunning: - ${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/makeUninstall.ps1 b/packaging/nsis/makeUninstall.ps1 index a0e68e5c78..601b3ff61c 100644 --- a/packaging/nsis/makeUninstall.ps1 +++ b/packaging/nsis/makeUninstall.ps1 @@ -15,24 +15,24 @@ <# .SYNOPSIS -Runs the uninstaller_installer without invoking UAC. +Runs the uninstall__installer without invoking UAC. .DESCRIPTION -This script runs the uninstaller_installer that creates uninstall.exe -but without invoking a UAC elevation prompt that is required by the -uninstaller +This script runs the uninstall__installer that creates an +uninstall exe but without invoking a UAC elevation prompt that is required +by the uninstaller .PARAMETER Executable -The path to the uninstaller_installer.exe +The path to the uninstall__installer.exe .INPUTS -Executable Path to the uninstaller installer. .OUTPUTS -An unsigned uninstall.exe for signing +An unsigned uninstall-.exe for signing .EXAMPLE -C:\PS> .\makeUninstall.ps1 run\RelWithDebInfo\uninstall_installer.exe +C:\PS> .\makeUninstall.ps1 run\RelWithDebInfo\uninstall_wireshark_installer.exe #> Param( diff --git a/packaging/nsis/uninstall-wireshark.nsi b/packaging/nsis/uninstall-wireshark.nsi new file mode 100644 index 0000000000..12ef55a4f8 --- /dev/null +++ b/packaging/nsis/uninstall-wireshark.nsi @@ -0,0 +1,350 @@ +; +; uninstall-wireshark.nsi +; + +; Create an installer that only writes an uninstaller. +; https://nsis.sourceforge.io/Signing_an_Uninstaller + +!include "wireshark-common.nsh" +!include 'LogicLib.nsh' +!include x64.nsh +!include "StrFunc.nsh" +${UnStrRep} + +SetCompress off +OutFile "${STAGING_DIR}\uninstall_wireshark_installer.exe" + +InstType "un.Default (keep Personal Settings and Npcap)" +InstType "un.All (remove all)" + +; Uninstaller icon +UninstallIcon "..\..\resources\icons\wiresharkinst.ico" + +!include "MUI.nsh" + +!define MUI_UNICON "..\..\resources\icons\wiresharkinst.ico" + +; Uninstall stuff (NSIS 2.08: "\r\n" don't work here) +!define MUI_UNCONFIRMPAGE_TEXT_TOP "The following ${PROGRAM_NAME} installation will be removed. Click 'Next' to continue." +; Uninstall stuff (this text isn't used with the MODERN_UI!) +;UninstallText "This will uninstall ${PROGRAM_NAME}.\r\nBefore starting the uninstallation, make sure ${PROGRAM_NAME} is not running.\r\nClick 'Next' to continue." + +!define MUI_UNFINISHPAGE_NOAUTOCLOSE +!define MUI_WELCOMEPAGE_TITLE_3LINES +!define MUI_FINISHPAGE_TITLE_3LINES + +!insertmacro MUI_UNPAGE_WELCOME +!insertmacro MUI_UNPAGE_CONFIRM +!insertmacro MUI_UNPAGE_COMPONENTS +!insertmacro MUI_UNPAGE_INSTFILES +!insertmacro MUI_UNPAGE_FINISH + +!insertmacro MUI_LANGUAGE "English" + +; ============================================================================ +; Section macros +; ============================================================================ +!include "Sections.nsh" + +; ============================================================================ +; Uninstall page configuration +; ============================================================================ +ShowUninstDetails show + +; ============================================================================ +; Functions and macros +; ============================================================================ + +Function .onInit + ; MUST be the absolute path to our staging directory. + WriteUninstaller "${STAGING_DIR}\${UNINSTALLER_NAME}" + SetErrorLevel 0 + Quit +FunctionEnd + +Var EXTENSION +Function un.Disassociate + 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 +un.Disassociate.doDeregister: + ; 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 $R0 +FunctionEnd + +Section "-Required" +SectionEnd + +!define EXECUTABLE_MARKER "EXECUTABLE_MARKER" +Var EXECUTABLE + +Section /o "Un.USBPcap" un.SecUSBPcap +;------------------------------------------- +SectionIn 2 +${If} ${RunningX64} + ${DisableX64FSRedirection} + SetRegView 64 +${EndIf} +ReadRegStr $1 HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\USBPcap" "UninstallString" +${If} ${RunningX64} + ${EnableX64FSRedirection} + SetRegView 32 +${EndIf} +${If} $1 != "" + ${UnStrRep} $2 '$1' '\Uninstall.exe' '' + ${UnStrRep} $3 '$2' '"' '' + ExecWait '$1 _?=$3' $0 + DetailPrint "USBPcap uninstaller returned $0" + ${If} $0 == "0" + Delete "$3\Uninstall.exe" + Delete "$INSTDIR\extcap\USBPcapCMD.exe" + ${EndIf} +${EndIf} +ClearErrors +SectionEnd + + +Section "Uninstall" un.SecUinstall +;------------------------------------------- +; +; UnInstall for every user +; +SectionIn 1 2 +SetShellVarContext all + +!insertmacro IsWiresharkRunning + +Push "${EXECUTABLE_MARKER}" +Push "${PROGRAM_NAME}" +Push "androiddump" +Push "capinfos" +Push "captype" +Push "ciscodump" +Push "dftest" +Push "dumpcap" +Push "editcap" +Push "mergecap" +Push "randpkt" +Push "randpktdump" +Push "rawshark" +Push "reordercap" +Push "sshdump" +Push "text2pcap" +Push "tshark" +Push "udpdump" +Push "wifidump" + +!ifdef MMDBRESOLVE_EXE +Push "mmdbresolve" +!endif + +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." + +deletionSuccess: + Pop $EXECUTABLE + +${Loop} + + +DeleteRegKey HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PROGRAM_NAME}" +DeleteRegKey HKEY_LOCAL_MACHINE "Software\${PROGRAM_NAME}" +DeleteRegKey HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\App Paths\${PROGRAM_NAME}.exe" + +Call un.Disassociate + +DeleteRegKey HKCR ${WIRESHARK_ASSOC} +DeleteRegKey HKCR "${WIRESHARK_ASSOC}\Shell\open\command" +DeleteRegKey HKCR "${WIRESHARK_ASSOC}\DefaultIcon" + +Delete "$INSTDIR\*.dll" +Delete "$INSTDIR\*.exe" +Delete "$INSTDIR\*.html" +Delete "$INSTDIR\*.qm" +Delete "$INSTDIR\accessible\*.*" +Delete "$INSTDIR\AUTHORS-SHORT" +Delete "$INSTDIR\COPYING*" +Delete "$INSTDIR\audio\*.*" +Delete "$INSTDIR\bearer\*.*" +Delete "$INSTDIR\diameter\*.*" +Delete "$INSTDIR\extcap\androiddump.*" +Delete "$INSTDIR\extcap\randpktdump.*" +Delete "$INSTDIR\extcap\sshdump.*" +Delete "$INSTDIR\extcap\ciscodump.*" +Delete "$INSTDIR\extcap\udpdump.*" +Delete "$INSTDIR\extcap\wifidump.*" +Delete "$INSTDIR\help\*.*" +Delete "$INSTDIR\iconengines\*.*" +Delete "$INSTDIR\imageformats\*.*" +Delete "$INSTDIR\mediaservice\*.*" +Delete "$INSTDIR\platforms\*.*" +Delete "$INSTDIR\playlistformats\*.*" +Delete "$INSTDIR\printsupport\*.*" +Delete "$INSTDIR\share\glib-2.0\schemas\*.*" +Delete "$INSTDIR\snmp\*.*" +Delete "$INSTDIR\snmp\mibs\*.*" +Delete "$INSTDIR\styles\translations\*.*" +Delete "$INSTDIR\styles\*.*" +Delete "$INSTDIR\protobuf\*.*" +Delete "$INSTDIR\tpncp\*.*" +Delete "$INSTDIR\translations\*.*" +Delete "$INSTDIR\ui\*.*" +Delete "$INSTDIR\wimaxasncp\*.*" +Delete "$INSTDIR\ws.css" +; previous versions installed these files +Delete "$INSTDIR\*.manifest" +; previous versions installed this file +Delete "$INSTDIR\AUTHORS-SHORT-FORMAT" +Delete "$INSTDIR\README*" +Delete "$INSTDIR\NEWS.txt" +Delete "$INSTDIR\manuf" +Delete "$INSTDIR\wka" +Delete "$INSTDIR\services" +Delete "$INSTDIR\pdml2html.xsl" +Delete "$INSTDIR\pcrepattern.3.txt" +Delete "$INSTDIR\user-guide.chm" +Delete "$INSTDIR\example_snmp_users_file" +Delete "$INSTDIR\ipmap.html" +Delete "$INSTDIR\radius\*.*" +Delete "$INSTDIR\dtds\*.*" + +RMDir "$INSTDIR\accessible" +RMDir "$INSTDIR\audio" +RMDir "$INSTDIR\bearer" +RMDir "$INSTDIR\extcap" +RMDir "$INSTDIR\iconengines" +RMDir "$INSTDIR\imageformats" +RMDir "$INSTDIR\mediaservice" +RMDir "$INSTDIR\platforms" +RMDir "$INSTDIR\playlistformats" +RMDir "$INSTDIR\printsupport" +RMDir "$INSTDIR\share\themes\Default\gtk-2.0" +RMDir "$INSTDIR\share\themes\Default" +RMDir "$INSTDIR\share\themes" +RMDir "$INSTDIR\share" +RMDir "$INSTDIR\styles\translations" +RMDir "$INSTDIR\styles" +RMDir "$SMPROGRAMS\${PROGRAM_NAME}" +RMDir "$INSTDIR\help" +RMDir /r "$INSTDIR\Wireshark User's Guide" +RMDir "$INSTDIR\diameter" +RMDir "$INSTDIR\snmp\mibs" +RMDir "$INSTDIR\snmp" +RMDir "$INSTDIR\radius" +RMDir "$INSTDIR\dtds" +RMDir "$INSTDIR\protobuf" +RMDir "$INSTDIR\tpncp" +RMDir "$INSTDIR\translations" +RMDir "$INSTDIR\ui" +RMDir "$INSTDIR\wimaxasncp" +RMDir "$INSTDIR" + +SectionEnd ; "Uinstall" + +Section "Un.Plugins" un.SecPlugins +;------------------------------------------- +SectionIn 1 2 +;Delete "$INSTDIR\plugins\${VERSION}\*.*" +;Delete "$INSTDIR\plugins\*.*" +;RMDir "$INSTDIR\plugins\${VERSION}" +;RMDir "$INSTDIR\plugins" +RMDir /r "$INSTDIR\plugins" +SectionEnd + +Section "Un.Global Profiles" un.SecProfiles +;------------------------------------------- +SectionIn 1 2 +RMDir /r "$INSTDIR\profiles" +SectionEnd + +Section "Un.Global Settings" un.SecGlobalSettings +;------------------------------------------- +SectionIn 1 2 +Delete "$INSTDIR\cfilters" +Delete "$INSTDIR\colorfilters" +Delete "$INSTDIR\dfilters" +Delete "$INSTDIR\enterprises.tsv" +Delete "$INSTDIR\init.lua" +Delete "$INSTDIR\console.lua" +Delete "$INSTDIR\dtd_gen.lua" +Delete "$INSTDIR\smi_modules" +RMDir "$INSTDIR" +SectionEnd + +Section /o "Un.Personal Settings" un.SecPersonalSettings +;------------------------------------------- +SectionIn 2 +SetShellVarContext current +Delete "$APPDATA\${PROGRAM_NAME}\*.*" +RMDir "$APPDATA\${PROGRAM_NAME}" +DeleteRegKey HKCU "Software\${PROGRAM_NAME}" +SectionEnd + +;VAR un.NPCAP_UNINSTALL + +Section /o "Un.Npcap" un.SecNpcap +;------------------------------------------- +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 +${EndIf} +;un.lbl_npcap_notinstalled: +SectionEnd + +Section "-Un.Finally" +;------------------------------------------- +SectionIn 1 2 + +!insertmacro UpdateIcons + +; this test must be done after all other things uninstalled (e.g. Global Settings) +IfFileExists "$INSTDIR" 0 NoFinalErrorMsg + MessageBox MB_OK "Unable to remove $INSTDIR." /SD IDOK IDOK 0 ; skipped if dir doesn't exist +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_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/uninstall.nsi b/packaging/nsis/uninstall.nsi deleted file mode 100644 index ec4ca0037d..0000000000 --- a/packaging/nsis/uninstall.nsi +++ /dev/null @@ -1,402 +0,0 @@ -; -; uninstall.nsi -; - -; Create an installer that only writes an uninstaller. -; https://nsis.sourceforge.io/Signing_an_Uninstaller - -!include "common.nsh" -!include 'LogicLib.nsh' -!include x64.nsh -!include "StrFunc.nsh" -${UnStrRep} - -SetCompress off -OutFile "${STAGING_DIR}\uninstall_installer.exe" - -InstType "un.Default (keep Personal Settings and Npcap)" -InstType "un.All (remove all)" - -; Uninstaller icon -UninstallIcon "..\..\resources\icons\wiresharkinst.ico" - -!include "MUI.nsh" - -!define MUI_UNICON "..\..\resources\icons\wiresharkinst.ico" - -; Uninstall stuff (NSIS 2.08: "\r\n" don't work here) -!define MUI_UNCONFIRMPAGE_TEXT_TOP "The following ${PROGRAM_NAME} installation will be removed. Click 'Next' to continue." -; Uninstall stuff (this text isn't used with the MODERN_UI!) -;UninstallText "This will uninstall ${PROGRAM_NAME}.\r\nBefore starting the uninstallation, make sure ${PROGRAM_NAME} is not running.\r\nClick 'Next' to continue." - -!define MUI_UNFINISHPAGE_NOAUTOCLOSE -!define MUI_WELCOMEPAGE_TITLE_3LINES -!define MUI_FINISHPAGE_TITLE_3LINES - -!insertmacro MUI_UNPAGE_WELCOME -!insertmacro MUI_UNPAGE_CONFIRM -!insertmacro MUI_UNPAGE_COMPONENTS -!insertmacro MUI_UNPAGE_INSTFILES -!insertmacro MUI_UNPAGE_FINISH - -!insertmacro MUI_LANGUAGE "English" - -; ============================================================================ -; Section macros -; ============================================================================ -!include "Sections.nsh" - -; ============================================================================ -; Uninstall page configuration -; ============================================================================ -ShowUninstDetails show - -; ============================================================================ -; Functions and macros -; ============================================================================ - -Function .onInit - ; MUST be the absolute path to our staging directory. - WriteUninstaller "${STAGING_DIR}\${UNINSTALLER_NAME}" - SetErrorLevel 0 - Quit -FunctionEnd - -Var EXTENSION -Function un.Disassociate - 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 -un.Disassociate.doDeregister: - ; 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 $R0 -FunctionEnd - -Section "-Required" -SectionEnd - -!define EXECUTABLE_MARKER "EXECUTABLE_MARKER" -Var EXECUTABLE - -Section /o "Un.USBPcap" un.SecUSBPcap -;------------------------------------------- -SectionIn 2 -${If} ${RunningX64} - ${DisableX64FSRedirection} - SetRegView 64 -${EndIf} -ReadRegStr $1 HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\USBPcap" "UninstallString" -${If} ${RunningX64} - ${EnableX64FSRedirection} - SetRegView 32 -${EndIf} -${If} $1 != "" - ${UnStrRep} $2 '$1' '\Uninstall.exe' '' - ${UnStrRep} $3 '$2' '"' '' - ExecWait '$1 _?=$3' $0 - DetailPrint "USBPcap uninstaller returned $0" - ${If} $0 == "0" - Delete "$3\Uninstall.exe" - Delete "$INSTDIR\extcap\USBPcapCMD.exe" - ${EndIf} -${EndIf} -ClearErrors -SectionEnd - - -Section "Uninstall" un.SecUinstall -;------------------------------------------- -; -; UnInstall for every user -; -SectionIn 1 2 -SetShellVarContext all - -!insertmacro IsWiresharkRunning - -Push "${EXECUTABLE_MARKER}" -Push "${PROGRAM_NAME}" -Push "androiddump" -Push "capinfos" -Push "captype" -Push "ciscodump" -Push "dftest" -Push "dumpcap" -Push "editcap" -Push "mergecap" -Push "randpkt" -Push "randpktdump" -Push "rawshark" -Push "reordercap" -Push "sshdump" -Push "text2pcap" -Push "tshark" -Push "udpdump" -Push "wifidump" - -!ifdef MMDBRESOLVE_EXE -Push "mmdbresolve" -!endif - -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." - -deletionSuccess: - Pop $EXECUTABLE - -${Loop} - - -DeleteRegKey HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PROGRAM_NAME}" -DeleteRegKey HKEY_LOCAL_MACHINE "Software\${PROGRAM_NAME}" -DeleteRegKey HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\App Paths\${PROGRAM_NAME}.exe" - -Call un.Disassociate - -DeleteRegKey HKCR ${WIRESHARK_ASSOC} -DeleteRegKey HKCR "${WIRESHARK_ASSOC}\Shell\open\command" -DeleteRegKey HKCR "${WIRESHARK_ASSOC}\DefaultIcon" - -Delete "$INSTDIR\*.dll" -Delete "$INSTDIR\*.exe" -Delete "$INSTDIR\*.html" -Delete "$INSTDIR\*.qm" -Delete "$INSTDIR\accessible\*.*" -Delete "$INSTDIR\AUTHORS-SHORT" -Delete "$INSTDIR\COPYING*" -Delete "$INSTDIR\audio\*.*" -Delete "$INSTDIR\bearer\*.*" -Delete "$INSTDIR\diameter\*.*" -Delete "$INSTDIR\etc\gtk-2.0\*.*" -Delete "$INSTDIR\etc\gtk-3.0\*.*" -Delete "$INSTDIR\etc\pango\*.*" -Delete "$INSTDIR\extcap\androiddump.*" -Delete "$INSTDIR\extcap\randpktdump.*" -Delete "$INSTDIR\extcap\sshdump.*" -Delete "$INSTDIR\extcap\ciscodump.*" -Delete "$INSTDIR\extcap\udpdump.*" -Delete "$INSTDIR\extcap\wifidump.*" -Delete "$INSTDIR\help\*.*" -Delete "$INSTDIR\iconengines\*.*" -Delete "$INSTDIR\imageformats\*.*" -Delete "$INSTDIR\lib\gtk-2.0\2.10.0\engines\*.*" -Delete "$INSTDIR\lib\gtk-2.0\2.10.0\immodules\*.*" -Delete "$INSTDIR\lib\gtk-2.0\2.10.0\loaders\*.*" -Delete "$INSTDIR\lib\gtk-2.0\2.2.0\engines\*.*" -Delete "$INSTDIR\lib\gtk-2.0\2.2.0\immodules\*.*" -Delete "$INSTDIR\lib\gtk-2.0\2.2.0\loaders\*.*" -Delete "$INSTDIR\lib\gtk-2.0\2.4.0\engines\*.*" -Delete "$INSTDIR\lib\gtk-2.0\2.4.0\immodules\*.*" -Delete "$INSTDIR\lib\gtk-2.0\2.4.0\loaders\*.*" -Delete "$INSTDIR\lib\gtk-2.0\modules\*.*" -Delete "$INSTDIR\lib\pango\1.2.0\modules\*.*" -Delete "$INSTDIR\lib\pango\1.4.0\modules\*.*" -Delete "$INSTDIR\lib\pango\1.5.0\modules\*.*" -Delete "$INSTDIR\mediaservice\*.*" -Delete "$INSTDIR\platforms\*.*" -Delete "$INSTDIR\playlistformats\*.*" -Delete "$INSTDIR\printsupport\*.*" -Delete "$INSTDIR\share\glib-2.0\schemas\*.*" -Delete "$INSTDIR\share\themes\Default\gtk-2.0\*.*" -Delete "$INSTDIR\snmp\*.*" -Delete "$INSTDIR\snmp\mibs\*.*" -Delete "$INSTDIR\styles\translations\*.*" -Delete "$INSTDIR\styles\*.*" -Delete "$INSTDIR\protobuf\*.*" -Delete "$INSTDIR\tpncp\*.*" -Delete "$INSTDIR\translations\*.*" -Delete "$INSTDIR\ui\*.*" -Delete "$INSTDIR\wimaxasncp\*.*" -Delete "$INSTDIR\ws.css" -; previous versions installed these files -Delete "$INSTDIR\*.manifest" -; previous versions installed this file -Delete "$INSTDIR\AUTHORS-SHORT-FORMAT" -Delete "$INSTDIR\README*" -Delete "$INSTDIR\NEWS.txt" -Delete "$INSTDIR\manuf" -Delete "$INSTDIR\wka" -Delete "$INSTDIR\services" -Delete "$INSTDIR\pdml2html.xsl" -Delete "$INSTDIR\pcrepattern.3.txt" -Delete "$INSTDIR\user-guide.chm" -Delete "$INSTDIR\example_snmp_users_file" -Delete "$INSTDIR\ipmap.html" -Delete "$INSTDIR\radius\*.*" -Delete "$INSTDIR\dtds\*.*" - -!define PROGRAM_NAME_GTK "${PROGRAM_NAME} Legacy" -Delete "$SMPROGRAMS\${PROGRAM_NAME}\*.*" -Delete "$SMPROGRAMS\${PROGRAM_NAME}.lnk" -Delete "$SMPROGRAMS\${PROGRAM_NAME_GTK}.lnk" -Delete "$SMPROGRAMS\Qtshark.lnk" -Delete "$DESKTOP\${PROGRAM_NAME}.lnk" -Delete "$DESKTOP\${PROGRAM_NAME_GTK}.lnk" -Delete "$QUICKLAUNCH\${PROGRAM_NAME}.lnk" -Delete "$QUICKLAUNCH\${PROGRAM_NAME_GTK}.lnk" - -RMDir "$INSTDIR\accessible" -RMDir "$INSTDIR\audio" -RMDir "$INSTDIR\bearer" -RMDir "$INSTDIR\etc\gtk-2.0" -RMDir "$INSTDIR\etc\pango" -RMDir "$INSTDIR\etc" -RMDir "$INSTDIR\extcap" -RMDir "$INSTDIR\iconengines" -RMDir "$INSTDIR\imageformats" -RMDir "$INSTDIR\lib\gtk-2.0\2.2.0\engines" -RMDir "$INSTDIR\lib\gtk-2.0\2.2.0\loaders" -RMDir "$INSTDIR\lib\gtk-2.0\2.2.0\immodules" -RMDir "$INSTDIR\lib\gtk-2.0\2.2.0" -RMDir "$INSTDIR\lib\gtk-2.0\2.4.0\engines" -RMDir "$INSTDIR\lib\gtk-2.0\2.4.0\loaders" -RMDir "$INSTDIR\lib\gtk-2.0\2.4.0\immodules" -RMDir "$INSTDIR\lib\gtk-2.0\2.4.0" -RMDir "$INSTDIR\lib\gtk-2.0\2.10.0\engines" -RMDir "$INSTDIR\lib\gtk-2.0\2.10.0\loaders" -RMDir "$INSTDIR\lib\gtk-2.0\2.10.0\immodules" -RMDir "$INSTDIR\lib\gtk-2.0\2.10.0" -RMDir "$INSTDIR\lib\gtk-2.0\modules" -RMDir "$INSTDIR\lib\gtk-2.0" -RMDir "$INSTDIR\lib\pango\1.2.0\modules" -RMDir "$INSTDIR\lib\pango\1.2.0" -RMDir "$INSTDIR\lib\pango\1.4.0\modules" -RMDir "$INSTDIR\lib\pango\1.4.0" -RMDir "$INSTDIR\lib\pango\1.5.0\modules" -RMDir "$INSTDIR\lib\pango\1.5.0" -RMDir "$INSTDIR\lib\pango" -RMDir "$INSTDIR\lib" -RMDir "$INSTDIR\mediaservice" -RMDir "$INSTDIR\platforms" -RMDir "$INSTDIR\playlistformats" -RMDir "$INSTDIR\printsupport" -RMDir "$INSTDIR\share\themes\Default\gtk-2.0" -RMDir "$INSTDIR\share\themes\Default" -RMDir "$INSTDIR\share\themes" -RMDir "$INSTDIR\share" -RMDir "$INSTDIR\styles\translations" -RMDir "$INSTDIR\styles" -RMDir "$SMPROGRAMS\${PROGRAM_NAME}" -RMDir "$INSTDIR\help" -RMDir /r "$INSTDIR\Wireshark User's Guide" -RMDir "$INSTDIR\diameter" -RMDir "$INSTDIR\snmp\mibs" -RMDir "$INSTDIR\snmp" -RMDir "$INSTDIR\radius" -RMDir "$INSTDIR\dtds" -RMDir "$INSTDIR\protobuf" -RMDir "$INSTDIR\tpncp" -RMDir "$INSTDIR\translations" -RMDir "$INSTDIR\ui" -RMDir "$INSTDIR\wimaxasncp" -RMDir "$INSTDIR" - -SectionEnd ; "Uinstall" - -Section "Un.Plugins" un.SecPlugins -;------------------------------------------- -SectionIn 1 2 -;Delete "$INSTDIR\plugins\${VERSION}\*.*" -;Delete "$INSTDIR\plugins\*.*" -;RMDir "$INSTDIR\plugins\${VERSION}" -;RMDir "$INSTDIR\plugins" -RMDir /r "$INSTDIR\plugins" -SectionEnd - -Section "Un.Global Profiles" un.SecProfiles -;------------------------------------------- -SectionIn 1 2 -RMDir /r "$INSTDIR\profiles" -SectionEnd - -Section "Un.Global Settings" un.SecGlobalSettings -;------------------------------------------- -SectionIn 1 2 -Delete "$INSTDIR\cfilters" -Delete "$INSTDIR\colorfilters" -Delete "$INSTDIR\dfilters" -Delete "$INSTDIR\enterprises.tsv" -Delete "$INSTDIR\init.lua" -Delete "$INSTDIR\console.lua" -Delete "$INSTDIR\dtd_gen.lua" -Delete "$INSTDIR\smi_modules" -RMDir "$INSTDIR" -SectionEnd - -Section /o "Un.Personal Settings" un.SecPersonalSettings -;------------------------------------------- -SectionIn 2 -SetShellVarContext current -Delete "$APPDATA\${PROGRAM_NAME}\*.*" -RMDir "$APPDATA\${PROGRAM_NAME}" -DeleteRegKey HKCU "Software\${PROGRAM_NAME}" -SectionEnd - -;VAR un.NPCAP_UNINSTALL - -Section /o "Un.Npcap" un.SecNpcap -;------------------------------------------- -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 -${EndIf} -;un.lbl_npcap_notinstalled: -SectionEnd - -Section "-Un.Finally" -;------------------------------------------- -SectionIn 1 2 - -!insertmacro UpdateIcons - -; this test must be done after all other things uninstalled (e.g. Global Settings) -IfFileExists "$INSTDIR" 0 NoFinalErrorMsg - MessageBox MB_OK "Unable to remove $INSTDIR." /SD IDOK IDOK 0 ; skipped if dir doesn't exist -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_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/windeployqt-to-nsis.ps1 b/packaging/nsis/windeployqt-to-nsis.ps1 index dba9848ae6..14883f1a3a 100644 --- a/packaging/nsis/windeployqt-to-nsis.ps1 +++ b/packaging/nsis/windeployqt-to-nsis.ps1 @@ -41,7 +41,7 @@ Assume debug binaries. List of NSIS commands required to package supporting DLLs. .EXAMPLE -C:\PS> .\windeployqt-to-nsis.ps1 windeployqt.exe ..\..\staging\wireshark.exe qt-dll-manifest.nsh [-DebugConfig] +C:\PS> .\windeployqt-to-nsis.ps1 windeployqt.exe ..\..\staging\wireshark.exe wireshark-qt-manifest.nsh [-DebugConfig] #> Param( @@ -49,7 +49,7 @@ Param( [String] $Executable, [Parameter(Position=1)] - [String] $FilePath = "qt-dll-manifest.nsh", + [String] $FilePath = "wireshark-qt-manifest.nsh", [Parameter(Mandatory=$false)] [Switch] $DebugConfig diff --git a/packaging/nsis/wireshark-common.nsh b/packaging/nsis/wireshark-common.nsh new file mode 100644 index 0000000000..4ab7cb9845 --- /dev/null +++ b/packaging/nsis/wireshark-common.nsh @@ -0,0 +1,172 @@ + +; ============================================================================ +; Name and version information +; ============================================================================ + +Unicode true +; This improves the installer's appearance considerably here on a display scaled +; to 225%, but checkboxes are comically small. We might be able to fix this +; using the SysCompImg extension: +; http://forums.winamp.com/showthread.php?t=443754 +ManifestDPIAware true +; These might be correct in the future, but are currently undocumented: +; http://forums.winamp.com/showthread.php?t=452632 +; ManifestDPIAware System +; ManifestDPIAwareness "PerMonitorV2,System" + +!ifdef NSIS_INCLUDE_DIR +!addincludedir ${NSIS_INCLUDE_DIR} +!endif + +!include "config.nsh" + +!if ${WIRESHARK_TARGET_PLATFORM} == "win32" +!define BITS 32 +!else +!define BITS 64 +!endif + +!define DISPLAY_NAME "${PROGRAM_NAME} ${VERSION} ${BITS}-bit" +Name "${DISPLAY_NAME}" + +!define PROGRAM_FULL_NAME "The ${PROGRAM_NAME} Network Protocol Analyzer" +!define PROGRAM_NAME_PATH "${PROGRAM_NAME}.exe" + +!define UNINSTALLER_NAME "uninstall-wireshark.exe" + +VIAddVersionKey "ProductName" "${PROGRAM_NAME}" +VIAddVersionKey "Comments" "It's a great product with a great story to tell. I'm pumped!" +VIAddVersionKey "CompanyName" "${PROGRAM_NAME} development team" +; NSIS handles U+00a9 but not a UTF-8 encoded copyright symbol. +VIAddVersionKey "LegalCopyright" "${U+00a9} Gerald Combs and many others" +VIAddVersionKey "LegalTrademarks" "Wireshark and the 'fin' logo are registered trademarks of the Wireshark Foundation" +VIAddVersionKey "FileDescription" "${PROGRAM_NAME} installer for ${BITS}-bit Windows" +VIAddVersionKey "Language" "English" +VIAddVersionKey "ProductVersion" "${PRODUCT_VERSION}" +VIAddVersionKey "FileVersion" "${PRODUCT_VERSION}" +VIProductVersion "${PRODUCT_VERSION}" + +XPStyle on + + +; ============================================================================ +; Functions and macros +; ============================================================================ + +; Used to refresh the display of file association +!define SHCNE_ASSOCCHANGED 0x08000000 +!define SHCNF_IDLIST 0 + +!macro UpdateIcons + Push $R0 + Push $R1 + Push $R2 + + !define UPDATEICONS_UNIQUE ${__LINE__} + + 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} + +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} + +UpdateIcons.quit_${UPDATEICONS_UNIQUE}: + !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 +IfFileExists "$SYSDIR\ie4uinit.exe" 0 +2 +Exec '"$SYSDIR\ie4uinit.exe" -ClearIconCache' + +!macroend + +; ============================================================================ +; Push our known file extensions onto the stack, prepended with a marker +; Note that this is a subset of dump_open_table in wiretap/file_access.c. We +; probably don't want to grab JPEG or MP3 files. +; ============================================================================ + +; Used to add associations between file extensions and Wireshark +!define WIRESHARK_ASSOC "wireshark-capture-file" + +!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" +!macroend + +!macro IsWiresharkRunning +; See if Wireshark is running +; 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 + +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)' + +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 + +notRunning: + ${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 1429e3dc03..94cc11c699 100644 --- a/packaging/nsis/wireshark.nsi +++ b/packaging/nsis/wireshark.nsi @@ -10,7 +10,7 @@ SetCompressor /SOLID lzma SetCompressorDictSize 64 ; MB -!include "common.nsh" +!include "wireshark-common.nsh" !include 'LogicLib.nsh' !include "StrFunc.nsh" !include "WordFunc.nsh" @@ -515,7 +515,7 @@ File "${STAGING_DIR}\libwiretap.dll" File "${STAGING_DIR}\libwireshark.dll" File "${STAGING_DIR}\libwsutil.dll" -!include all-manifest.nsh +!include wireshark-manifest.nsh File "${STAGING_DIR}\COPYING.txt" File "${STAGING_DIR}\NEWS.txt" @@ -983,7 +983,7 @@ File "${QT_DIR}\${PROGRAM_NAME_PATH}" ; Write an entry for ShellExecute WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\App Paths\${PROGRAM_NAME_PATH}" "" '$INSTDIR\${PROGRAM_NAME_PATH}' WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\App Paths\${PROGRAM_NAME_PATH}" "Path" '$INSTDIR' -!include qt-dll-manifest.nsh +!include wireshark-qt-manifest.nsh ${!defineifexist} TRANSLATIONS_FOLDER "${QT_DIR}\translations" SetOutPath $INSTDIR diff --git a/packaging/portableapps/CMakeLists.txt b/packaging/portableapps/CMakeLists.txt index f2e0522789..83259375dd 100644 --- a/packaging/portableapps/CMakeLists.txt +++ b/packaging/portableapps/CMakeLists.txt @@ -79,7 +79,8 @@ macro( ADD_PORTABLEAPPS_PACKAGE_TARGET ) add_dependencies(portableapps_runtime portableapps_app_dir) # Build the PortableApps package. - # nsis_package_prep must be built prior to this. + # wireshark_nsis_prep must be built prior to this. + # XXX Rename this to wireshark_portableapps set (_portableapps_package ${CMAKE_BINARY_DIR}/packaging/portableapps/${PORTABLEAPPS_NAME}_${VERSION}.paf.exe) add_custom_target(portableapps_package DEPENDS diff --git a/packaging/wix/CMakeLists.txt b/packaging/wix/CMakeLists.txt index 4a7ca71060..9e7c5d9b2a 100644 --- a/packaging/wix/CMakeLists.txt +++ b/packaging/wix/CMakeLists.txt @@ -317,6 +317,7 @@ macro( ADD_WIX_PACKAGE_TARGET ) # Build WiX package dependencies. We build the package in # two stages so that wix_package below doesn't trigger any # dependencies that might clobber any signed executables. + # XXX Rename this to wireshark_wix_prep add_custom_target(wix_package_prep DEPENDS ${WIX_FILES} @@ -332,6 +333,7 @@ macro( ADD_WIX_PACKAGE_TARGET ) # Dump the installer into # ${CMAKE_CURRENT_SOURCE_DIR}/packaging/wix # Note that executables and DLLs *must* be built separately + # XXX Rename this to wireshark_wix add_custom_target(wix_package COMMAND ${WIX_CANDLE_EXECUTABLE} ${WIX_CANDLE_DEFINES} $<$:-dBUNDLE_DEBUG_DLLS> diff --git a/wiretap/file_access.c b/wiretap/file_access.c index 7b7e3f8b66..ec6bfba870 100644 --- a/wiretap/file_access.c +++ b/wiretap/file_access.c @@ -355,7 +355,7 @@ wtap_get_all_capture_file_extensions_list(void) * know that Wireshark can open the file: * 1) resources/freedesktop/org.wireshark.Wireshark-mime.xml (for freedesktop.org environments) * 2) packaging/macosx/WiresharkInfo.plist.in (for macOS) - * 3) packaging/nsis/AdditionalTasksPage.ini, packaging/nsis/common.nsh, + * 3) packaging/nsis/AdditionalTasksPage.ini, packaging/nsis/wireshark-common.nsh, * and packaging/wix/ComponentGroups.wxi (for Windows) * * If your file format has an expected extension (e.g., ".pcap") then you -- cgit v1.2.3