Check-in [eda3d468e1]
Overview
SHA1:eda3d468e1e2650e6c4bc3212a46d28bc823df87
Date: 2014-01-25 06:40:22
User: rkeene
Comment:Cleaned up
Timelines: family | ancestors | descendants | both | trunk
Downloads: Tarball | ZIP archive
Other Links: files | file ages | folders | manifest
Tags And Properties
Context
2014-01-25
06:57
[1384012f07] Updated to cleanup at any exit point (user: rkeene, tags: trunk)
06:40
[eda3d468e1] Cleaned up (user: rkeene, tags: trunk)
06:27
[8f671ec548] Updated to name service we create "npf", which is what winpcap expects to find and creates if not present (user: rkeene, tags: trunk)
Changes

Modified main.tcl from [836be22022] to [2ed373a5f2].

     3      3   package require starkit
     4      4   starkit::startup
     5      5   
     6      6   lappend auto_path [file join $::starkit::topdir twapi]
     7      7   
     8      8   package require twapi
     9      9   
    10         -# http://blogs.msdn.com/b/david.wang/archive/2006/03/26/howto-detect-process-bitness.aspx
           10  +# Determine platform to install driver for
           11  +## http://blogs.msdn.com/b/david.wang/archive/2006/03/26/howto-detect-process-bitness.aspx
    11     12   if {[info exists ::env(PROCESSOR_ARCHITEW6432)]} {
    12     13   	set arch $::env(PROCESSOR_ARCHITEW6432)
    13     14   } else {
    14     15   	if {[info exists ::env(PROCESSOR_ARCHITECTURE)]} {
    15     16   		set arch $::env(PROCESSOR_ARCHITECTURE)
    16     17   	} else {
    17     18   		set arch "x86"
................................................................................
    61     62   		set iface_adapter [lindex [::twapi::get_netif_info $iface_idx -adaptername] 1]
    62     63   		set iface_npf "\\Device\\NPF_${iface_adapter}"
    63     64   
    64     65   		set argv [lreplace $argv $dest_parm_idx $dest_parm_idx $iface_npf]
    65     66   	}
    66     67   }
    67     68   
    68         -# Copy files neeed to temporary directory
           69  +# Determine name of temporary directory
    69     70   for {set i 0} {$i < 20} {incr i} {
    70     71   	append random_bin [format %c [expr {int(rand() * 256)}]]
    71     72   }
    72     73   binary scan $random_bin H* random
    73     74   
    74     75   set srcdir [file join $::starkit::topdir files]
    75         -set dstdir [file join $tmpdir tcpdmp-$random]
    76         -
    77         -file delete -force -- $dstdir
           76  +set dstdir [file join $tmpdir tcpdump-temp-$random]
    78     77   
    79     78   # Run tcpdump
    80     79   set exit 1
    81         -set start_npf_service 0
    82     80   set npf_failed 0
    83     81   if {[catch {
    84         -	set filesdir [file join $dstdir files]
           82  +	## Create directory
           83  +	file delete -force -- $dstdir
    85     84   	file mkdir $dstdir
    86     85   
           86  +	## Copy files to directory
           87  +	set filesdir [file join $dstdir files]
    87     88   	file copy -- $srcdir $filesdir
    88     89   
    89     90   	## Delete extraneous service
    90     91   	catch {
    91     92   		::twapi::stop_service npf
    92     93   	}
    93     94   
................................................................................
   105    106   		if {!$started} {
   106    107   			error "npf did not start"
   107    108   		}
   108    109   	} npf_err]} {
   109    110   		set npf_failed 1
   110    111   	}
   111    112   
   112         -	after 5000
   113         -
   114    113   	## Launch tcpdump with the apropriate parameters
   115         -	#puts [list exec -- [file join $filesdir tcpdump.exe] {*}$argv]
   116    114   	exec -- [file join $filesdir tcpdump.exe] {*}$argv >&@ stdout
   117    115   
   118    116   	set exit 0
   119    117   } err]} {
   120    118   	if {$npf_failed} {
   121    119   		puts "NPF Failed: $npf_err"
   122    120   	}