aboutsummaryrefslogtreecommitdiffstats
path: root/packaging
diff options
context:
space:
mode:
authorGraeme Lunt <graeme.lunt@smhs.co.uk>2009-06-02 11:56:28 +0000
committerGraeme Lunt <graeme.lunt@smhs.co.uk>2009-06-02 11:56:28 +0000
commitbb14641726617e6a411802e4db3525155fd67454 (patch)
tree06638b18ad81240a7641296b5016a4f44933cc3d /packaging
parent57d4cea4d5dbf47c38a7b31893cbd7aa93c4fd96 (diff)
downloadwireshark-bb14641726617e6a411802e4db3525155fd67454.tar.gz
wireshark-bb14641726617e6a411802e4db3525155fd67454.tar.bz2
wireshark-bb14641726617e6a411802e4db3525155fd67454.zip
Update to install latest WinPcap and silently install/uninstall the Visual C++ 2008 Redistributable.
svn path=/trunk/; revision=28594
Diffstat (limited to 'packaging')
-rw-r--r--packaging/u3/win32/makefile.nmake22
-rw-r--r--packaging/u3/win32/u3util.c208
-rw-r--r--packaging/u3/win32/u3util.exe.manifest12
-rw-r--r--packaging/ws-manifest.pl5
4 files changed, 192 insertions, 55 deletions
diff --git a/packaging/u3/win32/makefile.nmake b/packaging/u3/win32/makefile.nmake
index 3ab90b882d..8d07457d83 100644
--- a/packaging/u3/win32/makefile.nmake
+++ b/packaging/u3/win32/makefile.nmake
@@ -23,6 +23,7 @@ COPY = xcopy
MKDIR = mkdir
COPY_FLAGS = /d /y
+!undef UPX
UPX_FLAGS = -q
U3_VERSION=$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_MICRO)
@@ -58,15 +59,13 @@ nsis-bits:
$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake user-guide.chm NEWS.txt
cd ../u3/win32
-$(WSMANIFEST):
+distribution.nmake: makenmake.pl
cd ../..
$(MAKE) /$(MAKEFLAGS) -f makefile.nmake wireshark.manifest
cd u3/win32
-
-distribution.nmake: $(WSMANIFEST) makenmake.pl
$(PERL) makenmake.pl $(WSMANIFEST) > $@
-distribution: u3-dirs manifest.u3i u3util.exe nsis-bits wireshark.bat distribution.nmake
+distribution: u3-dirs manifest.u3i u3util.exe u3util.exe.manifest nsis-bits wireshark.bat distribution.nmake
# manifest
$(COPY) manifest.u3i $(MANIFEST) $(COPY_FLAGS)
$(COPY) $(TOPDIR)\image\wireshark.ico $(MANIFEST) $(COPY_FLAGS)
@@ -87,9 +86,9 @@ pack: distribution
-$(UPX) $(UPX_FLAGS) $(DEVICE)\plugins\$(VERSION)\*.dll
-$(UPX) $(UPX_FLAGS) $(HOST)\*.dll
-$(UPX) $(UPX_FLAGS) $(HOST)\lib\gtk-2.0\$(GTK_LIB_DIR)\loaders\*.dll
- -$(UPX) $(UPX_FLAGS) $(HOST)\lib\gtk-2.0\$(GTK_LIB_DIR)\immodules\*.dll
+ -$(UPX) $(UPX_FLAGS) $(HOST)\lib\gtk-2.0\$(GTK_LIB_DIR)\engines\*.dll
-$(UPX) $(UPX_FLAGS) $(HOST)\$(GTK_WIMP_DLLDST_DIR)\*.dll
- -$(UPX) $(UPX_FLAGS) $(HOST)\[a-z]*.exe
+ -$(UPX) $(UPX_FLAGS) $(HOST)\*.exe
!ENDIF
test: pack
@@ -98,16 +97,17 @@ test: pack
package: verify-tools test
zip -r wireshark-$(VERSION).u3p $(MANIFEST) $(DEVICE) $(DATA) $(HOST) wireshark.bat
-
+CFLAGS = -DWINPCAP_PACKAGE="\"\\\\WinPcap_$(PCAP_VERSION).exe\""
u3util_LIBS= user32.lib shell32.lib
-u3util.exe: u3util.obj
+u3util.exe: u3util.obj ../../../config.nmake
@echo Linking $@
- $(LINK) /OUT:u3util.exe $(guiflags) $(LDFLAGS) u3util.obj $(u3util_LIBS) $(guilibsdll)
-# the u3util.exe don't create a manifest file, maybe because only windows (no WS specific) libs are used
+ $(LINK) @<<
+ /OUT:u3util.exe $(guiflags) $(LDFLAGS) u3util.obj $(u3util_LIBS) $(guilibsdll)
+<<
#!IF $(MSC_VER_REQUIRED) >= 1400
-# mt.exe -nologo -manifest "u3util.exe.manifest" -outputresource:u3util.exe;1
+ mt.exe -nologo -manifest "u3util.exe.manifest" -outputresource:u3util.exe;1
#!ENDIF
clean:
diff --git a/packaging/u3/win32/u3util.c b/packaging/u3/win32/u3util.c
index 0951c5515e..5f1645325d 100644
--- a/packaging/u3/win32/u3util.c
+++ b/packaging/u3/win32/u3util.c
@@ -46,11 +46,24 @@
#define SHELL_OPEN_COMMAND "\\Shell\\open\\command"
#define DEFAULT_ICON "\\DefaultIcon"
-#define WINPCAP_PACKAGE "\\WinPcap_4_0_2.exe"
#define WINPCAP_KEY "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\WinPcapInst"
#define WINPCAP_UNINSTALL "UninstallString"
#define WINPCAP_U3INSTALLED "U3Installed" /* indicate the U3 device that installed WinPcap */
+#define VCREDIST_PACKAGE "\\vcredist_x86.exe"
+#define VCREDIST_KEY "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{9A25302D-30C0-39D9-BD6F-21E6EC160475}"
+#define VCREDIST_UNINSTALL "UninstallString"
+#define VCREDIST_U3INSTALLED "U3Installed" /* indicate the U3 device that installed the redistributable */
+
+
+#define WINDOWS_VERSION_KEY "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"
+#define WINDOWS_VERSION "CurrentVersion"
+#define VISTA_VERSION "6.0"
+
+#define NPF_KEY "SYSTEM\\CurrentControlSet\\Service\\NPF"
+#define NPF_START "Start"
+#define NPF_START_VAL 2 /* SERVICE_AUTO_START */
+
#define MY_CAPTURES "\\My Captures"
#define BUFSIZ 256
@@ -309,6 +322,100 @@ void ExecuteAndWait(char *buffer)
}
}
+void uninstall(char *regkey, char *u3installed, char *uninstall)
+{
+ char buffer[BUFSIZ];
+ int buflen = BUFSIZ;
+ char *u3_device_serial;
+ char reg_key[BUFSIZ];
+ HKEY key;
+
+ /* UNINSTALL ONLY IF WE INSTALLED IT */
+ buffer[0] = '\0';
+
+ /* see if it is installed */
+ if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, regkey, 0, (KEY_READ | KEY_WRITE), &key) == ERROR_SUCCESS) {
+
+ buflen = BUFSIZ;
+
+ /* see if a U3 device installed the package */
+ if(RegQueryValueEx(key, u3installed, NULL, NULL, buffer, &buflen) == ERROR_SUCCESS) {
+
+ u3_device_serial = getenv("U3_DEVICE_SERIAL");
+
+ /* see if this U3 device installed the package */
+ if(!strncmp(buffer, u3_device_serial, strlen(u3_device_serial) + 1)) {
+
+ buffer[0] = '"';
+ buflen = BUFSIZ-1;
+ /* we installed WinPcap - we should now uninstall it - read the uninstall string */
+ (void) RegQueryValueEx(key, uninstall, NULL, NULL, &buffer[1], &buflen);
+
+
+ if(!strncmp(buffer, "\"MsiExec.exe", 12)) {
+ /* run msiexec.exe quietly */
+ strncat(buffer, " /qn", 5);
+
+ }
+
+ strncat(buffer, "\"", 2); /* close the quotes */
+
+ /* delete our value */
+ RegDeleteValue(key, u3installed);
+
+ } else {
+ /* empty the buffer */
+ buffer[0] = '\0';
+ }
+ }
+
+ RegCloseKey(key);
+ }
+
+ if(*buffer) {
+#if 0
+ MessageBox(NULL,
+ buffer,
+ "Uninstall",
+ MB_YESNO|MB_TOPMOST|MB_ICONQUESTION);
+#endif
+
+ /* we have an uninstall string */
+ ExecuteAndWait(buffer);
+ }
+}
+
+
+void winpcap_auto_start()
+{
+
+ HKEY key;
+ HKEY npfKey;
+ char buffer[BUFSIZ+1];
+ int buflen = 0;
+ DWORD startVal = NPF_START_VAL;
+
+ if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, WINDOWS_VERSION_KEY, 0, (KEY_READ), &key) == ERROR_SUCCESS) {
+
+ if(RegQueryValueEx(key, WINDOWS_VERSION, NULL, NULL, buffer, &buflen) == ERROR_SUCCESS) {
+
+ if(!strcmp(buffer, VISTA_VERSION)) {
+ /* this is Vista - set the autostart */
+ /* if installation was successful this key will now exist */
+ if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, NPF_KEY, 0, (KEY_READ | KEY_WRITE), &npfKey) == ERROR_SUCCESS) {
+
+ (void)RegSetValueEx(npfKey, NPF_START, 0, REG_DWORD, (BYTE*)&startVal, sizeof(DWORD));
+
+ RegCloseKey(npfKey);
+
+ }
+ }
+ }
+ RegCloseKey(key);
+ }
+}
+
+
void app_start(int argc, char *argv[])
{
char *u3hostexecpath;
@@ -547,11 +654,13 @@ void host_configure(void)
char *u3_device_document_path;
char wireshark_path[MAX_PATH+1];
char winpcap_path[MAX_PATH+1];
+ char vcredist_path[MAX_PATH+1];
char my_captures_path[MAX_PATH+1];
char reg_key[BUFSIZ];
char buffer[BUFSIZ];
int buflen = BUFSIZ;
boolean hasWinPcap = FALSE;
+ boolean hasRedist = FALSE;
/* CREATE THE U3 Wireshark TYPE */
if(RegCreateKeyEx(HKEY_CLASSES_ROOT, WIRESHARK_ASSOC, 0, NULL, 0,
@@ -573,10 +682,10 @@ void host_configure(void)
/* associate the application */
if(RegCreateKeyEx(HKEY_CLASSES_ROOT, reg_key, 0, NULL, 0,
(KEY_READ | KEY_WRITE), NULL, &key, &disposition) == ERROR_SUCCESS) {
-
(void)RegSetValueEx(key, "", 0, REG_SZ, wireshark_path, strlen(wireshark_path) + 1);
RegCloseKey(key);
+
}
/* associate the icon */
@@ -640,9 +749,48 @@ void host_configure(void)
(void)RegSetValueEx(key, WINPCAP_U3INSTALLED, 0, REG_SZ, u3_device_serial, strlen(u3_device_serial) + 1);
+ winpcap_auto_start();
+
+ }
+ }
+
+ /* START VCREDIST INSTALLATION IF NOT ALREADY INSTALLED */
+
+ if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, VCREDIST_KEY, 0, (KEY_READ), &key) == ERROR_SUCCESS) {
+
+ buflen = BUFSIZ;
+
+ if(RegQueryValueEx(key, VCREDIST_UNINSTALL, NULL, NULL, buffer, &buflen) == ERROR_SUCCESS) {
+
+ if(buffer[0] != '\0')
+ hasRedist = TRUE;
+ }
+
+ RegCloseKey(key);
+
+ }
+
+ if(!hasRedist) {
+
+ /* compute the U3 path to the Visual C++ redistributables package - it stays on the device */
+ u3_device_exec_path = getenv("U3_DEVICE_EXEC_PATH");
+ strncpy(vcredist_path, "\"", 2);
+ strncat(vcredist_path, u3_device_exec_path, strlen(u3_device_exec_path) + 1);
+ strncat(vcredist_path, VCREDIST_PACKAGE, strlen(VCREDIST_PACKAGE) + 1);
+ strncat(vcredist_path, "\" /q", 5); /* do things quietly */
+
+ ExecuteAndWait(vcredist_path);
+
+ if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, VCREDIST_KEY, 0, (KEY_READ | KEY_WRITE), &key) == ERROR_SUCCESS) {
+
+ u3_device_serial = getenv("U3_DEVICE_SERIAL");
+
+ (void)RegSetValueEx(key, VCREDIST_U3INSTALLED, 0, REG_SZ, u3_device_serial, strlen(u3_device_serial) + 1);
+
}
}
+
/* CREATE THE "My Captures" FOLDER IF IT DOESN'T ALREADY EXIST */
u3_device_document_path = getenv("U3_DEVICE_DOCUMENT_PATH");
@@ -667,12 +815,9 @@ Remove any references to the U3 Wireshark from the host. This involves:
void host_clean_up(void)
{
- HKEY key;
DWORD disposition;
char **pext;
char *u3_device_serial;
- char buffer[BUFSIZ];
- int buflen = BUFSIZ;
char reg_key[BUFSIZ];
/* the device has been removed -
@@ -714,42 +859,8 @@ void host_clean_up(void)
/* finally delete the toplevel key */
RegDeleteKey(HKEY_CLASSES_ROOT, WIRESHARK_ASSOC);
- /* UNINSTALL WINPCAP ONLY IF WE INSTALLED IT */
- buffer[0] = '\0';
-
- /* see if WinPcap is installed */
- if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, WINPCAP_KEY, 0, (KEY_READ | KEY_WRITE), &key) == ERROR_SUCCESS) {
-
- /* see if a U3 device installed the package */
- if(RegQueryValueEx(key, WINPCAP_U3INSTALLED, NULL, NULL, buffer, &buflen) == ERROR_SUCCESS) {
-
- u3_device_serial = getenv("U3_DEVICE_SERIAL");
-
- /* see if this U3 device installed the package */
- if(!strncmp(buffer, u3_device_serial, strlen(u3_device_serial) + 1)) {
-
- buffer[0] = '"';
- buflen = BUFSIZ-1;
- /* we installed WinPcap - we should now uninstall it - read the uninstall string */
- (void) RegQueryValueEx(key, WINPCAP_UNINSTALL, NULL, NULL, &buffer[1], &buflen);
- strncat(buffer, "\"", 2); /* close the quotes */
-
- /* delete our value */
- RegDeleteValue(key, WINPCAP_U3INSTALLED);
-
- } else {
- /* empty the buffer */
- buffer[0] = '\0';
- }
- }
-
- RegCloseKey(key);
- }
-
- if(*buffer) {
- /* we have an uninstall string */
- ExecuteAndWait(buffer);
- }
+ uninstall(WINPCAP_KEY, WINPCAP_U3INSTALLED, WINPCAP_UNINSTALL);
+ uninstall(VCREDIST_KEY, VCREDIST_U3INSTALLED, VCREDIST_UNINSTALL);
}
@@ -757,12 +868,25 @@ main(int argc, char *argv[])
{
DWORD time_out = 0;
char *u3_is_device_available;
-
+#if 0
+ char **envptr;
+ char *envval;
+# endif
u3_is_device_available = getenv("U3_IS_DEVICE_AVAILABLE");
if(u3_is_device_available && !strncmp(u3_is_device_available, "true", 4))
/* the device is available - wait for user to respond to any dialogs */
time_out = INFINITE;
+#if 0
+ for(envptr = environmentvars; *envptr; envptr++) {
+ envval = getenv(*envptr);
+
+ MessageBox(NULL,
+ envval ? envval : "NULL",
+ *envptr,
+ MB_YESNO|MB_TOPMOST|MB_ICONQUESTION);
+ }
+#endif
if(argc > 1) {
diff --git a/packaging/u3/win32/u3util.exe.manifest b/packaging/u3/win32/u3util.exe.manifest
new file mode 100644
index 0000000000..8c46f9019a
--- /dev/null
+++ b/packaging/u3/win32/u3util.exe.manifest
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!-- $Id$ -->
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+ <assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="u3util.exe" type="win32"/>
+ <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
+ <security>
+ <requestedPrivileges>
+ <requestedExecutionLevel level="asInvoker"/>
+ </requestedPrivileges>
+ </security>
+ </trustInfo>
+</assembly> \ No newline at end of file
diff --git a/packaging/ws-manifest.pl b/packaging/ws-manifest.pl
index 6b391069ef..4ebbf3fb13 100644
--- a/packaging/ws-manifest.pl
+++ b/packaging/ws-manifest.pl
@@ -4,6 +4,7 @@
#
# These are the known directories in the distribution and where they should live on a U3 device
+
my %u3locs = qw(
$INSTDIR device
$INSTDIR\${GTK_WIMP_DLLDST_DIR} host
@@ -78,10 +79,10 @@ foreach $dir(sort @dirs) {
}
if($dir eq '$INSTDIR') { # try and find a better location
- if($file =~ /\.dll$|\.exe$|EXE}$|DLL}$/) {
+ if($file =~ /\.dll$|\.exe$|EXE}$|DLL}$/ && !($file =~ /WinPcap/) && !($file =~ /VCREDIST_EXE/)) {
print " u3loc=host";
}
- }
+ }
print "\n";
}