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.

59 lines
1.4 KiB

  1. @REM -----------------------------------------------------------------
  2. @REM
  3. @REM infsizedefs.cmd - JTolman
  4. @REM Generate a list of default file sizes for layout.inf
  5. @REM
  6. @REM Copyright (c) Microsoft Corporation. All rights reserved.
  7. @REM
  8. @REM -----------------------------------------------------------------
  9. @perl -x "%~f0" %*
  10. @goto :EOF
  11. #!perl
  12. use strict;
  13. use lib $ENV{RAZZLETOOLPATH} . "\\PostBuildScripts";
  14. use lib $ENV{RAZZLETOOLPATH};
  15. use PbuildEnv;
  16. use ParseArgs;
  17. use Logmsg;
  18. sub Usage { print<<USAGE; exit(1) }
  19. infsizedefs.cmd <bin_dir> <outfile>
  20. <bin_dir> A binaries directory to get copies of layout.inf from.
  21. Should be from a completed build.
  22. <outfile> A filename to output the results to.
  23. USAGE
  24. my ($bindir, $out);
  25. parseargs('?' => \&Usage,
  26. \$bindir,
  27. \$out);
  28. # Read in the info from layout.
  29. my %sizes;
  30. logmsg("Collecting size information...");
  31. for (`dir /a-d $bindir`) {
  32. next if !/^\S+\s+\S+\s+\S+\s+(\S+)\s+(\S+)\s*$/;
  33. my $name = lc $2;
  34. my $size = $1;
  35. $size =~ s/[^0-9]//g;
  36. if ($size eq "") {
  37. chomp;
  38. wrnmsg("Unknown data: $_");
  39. next;
  40. }
  41. $sizes{$name} = $size;
  42. }
  43. # Write out the file.
  44. if (!open OUT, ">$out") {
  45. errmsg( "Unable to open output file." );
  46. die;
  47. }
  48. foreach my $name (sort keys %sizes) {
  49. print OUT "$name\:$sizes{$name}\n";
  50. }
  51. close OUT;