Source code of Windows XP (NT5)
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.

225 lines
4.7 KiB

  1. #!perl -w
  2. #
  3. # A tool to create boot floppy images.
  4. #
  5. # Author: Milong Sabandith (milongs)
  6. #
  7. ##############################################################################
  8. use lib $ENV{RAZZLETOOLPATH} . "\\PostBuildScripts";
  9. use lib $ENV{RAZZLETOOLPATH};
  10. use PbuildEnv;
  11. use ParseArgs;
  12. use cksku;
  13. use ReadSetupFiles;
  14. use Logmsg;
  15. sub Usage { print<<USAGE; exit(1) }
  16. Create Boot Floppy Images.
  17. Usage: $0 share
  18. Example:
  19. $0 d:\i386
  20. USAGE
  21. $ErrorCode = 0;
  22. $listlength = 27;
  23. @skulist = (
  24. "win3.x",
  25. "win95",
  26. "win98",
  27. "win98/se",
  28. "win98/98se",
  29. "winme",
  30. "Win NT 3.51 Wks",
  31. "Win NT 4.0 Wks",
  32. "BackOffice SBS 4.x",
  33. "Win 2k Retail Pro FPP/CPP",
  34. "Win 2k OEM Pro FPP/CPP",
  35. "Win 2k Select Pro",
  36. "Win 2k MSDN Pro",
  37. "Win 2k Eval Pro",
  38. "SBS 2000",
  39. "Whistler Retail Pro FPP/CPP",
  40. "Whistler OEM Pro FPP/CPP",
  41. "Whistler Select Pro",
  42. "Whistler MSDN Pro",
  43. "Whistler Eval Pro",
  44. "Whistler Retail Pers FPP/CPP",
  45. "Whistler OEM Pers FPP/CPP",
  46. "Whistler Select Pers",
  47. "Whistler MSDN Pers",
  48. "Whistler Eval Pers",
  49. "Bobcat SBS Whistler",
  50. "BackOffice SBS Whistler"
  51. );
  52. @replist = (
  53. "win3x#3.1#950#none#any",
  54. "win9x#4.0#950#none#any",
  55. "win9x#4.1#1998#none#any",
  56. "win9x#4.1#1998#none#any",
  57. "win9x#4.1#1998#none#any",
  58. "win9x#4.9#3000#none#any",
  59. "ntw#3.51#1057#none#any",
  60. "ntw#4.0#1381#none#any",
  61. "nts#4.0#1381#sbs#any",
  62. "pro#5.0#2195#none#retail",
  63. "pro#5.0#2195#none#oem",
  64. "pro#5.0#2195#none#select",
  65. "pro#5.0#2195#none#msdn",
  66. "pro#5.0#2195#none#eval",
  67. "srv#5.0#2195#sbs#retail",
  68. "pro#5.1#2480#none#retail",
  69. "pro#5.1#2480#none#oem",
  70. "pro#5.1#2480#none#select",
  71. "pro#5.1#2480#none#msdn",
  72. "pro#5.1#2480#none#eval",
  73. "per#5.1#2480#per#retail",
  74. "per#5.1#2480#per#oem",
  75. "per#5.1#2480#per#select",
  76. "per#5.1#2480#per#msdn",
  77. "per#5.1#2480#per#eval",
  78. "srv#5.1#2480#sbs#retail",
  79. "srv#5.1#2480#sbs#retail"
  80. );
  81. sub GetFromInf {
  82. local( $filename, $section, $name, $num) = @_;
  83. $retvalue = "";
  84. open( INFFILE, "<".$filename) or die "can't open $filename: $!";
  85. LINEG: while( <INFFILE>) {
  86. chomp $_;
  87. $line = lc $_;
  88. if ($line =~ /^\[/)
  89. {
  90. $InSection = 0;
  91. }
  92. if ($line =~ /^\[$section/)
  93. {
  94. $InSection = 1;
  95. next LINEG;
  96. }
  97. if (! $InSection)
  98. {
  99. next LINEG;
  100. }
  101. @linefields = split('=', $line);
  102. # empty line
  103. if ( $#linefields == -1) {
  104. next LINEG;
  105. }
  106. $nameg = $linefields[0];
  107. #print "nameg = " . $#linefields . $nameg . "\n";
  108. if( length( $nameg) < 1)
  109. {
  110. next LINEG;
  111. }
  112. $nameg =~ s/ *$//g;
  113. if ( not ($nameg =~ /$name/)) {
  114. next LINEG;
  115. }
  116. @linefields2 = split(',', $linefields[1]);
  117. $retvalue = $linefields2[$num];
  118. # Remove spaces
  119. $retvalue =~ s/ *$//g;
  120. $retvalue =~ s/^ *//g;
  121. if( length( $retvalue) > 0) {
  122. last LINEG;
  123. }
  124. } # while (there is still data in this inputfile)
  125. close( INFFILE);
  126. return $retvalue;
  127. }
  128. sub insku{
  129. local($testsku) = @_;
  130. $count = 0;
  131. while ($count < $listlength) {
  132. #printf( "%s %s\n", $testsku, $skulist[$count]);
  133. if ($testsku =~ /^$skulist[$count]$/ ) {
  134. return $count+1;
  135. }
  136. $count = $count+1;
  137. }
  138. return 0;
  139. }
  140. sub myprocess {
  141. local($inputfile) = @_;
  142. open(OLD, "<" . $inputfile) or die "can't open inputfile: $!";
  143. open(NEW, ">" . $inputfile."dat") or die "can't open outputfile: $!";
  144. # $count = 0;
  145. #while( <@skulist>) {
  146. #$count = $count+1;
  147. #printf( "count %d, %s\n", $count, $_);
  148. #}
  149. #$listlength = $count;
  150. $count = 0;
  151. while( $count < $listlength) {
  152. $skulist[$count] = lc $skulist[$count];
  153. printf( "count %d, %s\n", $count, $skulist[$count]);
  154. $count = $count+1;
  155. }
  156. printf( "length = %d\n", $listlength);
  157. LINE1: while( <OLD> ) {
  158. chomp $_;
  159. $line = lc $_;
  160. if ($line =~ /^\[/)
  161. {
  162. (printf NEW $line."\n");
  163. next LINE1;
  164. }
  165. @linefields = split('=', $line);
  166. # empty line
  167. if ( $#linefields == -1) {
  168. next LINE1;
  169. }
  170. $sku = $linefields[0];
  171. $error = $linefields[1];
  172. $result = $linefields[2];
  173. $count = insku( $sku);
  174. if ($count) {
  175. #(printf "%s %s=%s,%s", $sku, $replist[$count-1], $error, $result."\n");
  176. (printf NEW "%s=%s,%s\n", $replist[$count-1], $error, $result);
  177. }
  178. else {
  179. (printf "* %s=%s,%s", $sku, $error, $result."\n");
  180. (printf NEW "* %s=%s,%s\n", $sku, $error, $result);
  181. }
  182. } # while (there is still data in this inputfile)
  183. close(OLD);
  184. close(NEW);
  185. }
  186. foreach $share (@ARGV) {
  187. #print "arg is $file\n";
  188. #@filelist = <$file>;
  189. #@filelist = `dir /b /a-d $file`;
  190. foreach (@ARGV) {
  191. chomp $share;
  192. myprocess( $share);
  193. }
  194. exit($ErrorCode);
  195. }