Update: A somewhat more robust version. It correctly handles all but a dozen or so of the 6000+ exes and dlls on my system, though a couple of dozen more have timestamps well in the future (which is noted).
#! perl -slw use strict; open EXE, '<:raw', $ARGV[0] or die "$ARGV[0] : $!"; my $dos = do{ local $/ = \65536; <EXE> }; die "$ARGV[0] is not a .exe or .dll (sig='${ \substr $dos, 0, 2 }')" unless substr( $dos, 0, 2 ) eq 'MZ'; my $coffoff = 8+ unpack 'x60 V', $dos; read( EXE, $dos, $coffoff - 65536 + 4, 65536 ) or die $! if $coffoff > 65536; my $ts = unpack "x$coffoff V", $dos; print "$ARGV[0] : ", scalar( localtime $ts) || "has unfathomable times +tamp value $ts" );
Try this
#! perl -slw use strict; open EXE, '<:raw', $ARGV[0] or die "$ARGV[0] : $!"; my $dos = do{ local $/ = \1024; <EXE> }; die "$ARGV[0] is not a .exe or .dll" unless substr( $dos, 0, 2 ) eq 'M +Z'; my $coffoff = 8+ unpack 'x60 V', $dos; my $ts = unpack "x$coffoff V", $dos; print scalar localtime $ts; __END__ C:\cl>p:exetime.pl atlprov.dll Sat Jan 5 11:46:16 2002 C:\cl>p:exetime.pl cl.exe Sat Jan 5 10:48:19 2002
In reply to Re: Getting compile time out of Windows binary (exe and dll) files
by BrowserUk
in thread Getting compile time out of Windows binary (exe and dll) files
by jira0004
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |