forked from osmocom/wireshark
When any of our executables start on Windows create or open a "Wireshark
is running" mutex. Have the NSIS installer check for this mutex and ask the user to close Wireshark if it's found. While not perfect this makes the WinSparkle update process much less annoying. svn path=/trunk/; revision=47758daniel/osmux
parent
cf1070b4b1
commit
bd4cffae58
|
@ -155,7 +155,7 @@ static gboolean cap_file_hashes = TRUE; /* Calculate file hashes */
|
|||
#ifdef USE_GOPTION
|
||||
static gboolean cap_help = FALSE;
|
||||
static gboolean table_report = FALSE;
|
||||
|
||||
|
||||
static GOptionEntry general_entries[] =
|
||||
{
|
||||
/* General */
|
||||
|
@ -490,7 +490,7 @@ print_stats(const gchar *filename, capture_info *cf_info)
|
|||
}
|
||||
if (cap_packet_size) printf ("Average packet size: %.2f bytes\n", cf_info->packet_size);
|
||||
if (cf_info->times_known) {
|
||||
if (cap_packet_rate)
|
||||
if (cap_packet_rate)
|
||||
print_value("Average packet rate: ", 2, " packets/sec", cf_info->packet_rate);
|
||||
}
|
||||
#ifdef HAVE_LIBGCRYPT
|
||||
|
@ -1022,6 +1022,7 @@ main(int argc, char *argv[])
|
|||
|
||||
#ifdef _WIN32
|
||||
arg_list_utf_16to8(argc, argv);
|
||||
create_app_running_mutex();
|
||||
#endif /* _WIN32 */
|
||||
|
||||
/*
|
||||
|
@ -1044,7 +1045,7 @@ main(int argc, char *argv[])
|
|||
/* Process the options */
|
||||
#ifdef USE_GOPTION
|
||||
ctx = g_option_context_new(" <infile> ... - print information about capture file(s)");
|
||||
general_grp = g_option_group_new("gen", "General infos:",
|
||||
general_grp = g_option_group_new("gen", "General infos:",
|
||||
"Show general options", NULL, NULL);
|
||||
size_grp = g_option_group_new("size", "Size infos:",
|
||||
"Show size options", NULL, NULL);
|
||||
|
|
|
@ -4177,9 +4177,8 @@ main(int argc, char *argv[])
|
|||
|
||||
#ifdef _WIN32
|
||||
arg_list_utf_16to8(argc, argv);
|
||||
#endif /* _WIN32 */
|
||||
create_app_running_mutex();
|
||||
|
||||
#ifdef _WIN32
|
||||
/*
|
||||
* Initialize our DLL search path. MUST be called before LoadLibrary
|
||||
* or g_module_open.
|
||||
|
|
|
@ -65,6 +65,7 @@
|
|||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <wsutil/file_util.h>
|
||||
#include <wsutil/unicode-utils.h>
|
||||
#include <process.h> /* getpid */
|
||||
#ifdef HAVE_WINSOCK2_H
|
||||
|
@ -870,6 +871,7 @@ main(int argc, char *argv[])
|
|||
|
||||
#ifdef _WIN32
|
||||
arg_list_utf_16to8(argc, argv);
|
||||
create_app_running_mutex();
|
||||
#endif /* _WIN32 */
|
||||
|
||||
/*
|
||||
|
|
|
@ -223,6 +223,7 @@ main(int argc, char *argv[])
|
|||
|
||||
#ifdef _WIN32
|
||||
arg_list_utf_16to8(argc, argv);
|
||||
create_app_running_mutex();
|
||||
#endif /* _WIN32 */
|
||||
|
||||
/* Process the options first */
|
||||
|
|
|
@ -210,6 +210,17 @@ Function .onInit
|
|||
${EndIf}
|
||||
!endif
|
||||
|
||||
; See if Wireshark is running
|
||||
; http://nsis.sourceforge.net/Check_whether_your_application_is_running
|
||||
checkRunning:
|
||||
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)'
|
||||
; You'd better go catch it.
|
||||
MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION "${PROGRAM_NAME} or one is associated programs is running. Please close it first" /SD IDCANCEL IDRETRY checkRunning
|
||||
Quit
|
||||
notRunning:
|
||||
|
||||
; Copied from http://nsis.sourceforge.net/Auto-uninstall_old_before_installing_new
|
||||
ReadRegStr $OLD_UNINSTALLER HKLM \
|
||||
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${PROGRAM_NAME}" \
|
||||
|
|
|
@ -512,6 +512,7 @@ main(int argc, char **argv)
|
|||
|
||||
#ifdef _WIN32
|
||||
arg_list_utf_16to8(argc, argv);
|
||||
create_app_running_mutex();
|
||||
#endif /* _WIN32 */
|
||||
|
||||
while ((opt = getopt(argc, argv, "b:c:ht:")) != -1) {
|
||||
|
|
|
@ -472,6 +472,7 @@ main(int argc, char *argv[])
|
|||
|
||||
#ifdef _WIN32
|
||||
arg_list_utf_16to8(argc, argv);
|
||||
create_app_running_mutex();
|
||||
#endif /* _WIN32 */
|
||||
|
||||
/*
|
||||
|
|
|
@ -1369,6 +1369,7 @@ parse_options (int argc, char *argv[])
|
|||
|
||||
#ifdef _WIN32
|
||||
arg_list_utf_16to8(argc, argv);
|
||||
create_app_running_mutex();
|
||||
#endif /* _WIN32 */
|
||||
|
||||
/* Scan CLI parameters */
|
||||
|
|
1
tshark.c
1
tshark.c
|
@ -950,6 +950,7 @@ main(int argc, char *argv[])
|
|||
|
||||
#ifdef _WIN32
|
||||
arg_list_utf_16to8(argc, argv);
|
||||
create_app_running_mutex();
|
||||
#if !GLIB_CHECK_VERSION(2,31,0)
|
||||
g_thread_init(NULL);
|
||||
#endif
|
||||
|
|
|
@ -2224,6 +2224,7 @@ main(int argc, char *argv[])
|
|||
setlocale(LC_ALL, "");
|
||||
#ifdef _WIN32
|
||||
arg_list_utf_16to8(argc, argv);
|
||||
create_app_running_mutex();
|
||||
#endif /* _WIN32 */
|
||||
|
||||
/*
|
||||
|
@ -3217,7 +3218,7 @@ main(int argc, char *argv[])
|
|||
#endif
|
||||
|
||||
software_update_init();
|
||||
|
||||
|
||||
/* we'll enter the GTK loop now and hand the control over to GTK ... */
|
||||
gtk_main();
|
||||
/* ... back from GTK, we're going down now! */
|
||||
|
|
|
@ -528,6 +528,7 @@ int main(int argc, char *argv[])
|
|||
int status;
|
||||
|
||||
//initialize language !
|
||||
create_app_running_mutex();
|
||||
|
||||
QString locale = QLocale::system().name();
|
||||
|
||||
|
|
|
@ -614,3 +614,10 @@ getenv_utf8(const char *varname)
|
|||
|
||||
return envvar;
|
||||
}
|
||||
|
||||
/** Create or open a "Wireshark is running" mutex.
|
||||
*/
|
||||
#define WIRESHARK_IS_RUNNING_UUID "9CA78EEA-EA4D-4490-9240-FC01FCEF464B"
|
||||
void create_app_running_mutex() {
|
||||
CreateMutex(NULL, FALSE, _T("Wireshark-is-running-{") _T(WIRESHARK_IS_RUNNING_UUID) _T("}"));
|
||||
}
|
||||
|
|
|
@ -113,6 +113,7 @@ gboolean ws_init_dll_search_path();
|
|||
*/
|
||||
|
||||
void *ws_load_library(gchar *library_name);
|
||||
|
||||
/** Load a DLL using g_module_open.
|
||||
* Only the system and program directories are searched.
|
||||
*
|
||||
|
@ -127,6 +128,12 @@ GModule *ws_module_open(gchar *module_name, GModuleFlags flags);
|
|||
*/
|
||||
extern char *getenv_utf8(const char *varname);
|
||||
|
||||
/** Create or open a "Wireshark is running" mutex.
|
||||
* Create or open a mutex which signals that Wireshark or its associated
|
||||
* executables is running. Used by the installer to test for a running application.
|
||||
*/
|
||||
extern void create_app_running_mutex();
|
||||
|
||||
#else /* _WIN32 */
|
||||
|
||||
/*
|
||||
|
|
|
@ -52,6 +52,7 @@ crc32_mpeg2_seed
|
|||
crc_drm
|
||||
|
||||
; file_util.c
|
||||
create_app_running_mutex
|
||||
getenv_utf8
|
||||
ws_stdio_fopen
|
||||
ws_stdio_freopen
|
||||
|
|
Loading…
Reference in New Issue