sq epan/dissectors/pidl/rcg/rcg.cnf
[wireshark-sm.git] / packaging / nsis / wireshark-common.nsh
blob4b8b674be2af14e72d03d6fff276eaed45aa4e79
2 ; ============================================================================
3 ; Name and version information
4 ; ============================================================================
6 Unicode true
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
11 ManifestDPIAware true
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}
19 !endif
21 !include "wireshark-config.nsh"
23 !define DISPLAY_NAME "${PROGRAM_NAME} ${VERSION} ${WIRESHARK_TARGET_PLATFORM}"
24 Name "${DISPLAY_NAME}"
26 !define PROGRAM_FULL_NAME "The ${PROGRAM_NAME} Network Protocol Analyzer"
27 !define PROGRAM_NAME_PATH "${PROGRAM_NAME}.exe"
29 !define UNINSTALLER_NAME "uninstall-wireshark.exe"
31 VIAddVersionKey "ProductName" "${PROGRAM_NAME}"
32 VIAddVersionKey "Comments" "It's a great product with a great story to tell. I'm pumped!"
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" "Wireshark and the 'fin' logo are registered trademarks of the Wireshark Foundation"
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}"
43 XPStyle on
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
54 !macro UpdateIcons
55   Push $R0
56   Push $R1
57   Push $R2
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" \
69     /SD IDOK
70   Goto UpdateIcons.quit_${UPDATEICONS_UNIQUE}
72 UpdateIcons.quit_${UPDATEICONS_UNIQUE}:
73   !undef UPDATEICONS_UNIQUE
74   Pop $R2
75   Pop $R1
76   Pop $R0
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'
83 !macroend
85 ; ============================================================================
86 ; Push our known file extensions onto the stack, prepended with a marker
87 ; Note that this is a subset of all the extensions for files that
88 ; Wireshark can read. We probably don't want to grab JPEG or MP3 files.
89 ; ============================================================================
91 ; Used to add associations between file extensions and Wireshark
92 !define WIRESHARK_ASSOC "wireshark-capture-file"
94 !define FILE_EXTENSION_MARKER "FILE_EXTENSION_MARKER"
96 !macro PushFileExtensions
97   Push "${FILE_EXTENSION_MARKER}"
98   Push ".wpz"
99   Push ".wpc"
100   Push ".vwr"
101   Push ".trc"
102   Push ".trace"
103   Push ".tr1"
104   Push ".tpc"
105   Push ".syc"
106   Push ".snoop"
107   Push ".scap"
108   Push ".rf5"
109   Push ".pkt"
110   Push ".pklg"
111   Push ".pcapng"
112   Push ".pcap"
113   Push ".out"
114   Push ".ntar"
115   Push ".mplog"
116   Push ".lcap"
117   Push ".ipfix"
118   Push ".fdc"
119   Push ".erf"
120   Push ".enc"
121   Push ".cap"
122   Push ".bfr"
123   Push ".atc"
124   Push ".apc"
125   Push ".acp"
126   Push ".5vw"
127   Push ".rtp"
128   Push ".ems"
129 !macroend
131 !macro IsWiresharkRunning
132 ; See if Wireshark is running
133 ; https://nsis.sourceforge.io/Check_whether_your_application_is_running
134 ${Do}
136   System::Call 'kernel32::OpenMutex(i 0x100000, b 0, t "Global\${PROGRAM_NAME}-is-running-{9CA78EEA-EA4D-4490-9240-FC01FCEF464B}") i .R0'
137     IntCmp $R0 0 checkRunningSession
138     System::Call 'kernel32::CloseHandle(i $R0)'
139     Goto isRunning
141 checkRunningSession:
142   System::Call 'kernel32::OpenMutex(i 0x100000, b 0, t "${PROGRAM_NAME}-is-running-{9CA78EEA-EA4D-4490-9240-FC01FCEF464B}") i .R0'
143     IntCmp $R0 0 notRunning
144     System::Call 'kernel32::CloseHandle(i $R0)'
146 isRunning:
147   ; You'd better go catch it.
148   MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION "${PROGRAM_NAME} or one of its associated programs is running.$\r$\nPlease close it first." /SD IDCANCEL IDRETRY continueChecking
149   Quit
151 notRunning:
152   ${ExitDo}
154 continueChecking:
155 ${Loop}
156 !macroend