NSIS: Fixup the Logray installer
authorGerald Combs <gerald@wireshark.org>
Wed, 31 Jan 2024 18:48:39 +0000 (10:48 -0800)
committerGerald Combs <gerald@wireshark.org>
Wed, 31 Jan 2024 21:46:34 +0000 (21:46 +0000)
Merge the uninstall sections into logray.nsi, similar to wireshark.nsi.
Make a bunch of sections hidden + mandatory. Fix some miscellaneous
issues.

CMakeLists.txt
packaging/nsis/CMakeLists.txt
packaging/nsis/logray.nsi
packaging/nsis/uninstall-logray.nsi [deleted file]

index 5db243732bee96216b164a64bf625effd788ede7..2d4f436cbf8bf605cf755a5e3c19c3a2816f21db 100644 (file)
@@ -3365,7 +3365,6 @@ if(WIN32)
 
        if(MAKENSIS_EXECUTABLE)
                add_subdirectory( packaging/nsis EXCLUDE_FROM_ALL )
-               ADD_NSIS_UNINSTALLER_TARGETS()
                ADD_NSIS_PACKAGE_TARGETS()
        endif()
 
index a8925ecf3aa87df80cd8f892124f40fcc4194007..ff5775e6b3cb3cf94d261e4dcb117c182d8bb2ce 100644 (file)
@@ -38,7 +38,6 @@ set(LOGRAY_NSIS_GENERATED_FILES ${LOGRAY_NSIS_GENERATED_FILES} PARENT_SCOPE)
 
 set(LOGRAY_NSIS_FILES
        logray.nsi
-       uninstall-logray.nsi
        logray-common.nsh
        servicelib.nsh
        NpcapPage.ini
@@ -205,8 +204,8 @@ if (BUILD_logray)
        set(_all_manifest_contents "${_all_manifest_contents}!endif\n")
        foreach(_dll ${CARES_DLL} ${PCRE2_RELEASE_DLL} ${GCRYPT_DLLS}
                        ${GNUTLS_DLLS} ${KERBEROS_DLLS} ${LIBSSH_DLLS} ${LUA_DLL}
-                       ${LZ4_DLL} ${NGHTTP2_DLL} ${NGHTTP3_DLL} ${SBC_DLL} ${SMI_DLL} ${SNAPPY_DLL}
-                       ${SPANDSP_DLL} ${BCG729_DLL} ${LIBXML2_DLLS} ${WINSPARKLE_DLL}
+                       ${LZ4_DLL} ${MINIZIP_DLL} ${NGHTTP2_DLL} ${NGHTTP3_DLL} ${SBC_DLL} ${SMI_DLL}
+                       ${SNAPPY_DLL} ${SPANDSP_DLL} ${BCG729_DLL} ${LIBXML2_DLLS} ${WINSPARKLE_DLL}
                        ${ZLIB_DLL} ${BROTLI_DLLS} ${ZSTD_DLL} ${ILBC_DLL} ${OPUS_DLL}
                        ${SPEEXDSP_DLL}
                        # Needed for mmdbresolve
@@ -230,31 +229,6 @@ set(NSIS_OPTIONS
        PARENT_SCOPE
 )
 
-# We want to sign all of the executables that we ship in the official
-# 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_logray)
-               add_custom_command(OUTPUT ${DATAFILE_DIR}/uninstall-logray.exe
-                       DEPENDS ${_nsis_source_dir}/uninstall-logray.nsi
-                               ${_nsis_source_dir}/logray-common.nsh
-                       COMMAND ${MAKENSIS_EXECUTABLE} ${NSIS_OPTIONS}
-                               uninstall-logray.nsi
-                       COMMAND ${POWERSHELL_COMMAND} "${_nsis_source_dir}/makeUninstall.ps1" ${DATAFILE_DIR}/uninstall_logray_installer.exe
-                       COMMAND ${CMAKE_COMMAND} -E remove ${DATAFILE_DIR}/uninstall_logray_installer.exe
-                       WORKING_DIRECTORY ${_nsis_source_dir}
-               )
-       endif()
-endmacro( ADD_NSIS_UNINSTALLER_TARGETS )
-
 macro( ADD_NSIS_PACKAGE_TARGETS )
        set (_nsis_source_dir ${CMAKE_SOURCE_DIR}/packaging/nsis )
        set (_nsis_binary_dir ${CMAKE_BINARY_DIR}/packaging/nsis )
index c102dfe11f5c5bd4955e50268d50bad0f8ae6322..6ed9dba70833011d29a0837277972638aba86769 100644 (file)
@@ -54,6 +54,7 @@ Icon "${TOP_SRC_DIR}\resources\icons\lograyinst.ico"
 ;!addplugindir ".\Plugins"
 
 !define MUI_ICON "${TOP_SRC_DIR}\resources\icons\lograyinst.ico"
+!define MUI_UNICON "${TOP_SRC_DIR}\resources\icons\lograyinst.ico"
 BrandingText "Logray${U+00ae} Installer"
 
 !define MUI_COMPONENTSPAGE_SMALLDESC
@@ -109,6 +110,7 @@ Page custom DisplayAdditionalTasksPage LeaveAdditionalTasksPage
   ; Old Modern 1 UI: https://nsis.sourceforge.io/Docs/Modern%20UI/Readme.html
   ; To do: Upgrade to the Modern 2 UI:
   ;ReserveFile "AdditionalTasksPage.ini"
+  ;ReserveFile "DonatePage.ini"
   ReserveFile /plugin InstallOptions.dll
 
   ; Modern UI 2 / nsDialog pages.
@@ -242,7 +244,7 @@ Var OLD_INSTDIR
 Var OLD_DISPLAYNAME
 Var TMP_UNINSTALLER
 
-; WiX
+; WiX - XXX - Remove?
 Var REGISTRY_BITS
 Var TMP_PRODUCT_GUID
 Var WIX_DISPLAYNAME
@@ -266,6 +268,13 @@ Function .onInit
     ${EndIf}
   !endif
 
+  !if ${WIRESHARK_TARGET_PLATFORM} == "arm64"
+    ${IfNot} ${IsNativeARM64}
+      MessageBox MB_OK "You're trying to install the Arm64 version of Logray on an x64 system.$\nTry the native x64 installer instead." /SD IDOK
+      Abort
+    ${EndIf}
+  !endif
+
   ; 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
@@ -274,7 +283,6 @@ Function .onInit
   ; Uncomment to test.
   ; MessageBox MB_OK "You're running Windows $R0."
 
-
 ${If} ${AtMostWin8.1}
 ${OrIf} ${AtMostWin2012R2}
   MessageBox MB_OK \
@@ -282,7 +290,6 @@ ${OrIf} ${AtMostWin2012R2}
   Quit
 ${EndIf}
 
-lbl_winversion_supported:
 !insertmacro IsLograyRunning
 
   ; Default control values.
@@ -414,6 +421,11 @@ Function DisplayAdditionalTasksPage
 FunctionEnd
 !endif
 
+; Function DisplayDonatePage
+;   !insertmacro MUI_HEADER_TEXT "Your donations keep these releases coming" "Donate today"
+;   !insertmacro INSTALLOPTIONS_DISPLAY "DonatePage.ini"
+; FunctionEnd
+
 ; ============================================================================
 ; Installation execution commands
 ; ============================================================================
@@ -427,7 +439,7 @@ Section "-Required"
 SetShellVarContext all
 
 SetOutPath $INSTDIR
-File "${STAGING_DIR}\${UNINSTALLER_NAME}"
+WriteUninstaller "${STAGING_DIR}\${UNINSTALLER_NAME}"
 File "${STAGING_DIR}\libwiretap.dll"
 File "${STAGING_DIR}\libwireshark.dll"
 File "${STAGING_DIR}\libwsutil.dll"
@@ -437,7 +449,6 @@ File "${STAGING_DIR}\libwsutil.dll"
 File "${STAGING_DIR}\COPYING.txt"
 File "${STAGING_DIR}\NEWS.txt"
 File "${STAGING_DIR}\README.txt"
-File "${STAGING_DIR}\README.windows.txt"
 File "${STAGING_DIR}\wka"
 File "${STAGING_DIR}\pdml2html.xsl"
 File "${STAGING_DIR}\ws.css"
@@ -873,30 +884,23 @@ File "${STAGING_DIR}\tshark.exe"
 File "${STAGING_DIR}\tshark.html"
 SectionEnd
 
-SectionGroup "Plugins & Extensions" SecPluginsGroup
+Section "-Plugins & Extensions"
 
-Section "Dissector Plugins" SecPlugins
 ;-------------------------------------------
 SetOutPath '$INSTDIR\plugins\epan'
 File "${STAGING_DIR}\plugins\epan\falco-bridge.dll.${ABI_VERSION_EPAN}"
 SetOutPath '$INSTDIR\plugins\falco'
-File "${STAGING_DIR}\plugins\falco\cloudtrail.dll.${ABI_VERSION_EPAN}"
+File "${STAGING_DIR}\plugins\falco\cloudtrail.dll"
 !include "custom_plugins.txt"
-SectionEnd
 
-Section "Tree Statistics Plugin" SecStatsTree
 ;-------------------------------------------
 SetOutPath '$INSTDIR\plugins\epan'
 File "${STAGING_DIR}\plugins\epan\stats_tree.dll.${ABI_VERSION_EPAN}"
-SectionEnd
 
-Section "Mate - Meta Analysis and Tracing Engine" SecMate
 ;-------------------------------------------
 SetOutPath '$INSTDIR\plugins\epan'
 File "${STAGING_DIR}\plugins\epan\mate.dll.${ABI_VERSION_EPAN}"
-SectionEnd
 
-Section "Configuration Profiles" SecProfiles
 ;-------------------------------------------
 ; This should be a function or macro
 SetOutPath '$INSTDIR\profiles\Bluetooth'
@@ -906,10 +910,9 @@ SetOutPath '$INSTDIR\profiles\Classic'
 File "${STAGING_DIR}\profiles\Classic\colorfilters"
 SetOutPath '$INSTDIR\profiles\No Reassembly'
 File "${STAGING_DIR}\profiles\No Reassembly\preferences"
-SectionEnd
+
 
 !ifdef SMI_DIR
-Section "SNMP MIBs" SecMIBs
 ;-------------------------------------------
 SetOutPath '$INSTDIR\snmp\mibs'
 File "${SMI_DIR}\share\mibs\iana\*"
@@ -919,80 +922,66 @@ File "${SMI_DIR}\share\mibs\tubs\*"
 File "${SMI_DIR}\share\pibs\*"
 File "${SMI_DIR}\share\yang\*.yang"
 !include "custom_mibs.txt"
-SectionEnd
 !endif
 
-SectionGroupEnd ; "Plugins / Extensions"
-
-
-SectionGroup "Tools" SecToolsGroup
+SetOutPath '$INSTDIR\plugins\epan'
+File "${STAGING_DIR}\plugins\epan\transum.dll.${ABI_VERSION_EPAN}"
 
-Section "Editcap" SecEditcap
-;-------------------------------------------
-SetOutPath $INSTDIR
-File "${STAGING_DIR}\editcap.exe"
-File "${STAGING_DIR}\editcap.html"
-SectionEnd
+SetOutPath '$INSTDIR\plugins\epan'
+File "${STAGING_DIR}\plugins\epan\stats_tree.dll.${ABI_VERSION_EPAN}"
 
-Section "Text2Pcap" SecText2Pcap
-;-------------------------------------------
-SetOutPath $INSTDIR
-File "${STAGING_DIR}\text2pcap.exe"
-File "${STAGING_DIR}\text2pcap.html"
-SectionEnd
+SectionEnd ; "Plugins / Extensions"
 
-Section "Mergecap" SecMergecap
-;-------------------------------------------
-SetOutPath $INSTDIR
-File "${STAGING_DIR}\mergecap.exe"
-File "${STAGING_DIR}\mergecap.html"
-SectionEnd
+Section "-Additional command line tools"
 
-Section "Reordercap" SecReordercap
-;-------------------------------------------
-SetOutPath $INSTDIR
-File "${STAGING_DIR}\reordercap.exe"
-File "${STAGING_DIR}\reordercap.html"
-SectionEnd
-
-Section "Capinfos" SecCapinfos
-;-------------------------------------------
 SetOutPath $INSTDIR
 File "${STAGING_DIR}\capinfos.exe"
 File "${STAGING_DIR}\capinfos.html"
-SectionEnd
 
-Section "Captype" SecCaptype
-;-------------------------------------------
-SetOutPath $INSTDIR
 File "${STAGING_DIR}\captype.exe"
 File "${STAGING_DIR}\captype.html"
-SectionEnd
 
-Section /o "Randpkt" SecRandpkt
-;-------------------------------------------
-SetOutPath $INSTDIR
-File "${STAGING_DIR}\randpkt.exe"
-File "${STAGING_DIR}\randpkt.html"
-SectionEnd
+File "${STAGING_DIR}\editcap.exe"
+File "${STAGING_DIR}\editcap.html"
+
+File "${STAGING_DIR}\mergecap.exe"
+File "${STAGING_DIR}\mergecap.html"
 
 !ifdef MMDBRESOLVE_EXE
-Section "MMDBResolve" SecMMDBResolve
-;-------------------------------------------
-SetOutPath $INSTDIR
 File "${STAGING_DIR}\mmdbresolve.html"
-SetOutPath $INSTDIR
 File "${STAGING_DIR}\mmdbresolve.exe"
-SectionEnd
 !endif
 
-Section /o "Etwdump" SecEtwdump
+File "${STAGING_DIR}\randpkt.exe"
+File "${STAGING_DIR}\randpkt.html"
+
+File "${STAGING_DIR}\rawshark.exe"
+File "${STAGING_DIR}\rawshark.html"
+
+File "${STAGING_DIR}\reordercap.exe"
+File "${STAGING_DIR}\reordercap.html"
+
+File "${STAGING_DIR}\sharkd.exe"
+;File "${STAGING_DIR}\sharkd.html"
+
+File "${STAGING_DIR}\text2pcap.exe"
+File "${STAGING_DIR}\text2pcap.html"
+
+SectionEnd ; "Tools"
+
+SectionGroup /e "External capture tools (extcap)" SecExtcapGroup
+
+Section "Falcodump" SecFalcodump
 ;-------------------------------------------
-  !insertmacro InstallExtcap "Etwdump"
+  !insertmacro InstallExtcap "falcodump"
 SectionEnd
-!insertmacro CheckExtrasFlag "Etwdump"
+!insertmacro CheckExtrasFlag "falcodump"
+
+SectionGroupEnd ; "External Capture (extcap)"
 
-SectionGroupEnd ; "Tools"
+Section "-Clear Partial Selected"
+!insertmacro ClearSectionFlag ${SecExtcapGroup} ${SF_PSELECTED}
+SectionEnd
 
 !ifdef DOCBOOK_DIR
 !ifdef DOC_DIR
@@ -1018,41 +1007,265 @@ WriteRegDWORD HKEY_LOCAL_MACHINE "${UNINSTALL_PATH}" "EstimatedSize" "$0"
 
 SectionEnd
 
+; ============================================================================
+; Section macros
+; ============================================================================
+!include "Sections.nsh"
+
+; ============================================================================
+; Uninstall page configuration
+; ============================================================================
+ShowUninstDetails show
+
+; ============================================================================
+; Functions and macros
+; ============================================================================
+
+Function un.Disassociate
+  Push $R0
+!insertmacro PushFileExtensions
+
+  Pop $EXTENSION
+  ${DoUntil} $EXTENSION == ${FILE_EXTENSION_MARKER}
+    ReadRegStr $R0 HKCR $EXTENSION ""
+    StrCmp $R0 ${LOGRAY_ASSOC} un.Disassociate.doDeregister
+    Goto un.Disassociate.end
+un.Disassociate.doDeregister:
+    ; The extension is associated with Logray 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 "Uninstall" un.SecUinstall
+;-------------------------------------------
+;
+; UnInstall for every user
+;
+SectionIn 1 2
+SetShellVarContext all
+
+!insertmacro IsLograyRunning
+
+Push "${EXECUTABLE_MARKER}"
+Push "${PROGRAM_NAME}"
+Push "capinfos"
+Push "captype"
+Push "dftest"
+Push "dumpcap"
+Push "editcap"
+Push "mergecap"
+Push "randpkt"
+Push "rawshark"
+Push "reordercap"
+Push "sharkd"
+Push "text2pcap"
+Push "tshark"
+
+!ifdef MMDBRESOLVE_EXE
+Push "mmdbresolve"
+!endif
+
+Pop $EXECUTABLE
+${DoUntil} $EXECUTABLE == ${EXECUTABLE_MARKER}
+
+  ; IsLograyRunning 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 ${LOGRAY_ASSOC}
+DeleteRegKey HKCR "${LOGRAY_ASSOC}\Shell\open\command"
+DeleteRegKey HKCR "${LOGRAY_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\falcodump.*"
+Delete "$INSTDIR\gpl-2.0-standalone.html"
+Delete "$INSTDIR\Acknowledgements.md"
+Delete "$INSTDIR\generic\*.*"
+Delete "$INSTDIR\help\*.*"
+Delete "$INSTDIR\iconengines\*.*"
+Delete "$INSTDIR\imageformats\*.*"
+Delete "$INSTDIR\mediaservice\*.*"
+Delete "$INSTDIR\multimedia\*.*"
+Delete "$INSTDIR\networkinformation\*.*"
+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\tls\*.*"
+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\example_snmp_users_file"
+Delete "$INSTDIR\ipmap.html"
+Delete "$INSTDIR\radius\*.*"
+Delete "$INSTDIR\dtds\*.*"
+Delete "$INSTDIR\browser_sslkeylog.lua"
+Delete "$INSTDIR\console.lua"
+Delete "$INSTDIR\dtd_gen.lua"
+Delete "$INSTDIR\init.lua"
+Delete "$INSTDIR\release-notes.html"
+
+RMDir "$INSTDIR\accessible"
+RMDir "$INSTDIR\audio"
+RMDir "$INSTDIR\bearer"
+RMDir "$INSTDIR\extcap"
+RMDir "$INSTDIR\iconengines"
+RMDir "$INSTDIR\imageformats"
+RMDir "$INSTDIR\mediaservice"
+RMDir "$INSTDIR\multimedia"
+RMDir "$INSTDIR\networkinformation"
+RMDir "$INSTDIR\platforms"
+RMDir "$INSTDIR\playlistformats"
+RMDir "$INSTDIR\printsupport"
+RMDir "$INSTDIR\styles\translations"
+RMDir "$INSTDIR\styles"
+RMDir "$SMPROGRAMS\${PROGRAM_NAME}"
+RMDir "$INSTDIR\help"
+RMDir "$INSTDIR\generic"
+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\tls"
+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\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
+
+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
+
+; Sign our installer and uninstaller during compilation.
+!ifdef ENABLE_SIGNED_NSIS
+!finalize 'sign-logray.bat "%1"' = 0 ; %1 is replaced by the installer exe to be signed.
+!uninstfinalize 'sign-logray.bat "%1"' = 0 ; %1 is replaced by the uninstaller exe to be signed.
+!endif
+
 ; ============================================================================
 ; PLEASE MAKE SURE, THAT THE DESCRIPTIVE TEXT FITS INTO THE DESCRIPTION FIELD!
 ; ============================================================================
 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
 !ifdef QT_DIR
-  !insertmacro MUI_DESCRIPTION_TEXT ${SecLograyQt} "The main network protocol analyzer application."
+  !insertmacro MUI_DESCRIPTION_TEXT ${SecLograyQt} "The main syscall and log analyzer application."
 !endif
   !insertmacro MUI_DESCRIPTION_TEXT ${SecTShark} "Text based network protocol analyzer."
 
-  !insertmacro MUI_DESCRIPTION_TEXT ${SecPluginsGroup} "Plugins and extensions for both ${PROGRAM_NAME} and TShark."
-  !insertmacro MUI_DESCRIPTION_TEXT ${SecPlugins} "Additional protocol dissectors."
-  !insertmacro MUI_DESCRIPTION_TEXT ${SecStatsTree} "Extended statistics."
-  !insertmacro MUI_DESCRIPTION_TEXT ${SecMate} "Plugin - Meta Analysis and Tracing Engine (Experimental)."
-  !insertmacro MUI_DESCRIPTION_TEXT ${SecProfiles} "Configuration profiles"
-
-!ifdef SMI_DIR
-  !insertmacro MUI_DESCRIPTION_TEXT ${SecMIBs} "SNMP MIBs for better SNMP dissection."
-!endif
-
-  !insertmacro MUI_DESCRIPTION_TEXT ${SecToolsGroup} "Additional command line based tools."
-  !insertmacro MUI_DESCRIPTION_TEXT ${SecEtwdump} "Provide ETW reader"
-  !insertmacro MUI_DESCRIPTION_TEXT ${SecEditCap} "Copy packets to a new file, optionally trimming packets, omitting them, or saving to a different format."
-  !insertmacro MUI_DESCRIPTION_TEXT ${SecText2Pcap} "Read an ASCII hex dump and write the data into a libpcap-style capture file."
-  !insertmacro MUI_DESCRIPTION_TEXT ${SecMergecap} "Combine multiple saved capture files into a single output file"
-  !insertmacro MUI_DESCRIPTION_TEXT ${SecReordercap} "Copy packets to a new file, sorted by time."
-  !insertmacro MUI_DESCRIPTION_TEXT ${SecCapinfos} "Print information about capture files."
-  !insertmacro MUI_DESCRIPTION_TEXT ${SecCaptype} "Print the types capture files."
-  !insertmacro MUI_DESCRIPTION_TEXT ${SecRandpkt} "Random packet generator."
-  !insertmacro MUI_DESCRIPTION_TEXT ${SecMMDBResolve} "MaxMind Database resolution tool"
+  !insertmacro MUI_DESCRIPTION_TEXT ${SecExtcapGroup} "External Capture Interfaces"
+  !insertmacro MUI_DESCRIPTION_TEXT ${SecFalcodump} "Provide capture interfaces from Falco plugins."
 
-!ifdef DOC_DIR
-  !insertmacro MUI_DESCRIPTION_TEXT ${SecDocumentation} "Install an offline copy of the User's Guide and FAQ."
-!endif
 !insertmacro MUI_FUNCTION_DESCRIPTION_END
 
+!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_UNFUNCTION_DESCRIPTION_END
+
 ; ============================================================================
 ; Callback functions
 ; ============================================================================
diff --git a/packaging/nsis/uninstall-logray.nsi b/packaging/nsis/uninstall-logray.nsi
deleted file mode 100644 (file)
index 5a8d440..0000000
+++ /dev/null
@@ -1,274 +0,0 @@
-;
-; uninstall-logray.nsi
-;
-
-; Create an installer that only writes an uninstaller.
-; https://nsis.sourceforge.io/Signing_an_Uninstaller
-
-!include "logray-common.nsh"
-!include 'LogicLib.nsh'
-!include x64.nsh
-!include "StrFunc.nsh"
-
-SetCompress off
-OutFile "${STAGING_DIR}\uninstall_logray_installer.exe"
-
-; InstType "un.Default (keep Personal Settings and Npcap)"
-InstType "un.All (remove all)"
-
-; Uninstaller icon
-UninstallIcon "..\..\resources\icons\lograyinst.ico"
-
-!include "MUI.nsh"
-
-!define MUI_UNICON "..\..\resources\icons\lograyinst.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 ${LOGRAY_ASSOC} un.Disassociate.doDeregister
-    Goto un.Disassociate.end
-un.Disassociate.doDeregister:
-    ; The extension is associated with Logray 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 "Uninstall" un.SecUinstall
-;-------------------------------------------
-;
-; UnInstall for every user
-;
-SectionIn 1 2
-SetShellVarContext all
-
-!insertmacro IsLograyRunning
-
-Push "${EXECUTABLE_MARKER}"
-Push "${PROGRAM_NAME}"
-Push "capinfos"
-Push "captype"
-Push "dftest"
-Push "dumpcap"
-Push "editcap"
-Push "mergecap"
-Push "reordercap"
-Push "text2pcap"
-
-!ifdef MMDBRESOLVE_EXE
-Push "mmdbresolve"
-!endif
-
-Pop $EXECUTABLE
-${DoUntil} $EXECUTABLE == ${EXECUTABLE_MARKER}
-
-  ; IsLograyRunning 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 ${LOGRAY_ASSOC}
-DeleteRegKey HKCR "${LOGRAY_ASSOC}\Shell\open\command"
-DeleteRegKey HKCR "${LOGRAY_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\gpl-2.0-standalone.html"
-Delete "$INSTDIR\Acknowledgements.md"
-Delete "$INSTDIR\help\*.*"
-Delete "$INSTDIR\iconengines\*.*"
-Delete "$INSTDIR\imageformats\*.*"
-Delete "$INSTDIR\mediaservice\*.*"
-Delete "$INSTDIR\networkinformation\*.*"
-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\tls\*.*"
-Delete "$INSTDIR\tpncp\*.*"
-Delete "$INSTDIR\translations\*.*"
-Delete "$INSTDIR\ui\*.*"
-Delete "$INSTDIR\wimaxasncp\*.*"
-Delete "$INSTDIR\ws.css"
-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\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\networkinformation"
-RMDir "$INSTDIR\platforms"
-RMDir "$INSTDIR\playlistformats"
-RMDir "$INSTDIR\printsupport"
-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\tls"
-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
-
-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_UNFUNCTION_DESCRIPTION_END