2 ; ============================================================================
3 ; Name and version information
4 ; ============================================================================
7 ; This improves the installer's appearance considerably here on a display scaled
8 ; to 225%, but checkboxes are comically small. We might be able to fix this
9 ; using the SysCompImg extension:
10 ; http://forums.winamp.com/showthread.php?t=443754
12 ; These might be correct in the future, but are currently undocumented:
13 ; http://forums.winamp.com/showthread.php?t=452632
14 ; ManifestDPIAware System
15 ; ManifestDPIAwareness "PerMonitorV2,System"
17 !ifdef NSIS_INCLUDE_DIR
18 !addincludedir ${NSIS_INCLUDE_DIR}
21 !include "stratoshark-config.nsh"
23 !define DISPLAY_NAME "${PROGRAM_NAME} ${VERSION} ${WIRESHARK_TARGET_PLATFORM}"
24 Name "${DISPLAY_NAME}"
26 !define PROGRAM_FULL_NAME "The ${PROGRAM_NAME} System Call and Log Analyzer"
27 !define PROGRAM_NAME_PATH "${PROGRAM_NAME}.exe"
29 !define UNINSTALLER_NAME "uninstall-stratoshark.exe"
31 VIAddVersionKey "ProductName" "${PROGRAM_NAME}"
32 VIAddVersionKey "Comments" "My manta ray is all right."
33 VIAddVersionKey "CompanyName" "${PROGRAM_NAME} development team"
34 ; NSIS handles U+00a9 but not a UTF-8 encoded copyright symbol.
35 VIAddVersionKey "LegalCopyright" "${U+00a9} Gerald Combs and many others"
36 VIAddVersionKey "LegalTrademarks" "Stratoshark and the 'ray' logo are registered trademarks"
37 VIAddVersionKey "FileDescription" "${PROGRAM_NAME} installer for Windows on ${WIRESHARK_TARGET_PLATFORM}"
38 VIAddVersionKey "Language" "English"
39 VIAddVersionKey "ProductVersion" "${PRODUCT_VERSION}"
40 VIAddVersionKey "FileVersion" "${PRODUCT_VERSION}"
41 VIProductVersion "${PRODUCT_VERSION}"
46 ; ============================================================================
47 ; Functions and macros
48 ; ============================================================================
50 ; Used to refresh the display of file association
51 !define SHCNE_ASSOCCHANGED 0x08000000
52 !define SHCNF_IDLIST 0
59 !define UPDATEICONS_UNIQUE ${__LINE__}
61 IfFileExists "$SYSDIR\shell32.dll" UpdateIcons.ok_shell32_${UPDATEICONS_UNIQUE} UpdateIcons.error_shell32_${UPDATEICONS_UNIQUE}
62 UpdateIcons.ok_shell32_${UPDATEICONS_UNIQUE}:
63 System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (${SHCNE_ASSOCCHANGED}, ${SHCNF_IDLIST}, 0, 0)'
64 Goto UpdateIcons.quit_${UPDATEICONS_UNIQUE}
66 UpdateIcons.error_shell32_${UPDATEICONS_UNIQUE}:
67 MessageBox MB_OK|MB_ICONSTOP \
68 "Can't find 'shell32.dll' library. Impossible to update icons" \
70 Goto UpdateIcons.quit_${UPDATEICONS_UNIQUE}
72 UpdateIcons.quit_${UPDATEICONS_UNIQUE}:
73 !undef UPDATEICONS_UNIQUE
78 ; Force the icon cache to refresh
79 ; https://superuser.com/questions/499078/refresh-icon-cache-without-rebooting
80 IfFileExists "$SYSDIR\ie4uinit.exe" 0 +2
81 Exec '"$SYSDIR\ie4uinit.exe" -ClearIconCache'
85 ; ============================================================================
86 ; Push our known file extensions onto the stack, prepended with a marker
87 ; Note that this is a subset of dump_open_table in wiretap/file_access.c. We
88 ; probably don't want to grab JPEG or MP3 files.
89 ; ============================================================================
91 ; Used to add associations between file extensions and Stratoshark
92 !define STRATOSHARK_ASSOC "stratoshark-log-file"
94 !define FILE_EXTENSION_MARKER "FILE_EXTENSION_MARKER"
96 !macro PushFileExtensions
97 Push "${FILE_EXTENSION_MARKER}"
101 !macro IsStratosharkRunning
102 ; See if Stratoshark is running
103 ; https://nsis.sourceforge.io/Check_whether_your_application_is_running
106 System::Call 'kernel32::OpenMutex(i 0x100000, b 0, t "Global\${PROGRAM_NAME}-is-running-{9CA78EEA-EA4D-4490-9240-FC01FCEF464B}") i .R0'
107 IntCmp $R0 0 checkRunningSession
108 System::Call 'kernel32::CloseHandle(i $R0)'
112 System::Call 'kernel32::OpenMutex(i 0x100000, b 0, t "${PROGRAM_NAME}-is-running-{9CA78EEA-EA4D-4490-9240-FC01FCEF464B}") i .R0'
113 IntCmp $R0 0 notRunning
114 System::Call 'kernel32::CloseHandle(i $R0)'
117 ; You'd better go catch it.
118 MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION "${PROGRAM_NAME} or one of its associated programs is running.$\r$\nPlease close it first." /SD IDCANCEL IDRETRY continueChecking