Remove the last remnants of U3 support.

Change-Id: Ide4c177e67a77c5f9495b3b4c0f817f40e6dde30
Reviewed-on: https://code.wireshark.org/review/14425
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
This commit is contained in:
Gerald Combs 2016-03-11 09:15:12 -08:00
parent d9c274bebf
commit 6ed543dbe6
13 changed files with 28 additions and 381 deletions

View File

@ -161,12 +161,6 @@ libwsutil.so.0 libwsutil0 #MINVER#
test_for_fifo@Base 1.12.0~rc1
type_util_gdouble_to_guint64@Base 1.10.0
type_util_guint64_to_gdouble@Base 1.10.0
u3_active@Base 1.12.0~rc1
u3_contract_device_path@Base 1.12.0~rc1
u3_deregister_pid@Base 1.12.0~rc1
u3_expand_device_path@Base 1.12.0~rc1
u3_register_pid@Base 1.12.0~rc1
u3_runtime_info@Base 1.12.0~rc1
ulaw2linear@Base 1.12.0~rc1
update_adler32@Base 1.12.0~rc1
update_crc10_by_bytes@Base 1.10.0

View File

@ -4,8 +4,6 @@ Portable Wireshark
This directory contains experimental packaging for running Wireshark under the Portable Apps
(http://www.portableapps.com/).
The packaging relies on the same "manifest" as used by the U3 packaging. Therefore there is no need to maintain a list of relevant files for the Portable Wireshark. Only the U3 list needs to be updated.
Currently only an additional menu item for Wireshark is added - the other tools could be added to Portable Apps menu if required.
WinPcap
@ -44,4 +42,4 @@ The DisableWinPcapInstall allows you to disable the installation of WinPcap, eve
The WinPcapInstaller allows you to specify a different WinPcap installer than the default one included in the distribution. For example, if you download a later version.
The MSVCRedist allows you to specify a different redistributable package to be used than the default one included in the distribution.
The MSVCRedist allows you to specify a different redistributable package to be used than the default one included in the distribution.

View File

@ -73,9 +73,6 @@ file_selection_new(const gchar *title, GtkWindow *parent,
{
GtkWidget *win;
GtkFileChooserAction gtk_action;
#ifdef _WIN32
char *u3devicedocumentpath;
#endif
const gchar *ok_button_text;
switch (action) {
@ -124,16 +121,9 @@ file_selection_new(const gchar *title, GtkWindow *parent,
/* If we've opened a file before, start out by showing the files in the directory
in which that file resided. */
if (last_open_dir)
if (last_open_dir) {
file_selection_set_current_folder(win, last_open_dir);
#ifdef _WIN32
else {
u3devicedocumentpath = getenv_utf8("U3_DEVICE_DOCUMENT_PATH");
if(u3devicedocumentpath != NULL)
file_selection_set_current_folder(win, u3devicedocumentpath);
}
#endif
return win;
}

View File

@ -63,7 +63,6 @@
#include <wsutil/file_util.h>
#include <wsutil/privileges.h>
#include <wsutil/report_err.h>
#include <wsutil/u3.h>
#include <wsutil/ws_diag_control.h>
#include <wsutil/ws_version_info.h>
@ -2030,11 +2029,6 @@ get_wireshark_runtime_info(GString *str)
g_string_append(str, ", ");
get_runtime_airpcap_version(str);
#endif
if(u3_active()) {
g_string_append(str, ", ");
u3_runtime_info(str);
}
}
static e_prefs *
@ -3348,10 +3342,6 @@ main(int argc, char *argv[])
main_filter_packets(&cfile, dfilter, FALSE);
}
/* register our pid if we are being run from a U3 device */
u3_register_pid();
profile_store_persconffiles (FALSE);
#ifdef HAVE_GTKOSXAPPLICATION
@ -3380,9 +3370,6 @@ main(int argc, char *argv[])
gtk_iface_mon_stop();
#endif
/* deregister our pid */
u3_deregister_pid();
epan_cleanup();
AirPDcapDestroyContext(&airpdcap_ctx);

View File

@ -26,8 +26,6 @@
#include <stdlib.h>
#include <string.h>
#include <wsutil/u3.h>
#include <epan/packet.h>
#include <epan/prefs.h>
#include <epan/prefs-int.h>
@ -4076,10 +4074,7 @@ menu_recent_file_write_all(FILE *rf)
while (list != NULL) {
cf_name = (gchar *)list->data;
if (cf_name) {
if(u3_active())
fprintf (rf, RECENT_KEY_CAPTURE_FILE ": %s\n", u3_contract_device_path(cf_name));
else
fprintf (rf, RECENT_KEY_CAPTURE_FILE ": %s\n", cf_name);
fprintf (rf, RECENT_KEY_CAPTURE_FILE ": %s\n", cf_name);
}
list = g_list_previous(list);
}

View File

@ -183,10 +183,7 @@ extern "C" void menu_recent_file_write_all(FILE *rf) {
/* get capture filename from the menu item label */
cf_name = rii.previous()->filename;
if (cf_name != NULL) {
// if(u3_active())
// fprintf (rf, RECENT_KEY_CAPTURE_FILE ": %s\n", u3_contract_device_path(cf_name));
// else
fprintf (rf, RECENT_KEY_CAPTURE_FILE ": %s\n", cf_name.toUtf8().constData());
fprintf (rf, RECENT_KEY_CAPTURE_FILE ": %s\n", cf_name.toUtf8().constData());
}
}
}

View File

@ -39,7 +39,6 @@
#include "ui/recent_utils.h"
#include "ui/simple_dialog.h"
#include <wsutil/u3.h>
#include <wsutil/file_util.h>
#define RECENT_KEY_MAIN_TOOLBAR_SHOW "gui.toolbar_main_show"
@ -846,11 +845,7 @@ write_profile_recent(void)
if (get_last_open_dir() != NULL) {
fprintf(rf, "\n# Last directory navigated to in File Open dialog.\n");
if (u3_active())
fprintf(rf, RECENT_GUI_FILEOPEN_REMEMBERED_DIR ": %s\n", u3_contract_device_path(get_last_open_dir()));
else
fprintf(rf, RECENT_GUI_FILEOPEN_REMEMBERED_DIR ": %s\n", get_last_open_dir());
fprintf(rf, RECENT_GUI_FILEOPEN_REMEMBERED_DIR ": %s\n", get_last_open_dir());
}
fclose(rf);
@ -1112,10 +1107,7 @@ read_set_recent_pair_dynamic(gchar *key, const gchar *value,
return PREFS_SET_SYNTAX_ERR;
}
if (strcmp(key, RECENT_KEY_CAPTURE_FILE) == 0) {
if (u3_active())
add_menu_recent_capture_file(u3_expand_device_path(value));
else
add_menu_recent_capture_file(value);
add_menu_recent_capture_file(value);
} else if (strcmp(key, RECENT_KEY_DISPLAY_FILTER) == 0) {
dfilter_combo_add_recent(value);
} else if (strcmp(key, RECENT_KEY_CAPTURE_FILTER) == 0) {

View File

@ -48,7 +48,6 @@
#include <wsutil/plugins.h>
#endif
#include <wsutil/report_err.h>
#include <wsutil/u3.h>
#include <wsutil/unicode-utils.h>
#include <wsutil/ws_diag_control.h>
#include <wsutil/ws_version_info.h>
@ -370,11 +369,6 @@ get_wireshark_runtime_info(GString *str)
g_string_append(str, ", ");
get_runtime_airpcap_version(str);
#endif
if(u3_active()) {
g_string_append(str, ", ");
u3_runtime_info(str);
}
}
#ifdef HAVE_LIBPCAP

View File

@ -73,7 +73,6 @@ set(WSUTIL_FILES
tempfile.c
time_util.c
type_util.c
u3.c
unicode-utils.c
ws_mempbrk.c
ws_version_info.c

View File

@ -70,9 +70,8 @@ LIBWSUTIL_COMMON_SRC = \
tempfile.c \
time_util.c \
type_util.c \
ws_mempbrk.c \
u3.c \
unicode-utils.c \
ws_mempbrk.c \
ws_version_info.c
# Header files that don't declare replacement functions for functions
@ -125,7 +124,6 @@ libwsutil_nonrepl_INCLUDES = \
tempfile.h \
time_util.h \
type_util.h \
u3.h \
unicode-utils.h \
utf8_entities.h \
ws_cpuid.h \

View File

@ -69,8 +69,6 @@
#define PROFILES_DIR "profiles"
#define PLUGINS_DIR_NAME "plugins"
#define U3_MY_CAPTURES "\\My Captures"
char *persconffile_dir = NULL;
char *persdatafile_dir = NULL;
char *persconfprofile = NULL;
@ -832,9 +830,6 @@ get_progfile_dir(void)
const char *
get_datafile_dir(void)
{
#ifdef _WIN32
char *u3deviceexecpath;
#endif
static const char *datafile_dir = NULL;
if (datafile_dir != NULL)
@ -842,39 +837,27 @@ get_datafile_dir(void)
#ifdef _WIN32
/*
* See if we are running in a U3 environment.
* Do we have the pathname of the program? If so, assume we're
* running an installed version of the program. If we fail,
* we don't change "datafile_dir", and thus end up using the
* default.
*
* XXX - does NSIS put the installation directory into
* "\HKEY_LOCAL_MACHINE\SOFTWARE\Wireshark\InstallDir"?
* If so, perhaps we should read that from the registry,
* instead.
*/
u3deviceexecpath = getenv_utf8("U3_DEVICE_EXEC_PATH");
if (u3deviceexecpath != NULL) {
if (progfile_dir != NULL) {
/*
* We are; use the U3 device executable path.
* Yes, we do; use that.
*/
datafile_dir = u3deviceexecpath;
datafile_dir = progfile_dir;
} else {
/*
* Do we have the pathname of the program? If so, assume we're
* running an installed version of the program. If we fail,
* we don't change "datafile_dir", and thus end up using the
* default.
*
* XXX - does NSIS put the installation directory into
* "\HKEY_LOCAL_MACHINE\SOFTWARE\Wireshark\InstallDir"?
* If so, perhaps we should read that from the registry,
* instead.
* No, we don't.
* Fall back on the default installation directory.
*/
if (progfile_dir != NULL) {
/*
* Yes, we do; use that.
*/
datafile_dir = progfile_dir;
} else {
/*
* No, we don't.
* Fall back on the default installation directory.
*/
datafile_dir = "C:\\Program Files\\Wireshark\\";
}
datafile_dir = "C:\\Program Files\\Wireshark\\";
}
#else
@ -1271,18 +1254,6 @@ get_persconffile_dir_no_profile(void)
return persconffile_dir;
}
/*
* See if we are running in a U3 environment.
*/
env = getenv_utf8("U3_APP_DATA_PATH");
if (env != NULL) {
/*
* We are; use the U3 application data path.
*/
persconffile_dir = g_strdup(env);
return persconffile_dir;
}
/*
* Use %APPDATA% or %USERPROFILE%, so that configuration
* files are stored in the user profile, rather than in
@ -1680,9 +1651,7 @@ copy_persconffile_profile(const char *toname, const char *fromname, gboolean fro
/*
* Get the (default) directory in which personal data is stored.
*
* On Win32, this is the "My Documents" folder in the personal profile,
* except that, if we're running from a U3 device, this is the
* "$U3_DEVICE_DOCUMENT_PATH\My Captures" folder.
* On Win32, this is the "My Documents" folder in the personal profile.
* On UNIX this is simply the current directory.
*/
/* XXX - should this and the get_home_dir() be merged? */
@ -1690,7 +1659,6 @@ extern const char *
get_persdatafile_dir(void)
{
#ifdef _WIN32
char *u3devicedocumentpath;
TCHAR tszPath[MAX_PATH];
/* Return the cached value, if available */
@ -1698,27 +1666,14 @@ get_persdatafile_dir(void)
return persdatafile_dir;
/*
* See if we are running in a U3 environment.
* Hint: SHGetFolderPath is not available on MSVC 6 - without
* Platform SDK
*/
u3devicedocumentpath = getenv_utf8("U3_DEVICE_DOCUMENT_PATH");
if (u3devicedocumentpath != NULL) {
/* the "My Captures" sub-directory is created (if it doesn't
exist) by u3util.exe when the U3 Wireshark is first run */
persdatafile_dir = g_strdup_printf("%s%s", u3devicedocumentpath, U3_MY_CAPTURES);
if (SHGetSpecialFolderPath(NULL, tszPath, CSIDL_PERSONAL, FALSE)) {
persdatafile_dir = g_utf16_to_utf8(tszPath, -1, NULL, NULL, NULL);
return persdatafile_dir;
} else {
/*
* Hint: SHGetFolderPath is not available on MSVC 6 - without
* Platform SDK
*/
if (SHGetSpecialFolderPath(NULL, tszPath, CSIDL_PERSONAL, FALSE)) {
persdatafile_dir = g_utf16_to_utf8(tszPath, -1, NULL, NULL, NULL);
return persdatafile_dir;
} else {
return "";
}
return "";
}
#else
return "";

View File

@ -1,206 +0,0 @@
/* u3.c
* u3 2006 Graeme Lunt
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/*
* Indentation logic: 2-space
*/
#include "config.h"
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h> /* getpid */
#endif
#ifdef _WIN32
#include <process.h> /* getpid */
#endif
#include <wsutil/file_util.h>
#include "u3.h"
#define U3_DEVICE_PATH_VAR "$U3_DEVICE_PATH"
static char *pid_file = NULL;
static char *u3devicepath = (char*)-1;
static gchar *newpath = NULL;
static const char *u3_change_path(const char *path, const char *old, const char *new_u3devicepath);
gboolean u3_active(void)
{
return (
#ifdef _WIN32
getenv_utf8
#else
getenv
#endif
("U3_HOST_EXEC_PATH") != NULL);
}
void u3_runtime_info(GString *str)
{
char *u3devicepath_lcl = NULL;
char *u3deviceproduct = NULL;
if((u3deviceproduct =
#ifdef _WIN32
getenv_utf8
#else
getenv
#endif
("U3_DEVICE_PRODUCT")) != NULL) {
g_string_append(str, " from the ");
g_string_append(str, u3deviceproduct);
} else {
g_string_append(str, " from a ");
}
g_string_append(str, " U3 device");
if((u3devicepath_lcl =
#ifdef _WIN32
getenv_utf8
#else
getenv
#endif
("U3_DEVICE_PATH")) != NULL) {
g_string_append(str, " in drive ");
g_string_append(str, u3devicepath_lcl);
}
}
void u3_register_pid(void)
{
int pid;
int pid_fd;
char *u3hostexecpath;
int pf_size;
if((u3hostexecpath =
#ifdef _WIN32
getenv_utf8
#else
getenv
#endif
("U3_HOST_EXEC_PATH")) != NULL) {
pid = getpid();
pf_size = (int) strlen(u3hostexecpath) + 32;
pid_file = (char *)g_malloc(pf_size);
g_snprintf(pid_file, pf_size, "%s\\%d.pid", u3hostexecpath, pid);
pid_fd = ws_open(pid_file, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644);
if(pid_fd != -1)
ws_close(pid_fd);
else {
g_free(pid_file);
pid_file = NULL;
}
}
}
void u3_deregister_pid(void)
{
if(pid_file) {
/* we don't care if we succeed or fail - u3utils may have deleted the file */
ws_unlink(pid_file);
g_free(pid_file);
pid_file = NULL;
}
}
const char *u3_expand_device_path(const char *path)
{
return u3_change_path(path, U3_DEVICE_PATH_VAR, NULL);
}
const char *u3_contract_device_path(char *path)
{
return u3_change_path(path, NULL, U3_DEVICE_PATH_VAR);
}
static const char *u3_change_path(const char *path, const char *old, const char *new_u3devicepath)
{
if(u3devicepath == (char*)-1) {
/* cache the device path */
u3devicepath =
#ifdef _WIN32
getenv_utf8
#else
getenv
#endif
("U3_DEVICE_PATH");
}
if(new_u3devicepath == NULL)
new_u3devicepath = u3devicepath;
if(old == NULL)
old = u3devicepath;
if(newpath != NULL) {
g_free(newpath);
newpath = NULL;
}
if((path != NULL) && (u3devicepath != NULL) && (strncmp(path, old, strlen(old)) == 0)) {
newpath = g_strconcat(new_u3devicepath, path + strlen(old), NULL);
return newpath;
}
return path;
}
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local Variables:
* c-basic-offset: 2
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* ex: set shiftwidth=2 tabstop=8 expandtab:
* :indentSize=2:tabSize=8:noTabs=true:
*/

View File

@ -1,46 +0,0 @@
/* u3.h
* u3 2006 Graeme Lunt
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef __U3_H__
#define __U3_H__
#include "ws_symbol_export.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
WS_DLL_PUBLIC gboolean u3_active(void);
WS_DLL_PUBLIC void u3_runtime_info(GString *str);
WS_DLL_PUBLIC void u3_register_pid(void);
WS_DLL_PUBLIC void u3_deregister_pid(void);
WS_DLL_PUBLIC const char *u3_expand_device_path(const char *path);
WS_DLL_PUBLIC const char *u3_contract_device_path(char *path);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __U3_H__ */