Index: main.tcl ================================================================== --- main.tcl +++ main.tcl @@ -5,11 +5,12 @@ lappend auto_path [file join $::starkit::topdir twapi] package require twapi -# http://blogs.msdn.com/b/david.wang/archive/2006/03/26/howto-detect-process-bitness.aspx +# Determine platform to install driver for +## http://blogs.msdn.com/b/david.wang/archive/2006/03/26/howto-detect-process-bitness.aspx if {[info exists ::env(PROCESSOR_ARCHITEW6432)]} { set arch $::env(PROCESSOR_ARCHITEW6432) } else { if {[info exists ::env(PROCESSOR_ARCHITECTURE)]} { set arch $::env(PROCESSOR_ARCHITECTURE) @@ -63,29 +64,29 @@ set argv [lreplace $argv $dest_parm_idx $dest_parm_idx $iface_npf] } } -# Copy files neeed to temporary directory +# Determine name of temporary directory for {set i 0} {$i < 20} {incr i} { append random_bin [format %c [expr {int(rand() * 256)}]] } binary scan $random_bin H* random set srcdir [file join $::starkit::topdir files] -set dstdir [file join $tmpdir tcpdmp-$random] - -file delete -force -- $dstdir +set dstdir [file join $tmpdir tcpdump-temp-$random] # Run tcpdump set exit 1 -set start_npf_service 0 set npf_failed 0 if {[catch { - set filesdir [file join $dstdir files] + ## Create directory + file delete -force -- $dstdir file mkdir $dstdir + ## Copy files to directory + set filesdir [file join $dstdir files] file copy -- $srcdir $filesdir ## Delete extraneous service catch { ::twapi::stop_service npf @@ -107,14 +108,11 @@ } } npf_err]} { set npf_failed 1 } - after 5000 - ## Launch tcpdump with the apropriate parameters - #puts [list exec -- [file join $filesdir tcpdump.exe] {*}$argv] exec -- [file join $filesdir tcpdump.exe] {*}$argv >&@ stdout set exit 0 } err]} { if {$npf_failed} {