U3 packaging, utility and Wireshark modifications that allows Wireshark to be run from a U3 USB device.

For more details see packaging/u3/win32/README.txt


svn path=/trunk/; revision=19046
This commit is contained in:
Graeme Lunt 2006-08-26 17:55:21 +00:00
parent a5f6c6cdbf
commit 14be5e2bcc
11 changed files with 875 additions and 42 deletions

View File

@ -503,32 +503,49 @@ const char *
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.
*/
if (progfile_dir != NULL)
return progfile_dir;
char *u3deviceexecpath;
#endif
static char *datafile_dir = NULL;
/*
* No, we don't.
* Fall back on the default installation directory.
*/
return "C:\\Program Files\\Wireshark\\";
if(datafile_dir != NULL)
return datafile_dir;
#ifdef _WIN32
u3deviceexecpath = getenv_utf8("U3_DEVICE_EXEC_PATH");
if(u3deviceexecpath != NULL) {
datafile_dir = u3deviceexecpath;
} 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.
*/
if (progfile_dir != NULL)
datafile_dir = progfile_dir;
else
/*
* No, we don't.
* Fall back on the default installation directory.
*/
datafile_dir = "C:\\Program Files\\Wireshark\\";
}
#else
/*
* Just use DATAFILE_DIR, as that's what the configure script
* set it to be.
*/
return DATAFILE_DIR;
datafile_dir = DATAFILE_DIR;
#endif
return datafile_dir;
}
/*
@ -619,6 +636,7 @@ get_persconffile_dir(void)
#ifdef _WIN32
char *appdatadir;
char *userprofiledir;
char *u3appdatapath;
#else
const char *homedir;
struct passwd *pwd;
@ -630,36 +648,50 @@ get_persconffile_dir(void)
return pf_dir;
#ifdef _WIN32
/*
* 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) {
/*
* Concatenate %APPDATA% with "\Wireshark".
*/
pf_dir = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s",
appdatadir, PF_DIR);
u3appdatapath = getenv_utf8("U3_APP_DATA_PATH");
if(u3appdatapath != NULL) {
pf_dir = u3appdatapath;
} 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) {
pf_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".
*/
pf_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.
*/
pf_dir = g_strdup_printf("C:" G_DIR_SEPARATOR_S "%s", PF_DIR);
userprofiledir = getenv_utf8("USERPROFILE");
if (userprofiledir != NULL) {
pf_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:".
*/
pf_dir = g_strdup_printf("C:" G_DIR_SEPARATOR_S "%s", PF_DIR);
}
}
}
#else

View File

@ -371,6 +371,7 @@ get_systemfile_dir
get_tcp_port
get_tempfile_path
get_udp_port
getenv_utf8
gsm_a_bssmap_msg_strings DATA
gsm_a_dtap_msg_cc_strings DATA
gsm_a_dtap_msg_gmm_strings DATA

View File

@ -108,6 +108,7 @@ WIRESHARK_GTK_SRC = \
text_page.c \
toolbar.c \
voip_calls.c \
u3.c \
webbrowser.c

View File

@ -74,6 +74,9 @@ file_selection_new(const gchar *title, file_selection_action_t action)
{
GtkWidget *win;
GtkFileChooserAction gtk_action;
#ifdef _WIN32
char *u3devicedocumentpath;
#endif
const gchar *ok_button_text;
switch (action) {
@ -118,7 +121,14 @@ file_selection_new(const gchar *title, file_selection_action_t action)
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;
}
#else
@ -126,7 +136,9 @@ GtkWidget *
file_selection_new(const gchar *title, file_selection_action_t action _U_)
{
GtkWidget *win;
#ifdef _WIN32
char *u3devicedocumentpath;
#endif
win = gtk_file_selection_new(title);
#if GTK_MAJOR_VERSION >= 2
gtk_window_set_position(GTK_WINDOW(win), GTK_WIN_POS_CENTER_ON_PARENT);
@ -142,7 +154,14 @@ file_selection_new(const gchar *title, file_selection_action_t action _U_)
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;
}
#endif

View File

@ -89,6 +89,8 @@
#include "cmdarg_err.h"
#include "version_info.h"
#include "merge.h"
#include "u3.h"
#ifdef HAVE_LIBPCAP
#include "capture-pcap-util.h"
@ -2890,10 +2892,16 @@ main(int argc, char *argv[])
#endif /* HAVE_LIBPCAP */
}
/* register our pid if we are being run from a U3 device */
u3_register_pid();
/* we'll enter the GTK loop now and hand the control over to GTK ... */
gtk_main();
/* ... back from GTK, we're going down now! */
/* deregister our pid */
u3_deregister_pid();
epan_cleanup();
g_free(rc_file);

102
gtk/u3.c Normal file
View File

