diff options
author | Gerald Combs <gerald@wireshark.org> | 2013-10-29 04:05:27 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2013-10-29 04:05:27 +0000 |
commit | ba49d9bcf01a597ebec66c3d65c4813ebf174806 (patch) | |
tree | 24a8dc06b7825a9b8d252a148eeb0809d75201e6 | |
parent | 58d01512b16728b357b2f6481c592a71c7ab8435 (diff) |
Revert part of 52896 and (for now) all of 52935. As Jeff pointed out,
the PortableApps version relies on U3_-prefixed environment variables.
svn path=/trunk/; revision=52941
-rw-r--r-- | epan/filesystem.c | 132 | ||||
-rw-r--r-- | packaging.vcproj | 72 | ||||
-rw-r--r-- | packaging/portableapps/win32/Makefile.nmake | 1 | ||||
-rwxr-xr-x | packaging/portableapps/win32/WiresharkPortable.nsi | 4 | ||||
-rw-r--r-- | ui/gtk/file_dlg.c | 11 | ||||
-rw-r--r-- | ui/gtk/main.c | 13 | ||||
-rw-r--r-- | ui/gtk/main_menubar.c | 12 | ||||
-rw-r--r-- | ui/qt/main.cpp | 7 | ||||
-rw-r--r-- | ui/qt/wireshark_application.cpp | 5 | ||||
-rw-r--r-- | ui/recent.c | 12 | ||||
-rw-r--r-- | wsutil/CMakeLists.txt | 1 | ||||
-rw-r--r-- | wsutil/Makefile.common | 6 | ||||
-rw-r--r-- | wsutil/u3.c | 199 | ||||
-rw-r--r-- | wsutil/u3.h | 48 |
14 files changed, 470 insertions, 53 deletions
diff --git a/epan/filesystem.c b/epan/filesystem.c index b74964f380..fa292da4ce 100644 --- a/epan/filesystem.c +++ b/epan/filesystem.c @@ -87,6 +87,8 @@ #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; @@ -857,6 +859,9 @@ 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) @@ -864,27 +869,39 @@ get_datafile_dir(void) #ifdef _WIN32 /* - * 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. + * See if we are running in a U3 environment. */ - if (progfile_dir != NULL) { + u3deviceexecpath = getenv_utf8("U3_DEVICE_EXEC_PATH"); + + if (u3deviceexecpath != NULL) { /* - * Yes, we do; use that. + * We are; use the U3 device executable path. */ - datafile_dir = progfile_dir; + datafile_dir = u3deviceexecpath; } else { /* - * No, we don't. - * Fall back on the default installation directory. + * 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. */ - datafile_dir = "C:\\Program Files\\Wireshark\\"; + 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\\"; + } } #else @@ -1299,35 +1316,46 @@ get_persconffile_dir_no_profile(void) } /* - * Use %APPDATA% or %USERPROFILE%, so that configuration - * files are stored in the user profile, rather than in - * the home directory. The Windows convention is to store - * configuration information in the user profile, and doing - * so means you can use Wireshark even if the home directory - * is an inaccessible network drive. + * See if we are running in a U3 environment. */ - appdatadir = getenv_utf8("APPDATA"); - if (appdatadir != NULL) { + altappdatapath = getenv_utf8("U3_APP_DATA_PATH"); + if (altappdatapath != NULL) { /* - * Concatenate %APPDATA% with "\Wireshark". + * We are; use the U3 application data path. */ - persconffile_dir = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s", - appdatadir, PF_DIR); + persconffile_dir = altappdatapath; } else { /* - * OK, %APPDATA% wasn't set, so use - * %USERPROFILE%\Application Data. + * Use %APPDATA% or %USERPROFILE%, so that configuration + * files are stored in the user profile, rather than in + * the home directory. The Windows convention is to store + * configuration information in the user profile, and doing + * so means you can use Wireshark even if the home directory + * is an inaccessible network drive. */ - userprofiledir = getenv_utf8("USERPROFILE"); - if (userprofiledir != NULL) { - persconffile_dir = g_strdup_printf( - "%s" G_DIR_SEPARATOR_S "Application Data" G_DIR_SEPARATOR_S "%s", - userprofiledir, PF_DIR); + appdatadir = getenv_utf8("APPDATA"); + if (appdatadir != NULL) { + /* + * Concatenate %APPDATA% with "\Wireshark". + */ + persconffile_dir = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s", + appdatadir, PF_DIR); } else { /* - * Give up and use "C:". + * OK, %APPDATA% wasn't set, so use + * %USERPROFILE%\Application Data. */ - persconffile_dir = g_strdup_printf("C:" G_DIR_SEPARATOR_S "%s", PF_DIR); + userprofiledir = getenv_utf8("USERPROFILE"); + if (userprofiledir != NULL) { + persconffile_dir = g_strdup_printf( + "%s" G_DIR_SEPARATOR_S "Application Data" G_DIR_SEPARATOR_S "%s", + userprofiledir, PF_DIR); + } else { + /* + * Give up and use "C:". + */ + persconffile_dir = g_strdup_printf("C:" G_DIR_SEPARATOR_S "%s", PF_DIR); + } } } #else @@ -1632,7 +1660,9 @@ 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. + * 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 UNIX this is simply the current directory. */ /* XXX - should this and the get_home_dir() be merged? */ @@ -1640,6 +1670,7 @@ extern const char * get_persdatafile_dir(void) { #ifdef _WIN32 + char *u3devicedocumentpath; TCHAR tszPath[MAX_PATH]; char *szPath; BOOL bRet; @@ -1649,17 +1680,32 @@ get_persdatafile_dir(void) return persdatafile_dir; /* - * Hint: SHGetFolderPath is not available on MSVC 6 - without - * Platform SDK + * See if we are running in a U3 environment. */ - bRet = SHGetSpecialFolderPath(NULL, tszPath, CSIDL_PERSONAL, - FALSE); - if(bRet == TRUE) { - szPath = utf_16to8(tszPath); + 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 */ + + szPath = g_strdup_printf("%s%s", u3devicedocumentpath, U3_MY_CAPTURES); + persdatafile_dir = szPath; return szPath; } else { - return ""; + /* + * Hint: SHGetFolderPath is not available on MSVC 6 - without + * Platform SDK + */ + bRet = SHGetSpecialFolderPath(NULL, tszPath, CSIDL_PERSONAL, + FALSE); + if(bRet == TRUE) { + szPath = utf_16to8(tszPath); + persdatafile_dir = szPath; + return szPath; + } else { + return ""; + } } #else return ""; diff --git a/packaging.vcproj b/packaging.vcproj index f30af6662d..38131b2dbd 100644 --- a/packaging.vcproj +++ b/packaging.vcproj @@ -37,6 +37,26 @@ /> </Configuration> <Configuration + Name="U3|Win32" + OutputDirectory="$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="0" + > + <Tool + Name="VCNMakeTool" + BuildCommandLine="nmake -f Makefile.nmake packaging" + ReBuildCommandLine="" + CleanCommandLine="" + Output="" + PreprocessorDefinitions="WIN32;NDEBUG" + IncludeSearchPath="" + ForcedIncludes="" + AssemblySearchPath="" + ForcedUsingAssemblies="" + CompileAsManaged="" + /> + </Configuration> + <Configuration Name="zip_gtk1|Win32" OutputDirectory="$(ConfigurationName)" IntermediateDirectory="$(ConfigurationName)" @@ -101,6 +121,58 @@ </References> <Files> <Filter + Name="u3.win32" + > + <File + RelativePath=".\packaging\u3\win32\makefile.nmake" + > + </File> + <File + RelativePath=".\packaging\u3\win32\manifest.tmpl" + > + </File> + <File + RelativePath=".\packaging\u3\win32\README.txt" + > + </File> + <File + RelativePath=".\packaging\u3\win32\u3util.c" + > + </File> + </Filter> + <Filter + Name="u3.tools" + > + <File + RelativePath=".\packaging\u3\tools\makefile.nmake" + > + </File> + <File + RelativePath=".\packaging\u3\tools\README.txt" + > + </File> + <File + RelativePath=".\packaging\u3\tools\sysdep.c" + > + </File> + <File + RelativePath=".\packaging\u3\tools\sysdep.h" + > + </File> + <File + RelativePath=".\packaging\u3\tools\utest.c" + > + </File> + <File + RelativePath=".\packaging\u3\tools\uuid.c" + > + </File> + <File + RelativePath=".\packaging\u3\tools\uuid.h" + > + </File> + </Filter> + <Filter Name="nsis" > <File diff --git a/packaging/portableapps/win32/Makefile.nmake b/packaging/portableapps/win32/Makefile.nmake index f889ce8d65..aebe11f805 100644 --- a/packaging/portableapps/win32/Makefile.nmake +++ b/packaging/portableapps/win32/Makefile.nmake @@ -19,6 +19,7 @@ NSIS_PLUGINS = nsis-plugins FINDPROCDLL = $(WIRESHARK_LIB_DIR)\$(NSIS_PLUGINS)\FindProcDLL.dll TOPDIR = ..\..\.. +U3DIST = ..\..\u3\win32 COPY = xcopy MKDIR = mkdir COPY_FLAGS = /d /y diff --git a/packaging/portableapps/win32/WiresharkPortable.nsi b/packaging/portableapps/win32/WiresharkPortable.nsi index 9732f06518..50538ac646 100755 --- a/packaging/portableapps/win32/WiresharkPortable.nsi +++ b/packaging/portableapps/win32/WiresharkPortable.nsi @@ -151,9 +151,7 @@ Section "Main" Abort FoundProgramEXE: - ;=== Check if Wireshark running from somwehere else - ; XXX We might be able to use the Wireshark-is-running mutex here. - ; See IsWiresharkRunning in packaging\nsis\common.nsh for details. + ;=== Check if Wireshark running from somwehere else (e.g. U3 device) ; if the following step fails, you'll need the FindProcDLL plug-in from: ; http://nsis.sourceforge.net/Find_Process_By_Name ;FindProcDLL::FindProc "${PROGRAMEXECUTABLE}" diff --git a/ui/gtk/file_dlg.c b/ui/gtk/file_dlg.c index e215f9fc90..88b3f84660 100644 --- a/ui/gtk/file_dlg.c +++ b/ui/gtk/file_dlg.c @@ -75,6 +75,9 @@ 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) { @@ -125,6 +128,14 @@ file_selection_new(const gchar *title, GtkWindow *parent, in which that file resided. */ 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; } diff --git a/ui/gtk/main.c b/ui/gtk/main.c index 5a0cae40b8..bad98e4873 100644 --- a/ui/gtk/main.c +++ b/ui/gtk/main.c @@ -64,6 +64,7 @@ #endif /* HAVE_LIBPORTAUDIO */ #include <wsutil/crash_info.h> +#include <wsutil/u3.h> #include <wsutil/privileges.h> #include <wsutil/file_util.h> @@ -1948,6 +1949,11 @@ get_gui_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 * @@ -3185,6 +3191,10 @@ 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 @@ -3209,6 +3219,9 @@ main(int argc, char *argv[]) gtk_iface_mon_stop(); #endif + /* deregister our pid */ + u3_deregister_pid(); + epan_cleanup(); AirPDcapDestroyContext(&airpdcap_ctx); diff --git a/ui/gtk/main_menubar.c b/ui/gtk/main_menubar.c index 8491e5fa5e..e30b1cdbb5 100644 --- a/ui/gtk/main_menubar.c +++ b/ui/gtk/main_menubar.c @@ -28,6 +28,8 @@ #include <stdio.h> #include <string.h> +#include <wsutil/u3.h> + #include <epan/packet.h> #include <epan/addr_resolv.h> #include <epan/prefs.h> @@ -4403,7 +4405,10 @@ menu_recent_file_write_all(FILE *rf) while (list != NULL) { cf_name = (gchar *)list->data; if (cf_name) { - fprintf (rf, RECENT_KEY_CAPTURE_FILE ": %s\n", 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); } list = g_list_previous(list); } @@ -4419,7 +4424,10 @@ menu_recent_file_write_all(FILE *rf) /* get capture filename from the menu item label */ cf_name = (gchar *)g_object_get_data(G_OBJECT(child->data), MENU_RECENT_FILES_KEY); if (cf_name) { - fprintf (rf, RECENT_KEY_CAPTURE_FILE ": %s\n", 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); } child = g_list_previous(child); diff --git a/ui/qt/main.cpp b/ui/qt/main.cpp index 4385e2beb2..9cc27d5d1f 100644 --- a/ui/qt/main.cpp +++ b/ui/qt/main.cpp @@ -37,6 +37,7 @@ #endif #include <wsutil/crash_info.h> +#include <wsutil/u3.h> #include <wsutil/file_util.h> #include <wiretap/merge.h> @@ -434,6 +435,12 @@ get_gui_runtime_info(GString *str) get_runtime_airpcap_version(str); #endif + + if(u3_active()) { + g_string_append(str, ", "); + u3_runtime_info(str); + } + } /* And now our feature presentation... [ fade to music ] */ diff --git a/ui/qt/wireshark_application.cpp b/ui/qt/wireshark_application.cpp index 1579723682..cc8990a377 100644 --- a/ui/qt/wireshark_application.cpp +++ b/ui/qt/wireshark_application.cpp @@ -146,7 +146,10 @@ 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) { - fprintf (rf, RECENT_KEY_CAPTURE_FILE ": %s\n", cf_name.toUtf8().constData()); +// 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()); } } } diff --git a/ui/recent.c b/ui/recent.c index 480b99e275..41f5f93263 100644 --- a/ui/recent.c +++ b/ui/recent.c @@ -44,6 +44,7 @@ #include "ui/simple_dialog.h" #include "ui/ui_util.h" +#include <wsutil/u3.h> #include <wsutil/file_util.h> #include <wsutil/str_util.h> @@ -663,7 +664,11 @@ write_profile_recent(void) if (get_last_open_dir() != NULL) { fprintf(rf, "\n# Last directory navigated to in File Open dialog.\n"); - fprintf(rf, RECENT_GUI_FILEOPEN_REMEMBERED_DIR ": %s\n", get_last_open_dir()); + + 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()); } fclose(rf); @@ -985,7 +990,10 @@ read_set_recent_pair_dynamic(gchar *key, const gchar *value, return PREFS_SET_SYNTAX_ERR; } if (strcmp(key, RECENT_KEY_CAPTURE_FILE) == 0) { - add_menu_recent_capture_file(value); + if (u3_active()) + add_menu_recent_capture_file(u3_expand_device_path(value)); + else + 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) { diff --git a/wsutil/CMakeLists.txt b/wsutil/CMakeLists.txt index 552f2a408b..02d15a0f04 100644 --- a/wsutil/CMakeLists.txt +++ b/wsutil/CMakeLists.txt @@ -64,6 +64,7 @@ set(WSUTIL_FILES swar.c tempfile.c type_util.c + u3.c ${WSUTIL_PLATFORM_FILES} ) diff --git a/wsutil/Makefile.common b/wsutil/Makefile.common index 0eb65f3ca7..7332d97d8e 100644 --- a/wsutil/Makefile.common +++ b/wsutil/Makefile.common @@ -56,7 +56,8 @@ LIBWSUTIL_SRC = \ rc4.c \ report_err.c \ tempfile.c \ - type_util.c + type_util.c \ + u3.c # Header files that are not generated from other files LIBWSUTIL_INCLUDES = \ @@ -87,4 +88,5 @@ LIBWSUTIL_INCLUDES = \ report_err.h \ swar.h \ tempfile.h \ - type_util.h + type_util.h \ + u3.h diff --git a/wsutil/u3.c b/wsutil/u3.c new file mode 100644 index 0000000000..217d9f3bac --- /dev/null +++ b/wsutil/u3.c @@ -0,0 +1,199 @@ +/* u3.c + * u3 2006 Graeme Lunt + * + * $Id$ + * + * 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> +#endif + +#ifdef HAVE_FCNTL_H +#include <fcntl.h> +#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; + +} diff --git a/wsutil/u3.h b/wsutil/u3.h new file mode 100644 index 0000000000..fac385aebe --- /dev/null +++ b/wsutil/u3.h @@ -0,0 +1,48 @@ +/* u3.h + * u3 2006 Graeme Lunt + * + * $Id$ + * + * 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__ */ |