Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

29 lines
784 B

#
# bintoc.pl:
#
# Nadim Abdo 2002
# CopyRight Microsoft Corporation
#
# Converts a binary data file to a format suitable for inclusion in a .C file
#
$input_filename = shift || die "Usage: bintoc.pl infile outfile\n";
$output_filename = shift || die "Usage: bintoc.pl infile outfile\n";;
print "Converting: $input_filename to: $output_filename \n";
open INFILE, $input_filename or die "Can't open $input_filename\n";
open(OUTFILE, "> $output_filename") or die "Can't open $output_filename\n";
binmode INFILE;
$count = 0;
while (read INFILE, $buf, 4) {
#byte swap
$buf = pack("N*",unpack("V*",$buf));
$extracted = unpack 'H*', $buf;
print OUTFILE "0x$extracted,";
if ($count++ > 5 ) {
print OUTFILE "\n";
$count = 0;
}
}