@ -0,0 +1,102 @@
/* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/*
* Indentation logic: 2-space
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#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 <wiretap/file_util.h>
#include <epan/filesystem.h>
#include <gtk/u3.h>
static char *pid_file = NULL;
void u3_register_pid()
{
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 = strlen(u3hostexecpath) + 32;
pid_file = g_malloc(pf_size);
g_snprintf(pid_file, pf_size, "%s\\%d.pid", u3hostexecpath, pid);
pid_fd = eth_open(pid_file, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644);
if(pid_fd != -1)
eth_close(pid_fd);
else {
g_free(pid_file);
pid_file = NULL;
}
}
}
void u3_deregister_pid()
{
if(pid_file) {
/* we don't care if we succeed or fail - u3utils may have deleted the file */
eth_unlink(pid_file);
g_free(pid_file);
pid_file = NULL;
}
}

27
gtk/u3.h Normal file
View File

@ -0,0 +1,27 @@
/* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
void u3_register_pid(void);
void u3_deregister_pid(void);

View File

@ -0,0 +1,26 @@
$Id: README.txt 18191 2006-05-20 17:54:12Z gerald $
U3 Packaging
============
This directory contains the scripts to build a U3 Pacakge (wirehsark.u3p) that can be loaded onto a U3 device. This will allow Wireshark to be run from any Windows machine the U3 device is plugged into, without having to install Wireshark directly. For more details about U3 devices, see http://www.u3.com/.
The U3 package is basically a zip file with a manifest file (wireshark.u3i), a small utility to manage the shutdown of Wireshark when the device is removed, and the Wireshark application files. The package contains all the standard Wireshark components (e.g. tshark.exe), even though they cannot be directly accessed. However, with a suitable additional script (setting the U3 environment variables), the would meet the "wireshark-as-a-zip" wish.
You will need the cygwin zip archive package to build the package itself. Once you have the package you can load the package using "Add Programs"/"Install from My Computer" from the U3 LaunchPad.
A few minor changes have been made to Wireshark itself:
1) Wireshark will write a <pid>.pid file while running. This allows the utility to close down Wireshark when the device is removed.
2) filesystem.c has been changed to take advantage of the U3 "datafile_dir" and "persconffile_dir". Personal settings are then stored on the device.
There is a [self-]certification process for U3 packages which could be undertaken if there is sufficient interest for this package format. Wireshark could then be placed on Software Central - http://software.u3.com/SoftwareCentral.aspx?skip=1.
Known Issues:
=============
1) The U3 package does not include WinPcap - so that must be installed separately on the machine into which the U3 device is plugged into.
2) The distribution of the files across the U3 host and U3 device needs to be verified for all protocols.
3) The list of files should be derived from a common source (e.g. nsis/wireshark.nsi)
4) Should there be a Wiki page? Yes - but where?
5) Wireshark does not close down cleanly when a dialog is up.

View File

@ -0,0 +1,308 @@
#
# $Id: Makefile.nmake 18526 2006-06-21 06:31:06Z jake $
#
include ../../../config.nmake
include <win32.mak>
CC = cl
LINK = link
LDFLAGS = /NOLOGO /INCREMENTAL:no /MACHINE:I386 $(LOCAL_LDFLAGS)
DEVICE = device
HOST = host
MANIFEST= manifest
DATA = data
TOPDIR = ..\..\..
COPY = xcopy
MKDIR = mkdir
COPY_FLAGS = /d /y
all: package
manifest.u3i: manifest.tmpl $(TOPDIR)\config.nmake
sed -e 's/$$(VERSION)/$(VERSION)/g' < manifest.tmpl > manifest.u3i
$(HOST):
$(MKDIR) $(HOST)
$(MKDIR) $(HOST)\etc
$(MKDIR) $(HOST)\etc\gtk-2.0
$(MKDIR) $(HOST)\etc\pango
$(MKDIR) $(HOST)\lib
$(MKDIR) $(HOST)\lib\gtk-2.0
$(MKDIR) $(HOST)\lib\gtk-2.0\$(GTK2_LIB_DIR)
$(MKDIR) $(HOST)\lib\gtk-2.0\$(GTK2_LIB_DIR)\loaders
$(MKDIR) $(HOST)\lib\gtk-2.0\$(GTK2_LIB_DIR)\immodules
$(MKDIR) $(HOST)\lib\pango
$(MKDIR) $(HOST)\lib\pango\$(PANGO_LIB_DIR)
$(MKDIR) $(HOST)\lib\pango\$(PANGO_LIB_DIR)\modules
$(DEVICE):
$(MKDIR) $(DEVICE)
$(MKDIR) $(DEVICE)\plugins
$(MKDIR) $(DEVICE)\plugins\$(VERSION)
$(MKDIR) $(DEVICE)\help
$(MKDIR) $(DEVICE)\share
$(MKDIR) $(DEVICE)\share\themes
$(MKDIR) $(DEVICE)\share\themes\Default
$(MKDIR) $(DEVICE)\share\themes\Default\gtk-2.0
$(MKDIR) $(DEVICE)\snmp
$(MKDIR) $(DEVICE)\snmp\mibs
$(MKDIR) $(DEVICE)\diameter
$(MKDIR) $(DEVICE)\dtds
$(MKDIR) $(DEVICE)\radius
$(DATA):
$(MKDIR) $(DATA)
$(MANIFEST):
$(MKDIR) $(MANIFEST)
distribution: $(HOST) $(DEVICE) $(DATA) $(MANIFEST) manifest.u3i u3util.exe
# manifest
$(COPY) manifest.u3i $(MANIFEST) $(COPY_FLAGS)
$(COPY) $(TOPDIR)\image\wireshark.ico $(MANIFEST) $(COPY_FLAGS)
# device
#
# these files stay on the U3 device and should not cause Wireshark to become unstable
# if they are missing (e.g. U3 device removed)
#
$(COPY) $(TOPDIR)\AUTHORS-SHORT $(DEVICE) $(COPY_FLAGS)
$(COPY) $(TOPDIR)\AUTHORS-SHORT-FORMAT $(DEVICE) $(COPY_FLAGS)
$(COPY) $(TOPDIR)\COPYING $(DEVICE) $(COPY_FLAGS)
$(COPY) $(TOPDIR)\FAQ $(DEVICE) $(COPY_FLAGS)
$(COPY) $(TOPDIR)\README $(DEVICE) $(COPY_FLAGS)
$(COPY) $(TOPDIR)\doc\capinfos.html $(DEVICE) $(COPY_FLAGS)
$(COPY) $(TOPDIR)\diameter\chargecontrol.xml $(DEVICE)\diameter $(COPY_FLAGS)
$(COPY) $(TOPDIR)\diameter\dictionary.dtd $(DEVICE)\diameter $(COPY_FLAGS)
$(COPY) $(TOPDIR)\diameter\dictionary.xml $(DEVICE)\diameter $(COPY_FLAGS)
$(COPY) $(TOPDIR)\diameter\imscxdx.xml $(DEVICE)\diameter $(COPY_FLAGS)
$(COPY) $(TOPDIR)\diameter\mobileipv4.xml $(DEVICE)\diameter $(COPY_FLAGS)
$(COPY) $(TOPDIR)\diameter\nasreq.xml $(DEVICE)\diameter $(COPY_FLAGS)
$(COPY) $(TOPDIR)\diameter\sunping.xml $(DEVICE)\diameter $(COPY_FLAGS)
$(COPY) $(TOPDIR)\diameter\TGPPSh.xml $(DEVICE)\diameter $(COPY_FLAGS)
$(COPY) $(TOPDIR)\dtds\dc.dtd $(DEVICE)\dtds $(COPY_FLAGS)
$(COPY) $(TOPDIR)\dtds\itunes.dtd $(DEVICE)\dtds $(COPY_FLAGS)
$(COPY) $(TOPDIR)\dtds\pocsettings.dtd $(DEVICE)\dtds $(COPY_FLAGS)
$(COPY) $(TOPDIR)\dtds\presence.dtd $(DEVICE)\dtds $(COPY_FLAGS)
$(COPY) $(TOPDIR)\dtds\reginfo.dtd $(DEVICE)\dtds $(COPY_FLAGS)
$(COPY) $(TOPDIR)\dtds\rss.dtd $(DEVICE)\dtds $(COPY_FLAGS)
$(COPY) $(TOPDIR)\dtds\smil.dtd $(DEVICE)\dtds $(COPY_FLAGS)
$(COPY) $(TOPDIR)\dtds\xcap-caps.dtd $(DEVICE)\dtds $(COPY_FLAGS)
$(COPY) $(TOPDIR)\dtds\watcherinfo.dtd $(DEVICE)\dtds $(COPY_FLAGS)
$(COPY) $(TOPDIR)\doc\dumpcap.html $(DEVICE) $(COPY_FLAGS)
$(COPY) $(TOPDIR)\doc\editcap.html $(DEVICE) $(COPY_FLAGS)
$(COPY) $(TOPDIR)\help\toc $(DEVICE)\help $(COPY_FLAGS)
$(COPY) $(TOPDIR)\help\overview.txt $(DEVICE)\help $(COPY_FLAGS)
$(COPY) $(TOPDIR)\help\getting_started.txt $(DEVICE)\help $(COPY_FLAGS)
$(COPY) $(TOPDIR)\help\capturing.txt $(DEVICE)\help $(COPY_FLAGS)
$(COPY) $(TOPDIR)\help\capture_filters.txt $(DEVICE)\help $(COPY_FLAGS)
$(COPY) $(TOPDIR)\help\display_filters.txt $(DEVICE)\help $(COPY_FLAGS)
$(COPY) $(TOPDIR)\help\faq.txt $(DEVICE)\help $(COPY_FLAGS)
$(COPY) $(TOPDIR)\manuf $(DEVICE) $(COPY_FLAGS)
!IFDEF PCRE_DIR
$(COPY) $(PCRE_DIR)\man\cat3\pcrepattern.3.txt $(DEVICE) $(COPY_FLAGS)
!ENDIF
$(COPY) $(TOPDIR)\doc\mergecap.html $(DEVICE) $(COPY_FLAGS)
$(COPY) $(TOPDIR)\plugins\acn\acn.dll $(DEVICE)\plugins\$(VERSION) $(COPY_FLAGS)
$(COPY) $(TOPDIR)\plugins\agentx\agentx.dll $(DEVICE)\plugins\$(VERSION) $(COPY_FLAGS)
$(COPY) $(TOPDIR)\plugins\artnet\artnet.dll $(DEVICE)\plugins\$(VERSION) $(COPY_FLAGS)
$(COPY) $(TOPDIR)\plugins\asn1\asn1.dll $(DEVICE)\plugins\$(VERSION)$(COPY_FLAGS)
$(COPY) $(TOPDIR)\plugins\ciscosm\ciscosm.dll $(DEVICE)\plugins\$(VERSION) $(COPY_FLAGS)
$(COPY) $(TOPDIR)\plugins\docsis\docsis.dll $(DEVICE)\plugins\$(VERSION) $(COPY_FLAGS)
$(COPY) $(TOPDIR)\plugins\enttec\enttec.dll $(DEVICE)\plugins\$(VERSION) $(COPY_FLAGS)
$(COPY) $(TOPDIR)\plugins\giop\coseventcomm.dll $(DEVICE)\plugins\$(VERSION) $(COPY_FLAGS)
$(COPY) $(TOPDIR)\plugins\giop\cosnaming.dll $(DEVICE)\plugins\$(VERSION) $(COPY_FLAGS)
$(COPY) $(TOPDIR)\plugins\giop\parlay.dll $(DEVICE)\plugins\$(VERSION) $(COPY_FLAGS)
$(COPY) $(TOPDIR)\plugins\giop\tango.dll $(DEVICE)\plugins\$(VERSION) $(COPY_FLAGS)
$(COPY) $(TOPDIR)\plugins\gryphon\gryphon.dll $(DEVICE)\plugins\$(VERSION) $(COPY_FLAGS)
$(COPY) $(TOPDIR)\plugins\h223\h223.dll $(DEVICE)\plugins\$(VERSION) $(COPY_FLAGS)
$(COPY) $(TOPDIR)\plugins\irda\irda.dll $(DEVICE)\plugins\$(VERSION) $(COPY_FLAGS)
$(COPY) $(TOPDIR)\plugins\lwres\lwres.dll $(DEVICE)\plugins\$(VERSION) $(COPY_FLAGS)
$(COPY) $(TOPDIR)\plugins\megaco\megaco.dll $(DEVICE)\plugins\$(VERSION) $(COPY_FLAGS)
$(COPY) $(TOPDIR)\plugins\mgcp\mgcp.dll $(DEVICE)\plugins\$(VERSION) $(COPY_FLAGS)
$(COPY) $(TOPDIR)\plugins\opsi\opsi.dll $(DEVICE)\plugins\$(VERSION) $(COPY_FLAGS)
$(COPY) $(TOPDIR)\plugins\pcli\pcli.dll $(DEVICE)\plugins\$(VERSION) $(COPY_FLAGS)
$(COPY) $(TOPDIR)\plugins\profinet\profinet.dll $(DEVICE)\plugins\$(VERSION) $(COPY_FLAGS)
$(COPY) $(TOPDIR)\plugins\rdm\rdm.dll $(DEVICE)\plugins\$(VERSION) $(COPY_FLAGS)
$(COPY) $(TOPDIR)\plugins\rlm\rlm.dll $(DEVICE)\plugins\$(VERSION) $(COPY_FLAGS)
$(COPY) $(TOPDIR)\plugins\rtnet\rtnet.dll $(DEVICE)\plugins\$(VERSION) $(COPY_FLAGS)
$(COPY) $(TOPDIR)\plugins\rudp\rudp.dll $(DEVICE)\plugins\$(VERSION) $(COPY_FLAGS)
$(COPY) $(TOPDIR)\plugins\sbus\sbus.dll $(DEVICE)\plugins\$(VERSION) $(COPY_FLAGS)
$(COPY) $(TOPDIR)\plugins\v5ua\v5ua.dll $(DEVICE)\plugins\$(VERSION) $(COPY_FLAGS)
$(COPY) $(TOPDIR)\plugins\stats_tree\stats_tree.dll $(DEVICE)\plugins\$(VERSION) $(COPY_FLAGS)
$(COPY) $(TOPDIR)\plugins\mate\mate.dll $(DEVICE)\plugins\$(VERSION) $(COPY_FLAGS)
!IFDEF LUA_DIR
$(COPY) $(TOPDIR)\plugins\lua\lua.dll $(DEVICE)\plugins\$(VERSION) $(COPY_FLAGS)
!ENDIF
$(COPY) $(TOPDIR)\radius\dictionary $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.3com $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.3gpp $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.3gpp2 $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.acc $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.alcatel $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.alteon $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.altiga $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.aptis $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.ascend $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.bay $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.bintec $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.bristol $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.cablelabs $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.cabletron $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.cisco $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.cisco.bbsm $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.cisco.vpn3000 $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.cisco.vpn5000 $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.colubris $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.columbia_university $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.compat $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.cosine $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.ericsson $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.erx $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.extreme $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.foundry $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.freeradius $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.gandalf $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.garderos $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.gemtek $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.itk $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.juniper $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.karlnet $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.livingston $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.localweb $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.merit $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.microsoft $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.mikrotik $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.navini $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.netscreen $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.nokia $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.nomadix $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.propel $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.quintum $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.redback $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.redcreek $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.shasta $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.shiva $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.sonicwall $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.springtide $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.t_systems_nova $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.telebit $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.trapeze $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.tunnel $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.unisphere $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.unix $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.usr $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.valemount $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.versanet $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.wispr $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(TOPDIR)\radius\dictionary.xedia $(DEVICE)\radius $(COPY_FLAGS)
$(COPY) $(GTK_THEME_DIR)\gtkrc $(DEVICE)\share\themes\Default\gtk-2.0 $(COPY_FLAGS)
$(COPY) $(NET_SNMP_DIR)\mibs\*.txt $(DEVICE)\snmp\mibs $(COPY_FLAGS)
$(COPY) $(TOPDIR)\doc\text2pcap.html $(DEVICE) $(COPY_FLAGS)
$(COPY) $(TOPDIR)\doc\tshark.html $(DEVICE) $(COPY_FLAGS)
$(COPY) $(TOPDIR)\doc\wireshark.html $(DEVICE) $(COPY_FLAGS)
$(COPY) $(TOPDIR)\doc\wireshark-filter.html $(DEVICE) $(COPY_FLAGS)
!IFDEF LUA_DIR
$(COPY) $(TOPDIR)\plugins\lua\init.lua $(DEVICE) $(COPY_FLAGS)
!ENDIF
# host
#
# these files are copy onto the U3 host and are required to make Wireshark stable
#
$(COPY) $(TOPDIR)\wiretap\wiretap-$(WTAP_VERSION).dll $(HOST) $(COPY_FLAGS)
!IFDEF ENABLE_LIBWIRESHARK
$(COPY) $(TOPDIR)\epan\libwireshark.dll $(HOST) $(COPY_FLAGS)
!ENDIF
$(COPY) $(GLIB_DIR)\bin\libglib-2.0-0.dll $(HOST) $(COPY_FLAGS)
$(COPY) $(GLIB_DIR)\bin\libgmodule-2.0-0.dll $(HOST) $(COPY_FLAGS)
$(COPY) $(GLIB_DIR)\bin\libgobject-2.0-0.dll $(HOST) $(COPY_FLAGS)
$(COPY) $(ICONV_DIR)\bin\iconv.dll $(HOST) $(COPY_FLAGS)
$(COPY) $(GETTEXT_DIR)\bin\intl.dll $(HOST) $(COPY_FLAGS)
!ifdef ZLIB_DIR
$(COPY) $(ZLIB_DIR)\zlib1.dll $(HOST) $(COPY_FLAGS)
!endif
!IFDEF ADNS_DIR
$(COPY) $(ADNS_DIR)\adns_win32\LIB\adns_dll.dll $(HOST) $(COPY_FLAGS)
!ENDIF
!IFDEF PCRE_DIR
$(COPY) $(PCRE_DIR)\bin\pcre.dll $(HOST) $(COPY_FLAGS)
!ENDIF
!ifdef KFW_DIR
$(COPY) $(KFW_DIR)\bin\comerr32.dll $(HOST) $(COPY_FLAGS)
$(COPY) $(KFW_DIR)\bin\krb5_32.dll $(HOST) $(COPY_FLAGS)
!endif
!ifdef GNUTLS_DIR
$(COPY) $(GNUTLS_DIR)\bin\libgcrypt-11.dll $(HOST) $(COPY_FLAGS)
$(COPY) $(GNUTLS_DIR)\bin\libgnutls-14.dll $(HOST) $(COPY_FLAGS)
$(COPY) $(GNUTLS_DIR)\bin\libgnutls-extra-14.dll $(HOST) $(COPY_FLAGS)
$(COPY) $(GNUTLS_DIR)\bin\libgnutls-openssl-14.dll $(HOST) $(COPY_FLAGS)
$(COPY) $(GNUTLS_DIR)\bin\libgpg-error-0.dll $(HOST) $(COPY_FLAGS)
$(COPY) $(GNUTLS_DIR)\bin\libtasn1-3.dll $(HOST) $(COPY_FLAGS)
!endif
!IFDEF GTK2_DIR
$(COPY) $(TOPDIR)\wireshark-gtk2.exe $(HOST) $(COPY_FLAGS)
# can't get /i to work with $(COPY) above to do the rename there
mv $(HOST)\wireshark-gtk2.exe $(HOST)\wireshark.exe
$(COPY) $(GTK2_DIR)\bin\libgdk-win32-2.0-0.dll $(HOST) $(COPY_FLAGS)
$(COPY) $(GTK2_DIR)\bin\libgdk_pixbuf-2.0-0.dll $(HOST) $(COPY_FLAGS)
$(COPY) $(GTK2_DIR)\bin\libgtk-win32-2.0-0.dll $(HOST) $(COPY_FLAGS)
$(COPY) $(GTK2_DIR)\bin\libatk-1.0-0.dll $(HOST) $(COPY_FLAGS)
$(COPY) $(GTK2_DIR)\bin\libpango-1.0-0.dll $(HOST) $(COPY_FLAGS)
$(COPY) $(GTK2_DIR)\bin\libpangowin32-1.0-0.dll $(HOST) $(COPY_FLAGS)
!IFDEF NEED_CAIRO_DLL
$(COPY) $(GTK2_DIR)\bin\libcairo-2.dll $(HOST) $(COPY_FLAGS)
$(COPY) $(GTK2_DIR)\bin\libpangocairo-1.0-0.dll $(HOST) $(COPY_FLAGS)
!ENDIF
!IFDEF NEED_LIBPNG_DLL
$(COPY) $(GTK2_DIR)\bin\libpng13.dll $(HOST) $(COPY_FLAGS)
!ENDIF
$(COPY) $(GTK2_DIR)\etc\gtk-2.0\*.* $(HOST)\etc\gtk-2.0 $(COPY_FLAGS)
$(COPY) $(GTK2_DIR)\etc\pango\pango.* $(HOST)\etc\pango $(COPY_FLAGS)
$(COPY) $(GTK2_DIR)\lib\gtk-2.0\$(GTK2_LIB_DIR)\loaders\libpixbufloader-*.dll $(HOST)\lib\gtk-2.0\$(GTK2_LIB_DIR)\loaders
$(COPY) $(GTK2_DIR)\lib\gtk-2.0\$(GTK2_LIB_DIR)\immodules\im-*.dll $(HOST)\lib\gtk-2.0\$(GTK2_LIB_DIR)\immodules
$(COPY) $(GTK2_DIR)\lib\pango\$(PANGO_LIB_DIR)\modules\pango-*.dll $(HOST)\lib\pango\$(PANGO_LIB_DIR)\modules
!IFDEF GTK_WIMP_DIR
$(COPY) $(GTK_WIMP_DIR)\libwimp.dll $(HOST) $(COPY_FLAGS)
$(COPY) $(GTK_THEME_DIR)\gtkrc $(HOST)\etc\gtk-2.0 $(COPY_FLAGS)
!ENDIF
!ELSE
!IFDEF GTK1_DIR
$(COPY) $(TOPDIR)\wireshark.exe $(HOST) $(COPY_FLAGS)
$(COPY) $(GTK1_DIR)\lib\libgtk-0.dll $(HOST) $(COPY_FLAGS)
$(COPY) $(GTK1_DIR)\lib\libgdk-0.dll $(HOST) $(COPY_FLAGS)
!ENDIF
!ENDIF
$(COPY) $(TOPDIR)\capinfos.exe $(HOST) $(COPY_FLAGS)
$(COPY) $(TOPDIR)\dumpcap.exe $(HOST) $(COPY_FLAGS)
$(COPY) $(TOPDIR)\editcap.exe $(HOST) $(COPY_FLAGS)
$(COPY) $(TOPDIR)\mergecap.exe $(HOST) $(COPY_FLAGS)
$(COPY) $(TOPDIR)\text2pcap.exe $(HOST) $(COPY_FLAGS)
$(COPY) $(TOPDIR)\tshark.exe $(HOST) $(COPY_FLAGS)
$(COPY) u3util.exe $(HOST) $(COPY_FLAGS)
package: distribution
zip -r wireshark.u3p $(MANIFEST) $(DEVICE) $(DATA) $(HOST)
u3util_LIBS= user32.lib kernel32.lib
u3util.exe: u3util.obj
@echo Linking $@
$(LINK) /OUT:u3util.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console u3util.obj $(u3util_LIBS)
clean:
rm -rf manifest.u3i
rm -rf $(HOST)
rm -rf $(DEVICE)
rm -rf $(DATA)
rm -rf $(MANIFEST)
rm -rf u3util.{exe,obj}
rm -rf wireshark.u3p
rm -rf *~
distclean: clean
maintainer-clean: distclean

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<u3manifest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="C:\ethereal\packaging\u3\U3_manifest_1003.xsd" version="1.0">
<application uuid="11b47440-1fa7-11db-9ce2-0002a5d5c51b" version="$(VERSION)">
<icon>wireshark.ico</icon>
<name>Wireshark</name>
<vendor url="http://www.wireshark.org/">The Wireshark Developer Community</vendor>
<description>Wireshark is one of the world's foremost network protocol analyzers, and is the standard in many parts of the industry.</description>
<options>
<minFreeSpace>60</minFreeSpace>
</options>
</application>
<actions>
<appStart cmd="%U3_HOST_EXEC_PATH%\wireshark.exe"/>
<appStop cmd="%U3_HOST_EXEC_PATH%\u3util.exe">appStop</appStop>
<hostCleanUp cmd="%U3_HOST_EXEC_PATH%\u3util.exe">hostCleanUp</hostCleanUp>
</actions>
</u3manifest>

292
packaging/u3/win32/u3util.c Normal file
View File

@ -0,0 +1,292 @@
/* u3util.c
* Utility routines for U3 device support
*
* $Id: oid_resolv.c 18197 2006-05-21 05:12:17Z sahlberg $
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* Adapted from Microsoft Knowledge Base Article 178893
*
* http://support.microsoft.com/?kbid=178893
*
* and the U3 Answer 106
*
* https://u3.custhelp.com/cgi-bin/u3/php/enduser/std_adp.php?p_faqid=106
*
* Indentation logic: 2-space
*/
#include <windows.h>
#define TA_FAILED 0
#define TA_SUCCESS_CLEAN 1
#define TA_SUCCESS_KILL 2
#define TA_SUCCESS_16 3
DWORD TerminateApp( DWORD dwPID, DWORD dwTimeout ) ;
DWORD Terminate16App( DWORD dwPID, DWORD dwThread, WORD w16Task, DWORD dwTimeout );
#include <vdmdbg.h>
typedef struct
{
DWORD dwID ;
DWORD dwThread ;
} TERMINFO ;
/* Declare Callback Enum Functions. */
BOOL CALLBACK TerminateAppEnum( HWND hwnd, LPARAM lParam ) ;
BOOL CALLBACK Terminate16AppEnum( HWND hwnd, LPARAM lParam ) ;
/*----------------------------------------------------------------
DWORD TerminateApp( DWORD dwPID, DWORD dwTimeout )
Purpose:
Shut down a 32-Bit Process (or 16-bit process under Windows 95)
Parameters:
dwPID
Process ID of the process to shut down.
dwTimeout
Wait time in milliseconds before shutting down the process.
Return Value:
TA_FAILED - If the shutdown failed.
TA_SUCCESS_CLEAN - If the process was shutdown using WM_CLOSE.
TA_SUCCESS_KILL - if the process was shut down with
TerminateProcess().
NOTE: See header for these defines.
----------------------------------------------------------------*/
DWORD TerminateApp( DWORD dwPID, DWORD dwTimeout )
{
HANDLE hProc ;
DWORD dwRet ;
// If we can't open the process with PROCESS_TERMINATE rights,
// then we give up immediately.
hProc = OpenProcess(SYNCHRONIZE|PROCESS_TERMINATE, FALSE, dwPID);
if(hProc == NULL){
return TA_FAILED;
}
if(dwTimeout) {
/* we are prepared to wait */
/* TerminateAppEnum() posts WM_CLOSE to all windows whose PID */
/* matches your process's. */
EnumWindows((WNDENUMPROC)TerminateAppEnum, (LPARAM) dwPID) ;
/* Wait on the handle. If it signals, great. If it times out, */
/* then you kill it. */
if(WaitForSingleObject(hProc, dwTimeout)!=WAIT_OBJECT_0)
dwRet=(TerminateProcess(hProc,0)?TA_SUCCESS_KILL:TA_FAILED);
else
dwRet = TA_SUCCESS_CLEAN ;
} else {
/* we immediately kill the proces */
dwRet=(TerminateProcess(hProc,0)?TA_SUCCESS_KILL:TA_FAILED);
}
CloseHandle(hProc) ;
return dwRet ;
}
/*----------------------------------------------------------------
DWORD Terminate16App( DWORD dwPID, DWORD dwThread,
WORD w16Task, DWORD dwTimeout )
Purpose:
Shut down a Win16 APP.
Parameters:
dwPID
Process ID of the NTVDM in which the 16-bit application is
running.
dwThread
Thread ID of the thread of execution for the 16-bit
application.
w16Task
16-bit task handle for the application.
dwTimeout
Wait time in milliseconds before shutting down the task.
Return Value:
If successful, returns TA_SUCCESS_16
If unsuccessful, returns TA_FAILED.
NOTE: These values are defined in the header for this
function.
NOTE:
You can get the Win16 task and thread ID through the
VDMEnumTaskWOW() or the VDMEnumTaskWOWEx() functions.
----------------------------------------------------------------*/
DWORD Terminate16App( DWORD dwPID, DWORD dwThread, WORD w16Task, DWORD dwTimeout )
{
HINSTANCE hInstLib ;
TERMINFO info ;
/* You will be calling the functions through explicit linking */
/* so that this code will be binary compatible across */
/* Win32 platforms. */
BOOL (WINAPI *lpfVDMTerminateTaskWOW)(DWORD dwProcessId, WORD htask) ;
hInstLib = LoadLibraryA( "VDMDBG.DLL" ) ;
if( hInstLib == NULL )
return TA_FAILED ;
// Get procedure addresses.
lpfVDMTerminateTaskWOW = (BOOL (WINAPI *)(DWORD, WORD ))
GetProcAddress( hInstLib, "VDMTerminateTaskWOW" ) ;
if( lpfVDMTerminateTaskWOW == NULL )
{
FreeLibrary( hInstLib ) ;
return TA_FAILED ;
}
/* Post a WM_CLOSE to all windows that match the ID and the */
/* thread. */
info.dwID = dwPID ;
info.dwThread = dwThread ;
EnumWindows((WNDENUMPROC)Terminate16AppEnum, (LPARAM) &info) ;
/* Wait. */
Sleep( dwTimeout ) ;
/* Then terminate. */
lpfVDMTerminateTaskWOW(dwPID, w16Task) ;
FreeLibrary( hInstLib ) ;
return TA_SUCCESS_16 ;
}
BOOL CALLBACK TerminateAppEnum( HWND hwnd, LPARAM lParam )
{
DWORD dwID ;
GetWindowThreadProcessId(hwnd, &dwID) ;
if(dwID == (DWORD)lParam)
{
PostMessage(hwnd, WM_CLOSE, 0, 0) ;
}
return TRUE ;
}
BOOL CALLBACK Terminate16AppEnum( HWND hwnd, LPARAM lParam )
{
DWORD dwID ;
DWORD dwThread ;
TERMINFO *termInfo ;
termInfo = (TERMINFO *)lParam ;
dwThread = GetWindowThreadProcessId(hwnd, &dwID) ;
if(dwID == termInfo->dwID && termInfo->dwThread == dwThread )
{
PostMessage(hwnd, WM_CLOSE, 0, 0) ;
}
return TRUE ;
}
/* This is the new function */
void app_stop(DWORD timeOut)
{
DWORD pid = 0;
HANDLE hFind = INVALID_HANDLE_VALUE;
WIN32_FIND_DATA find_file_data;
DWORD dwError;
char *u3_host_exec_path;
char dir_spec[MAX_PATH+1];
char file_name[MAX_PATH+1];
u3_host_exec_path = getenv("U3_HOST_EXEC_PATH");
strncpy(dir_spec, u3_host_exec_path, strlen(u3_host_exec_path) + 1);
strncat(dir_spec, "\\*.pid", 7);
hFind = FindFirstFile(dir_spec, &find_file_data);
if(hFind != INVALID_HANDLE_VALUE) {
do {
pid = (DWORD)atoi(find_file_data.cFileName);
if(pid)
TerminateApp(pid, timeOut);
strncpy(file_name, u3_host_exec_path, strlen(u3_host_exec_path) + 1);
strncat(file_name, "\\", 2);
strncat(file_name, find_file_data.cFileName, strlen(find_file_data.cFileName) + 1);
DeleteFile(TEXT(file_name));
} while(FindNextFile(hFind, &find_file_data) != 0);
FindClose(hFind);
}
}
void host_clean_up(void)
{
/* the device has been removed -
just close the application as quickly as possible */
app_stop(0);
}
main(int argc, char *argv[])
{
DWORD time_out = 0;
char *u3_is_device_available;
u3_is_device_available = getenv("U3_IS_DEVICE_AVAILABLE");
if(u3_is_device_available && !strncmp(u3_is_device_available, "true", 5))
/* the device is available - wait 5 seconds for user to respond to
any dialogs */
time_out = 5000; /* 5 seconds */
if(argc > 1) {
if(!strncmp(argv[1], "appStop", 8))
app_stop(time_out);
else if(!strncmp(argv[1], "hostCleanUp", 11))
host_clean_up();
}
exit(0);
}