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.

180 lines
4.6 KiB

  1. #! /bin/perl
  2. $Usage = "getfilestatus.pl CDDATAFILE-OR-BUILDNO file ...\n";
  3. $sdxroot = $ENV{'SDXROOT'};
  4. $nttree = $ENV{'_NTTREE'};
  5. #
  6. # wpsbled
  7. #
  8. $t_HOM = 0x0001;
  9. $t_PRO = 0x0002;
  10. $t_SRV = 0x0004;
  11. $t_BLD = 0x0008;
  12. $t_SBS = 0x0010;
  13. $t_ADS = 0x0020;
  14. $t_DTC = 0x0040;
  15. $t_SRVS= 0x007c;
  16. $t_CLNT= 0x0003;
  17. $t_ALL = 0x007f;
  18. die $Usage if @ARGV < 1;
  19. $build = shift ARGV;
  20. $_ = $build;
  21. $ispath = (/^latest/i or /^[A-Z]:/i);
  22. unshift(@ARGV, $_), $build = 'latest.tst' unless $ispath or /^\d{4}$/ or /^latest/i;
  23. $cddata = $_ if $ispath;
  24. $build = 'latest.tst' if $ispath;
  25. if ($sdxroot) {
  26. $lockeddir = $sdxroot . '\mergedcomponents\PopFilter';
  27. unless ($cddata) {
  28. $cddata = "$nttree\\build_logs\\cddata.txt.full";
  29. $cddata = "\\\\winbuilds\\release\\main\\usa\\$build\\x86fre\\bin.srv\\build_logs\\cddata.txt.full" unless -e $cddata;
  30. $cddata = "\\\\winbuilds\\release\\main\\usa\\$build\\x86fre\\bin\\build_logs\\cddata.txt.full" unless -e $cddata;
  31. }
  32. } else {
  33. $lockeddir = "\\\\winbuilds\\release\\main\\usa\\$build\\x86fre\\bin.srv\\PopFilter";
  34. $lockeddir = "\\\\winbuilds\\release\\main\\usa\\$build\\x86fre\\bin\\PopFilter" unless -d $lockeddir;
  35. $cddata = "\\\\winbuilds\\release\\main\\usa\\$build\\x86fre\\bin.srv\\build_logs\\cddata.txt.full" unless $cddata;
  36. $cddata = "\\\\winbuilds\\release\\main\\usa\\$build\\x86fre\\bin\\build_logs\\cddata.txt.full" unless $cddata;
  37. }
  38. die "Could not find $lockeddir\n" unless -d $lockeddir;
  39. print "Using $cddata\n and $lockeddir\\*\n"; # if $ENV{'GETXPFILESTATUS_VERBOSE'};
  40. open CDDATA, "<$cddata" or die "Could not open ", $cddata, "\n";
  41. $fname = "$lockeddir\\LockedFiles";
  42. open LFILES, "<$fname" or die "Could not open ", $fname, "\n";
  43. $fname = "$lockeddir\\LockedDrivers";
  44. open LDRVRS, "<$fname" or die "Could not open ", $fname, "\n";
  45. for (<LFILES>) {
  46. chop;
  47. s/\s//g;
  48. next if /^#/;
  49. $lfiles{lc $_}++;
  50. }
  51. for (<LDRVRS>) {
  52. chop;
  53. s/\s//g;
  54. next if /^#/;
  55. $ldrvrs{lc $_}++;
  56. }
  57. close LFILES;
  58. close LDRVRS;
  59. $lineno = 0;
  60. for (<CDDATA>) {
  61. $lineno++;
  62. chop;
  63. s/\s*;.*$//;
  64. next if /^$/;
  65. ($fullpath, $rest) = split '=';
  66. $fullpath =~ s/\s//g;
  67. ($signed, $prods, $driver, $comp, $print, $dosnet, $unicode, $drvindex, $drmlevel) = split ':', $rest;
  68. $prods = lc $prods;
  69. $desktop = ($prods =~ /[wp]/);
  70. $t_hom = (-1 == index $prods, 'p') ? 0x0000 : $t_HOM;
  71. $t_pro = (-1 == index $prods, 'w') ? 0x0000 : $t_PRO;
  72. $t_srv = (-1 == index $prods, 's') ? 0x0000 : $t_SRV;
  73. $t_bld = (-1 == index $prods, 'b') ? 0x0000 : $t_BLD;
  74. $t_sbs = (-1 == index $prods, 'l') ? 0x0000 : $t_SBS;
  75. $t_ads = (-1 == index $prods, 'e') ? 0x0000 : $t_ADS;
  76. $t_dtc = (-1 == index $prods, 'd') ? 0x0000 : $t_DTC;
  77. $t_code = $t_hom | $t_pro | $t_srv | $t_bld | $t_sbs | $t_ads | $t_dtc;
  78. if ($fullpath !~ m/\\/) {
  79. $pathname = "";
  80. $filename = $fullpath;
  81. } else {
  82. $fullpath =~ m/(.*)\\([^\\]+)$/;
  83. $pathname = $1;
  84. $filename = $2;
  85. }
  86. $t_last = $cddata{lc $filename};
  87. $lcfilename = lc $filename;
  88. # warn "Multiple cddata entry for $_ at line $lineno ($t_last & $t_code)\n" if $t_last & $t_code;
  89. $cddata{$lcfilename} |= $t_code;
  90. }
  91. close CDDATA;
  92. if (@ARGV == 1 && $ARGV[0] =~ /all/i) {
  93. @todo = keys %cddata if @ARGV == 1 && $ARGV[0] =~ /all/i;
  94. } else {
  95. for (@ARGV) {
  96. push @todo, glob $_;
  97. }
  98. }
  99. foreach (@todo) {
  100. $t_code = $cddata{lc $_};
  101. if (not $t_code) {
  102. printf "%-12s !!UNKNOWN!!\n", $_;
  103. next;
  104. }
  105. printf "%-12s ", $_;
  106. $locking = 0;
  107. $locking |= 2 if $lfiles{lc $_};
  108. $locking |= 1 if $ldrvrs{lc $_};
  109. print 'notlocked ' if $locking == 0;
  110. print 'LOCKEDFile ' if $locking == 2;
  111. print 'LOCKEDDriver ' if $locking == 1;
  112. print 'LOCKEDBoth ' if $locking == 3;
  113. if ($t_code == $t_ALL) {
  114. print "ALL\n";
  115. next;
  116. }
  117. if ($t_code == $t_SRVS) {
  118. print "ALLSRVS\n";
  119. next;
  120. }
  121. if ($t_code == $t_CLNT) {
  122. print "ALLCLNT\n";
  123. next;
  124. }
  125. print 'Home ' if $t_code & $t_HOM;
  126. print 'Pro ' if $t_code & $t_PRO;
  127. print 'Srv ' if $t_code & $t_SRV;
  128. print 'Blade ' if $t_code & $t_BLD;
  129. print 'SBS ' if $t_code & $t_SBS;
  130. print 'Adv ' if $t_code & $t_ADS;
  131. print 'DTC ' if $t_code & $t_DTC;
  132. printf "\n";
  133. }
  134. exit 0;