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.

104 lines
2.5 KiB

  1. $Dollar= '$';
  2. SetVersion();
  3. sub SetVersion
  4. {
  5. $File="\\\\iasbuild\\IIS5Temp$Dollar\\latest.bat";
  6. open(latest,$File) || die "Can't open $!";
  7. while (<latest>)
  8. {
  9. if (/\s*set\s*VERSION\s*=\s*(\S+)/)
  10. {
  11. $VER_NUM=$1;
  12. print "Previous VERSION=$VER_NUM\n";
  13. }
  14. }
  15. $VER_NUM=$VER_NUM+1;
  16. $VER_NUM="0$VER_NUM";
  17. print "Updated VERSION=$VER_NUM\n";
  18. close(latest);
  19. open(latest,">$File") || die "Can't open $!";
  20. print(latest "set VERSION=$VER_NUM\n");
  21. close(latest);
  22. #------------------------------------------------------------------
  23. # Replace versions in IISVER.h
  24. #------------------------------------------------------------------
  25. Replace (".\\inc\\IISVER.h",
  26. ".\\inc\\IISVER.h",
  27. "#define VER_IISPRODUCTVERSION_STR .*",
  28. "#define VER_IISPRODUCTVERSION_STR \"5.00.$VER_NUM\"");
  29. Replace (".\\inc\\IISVER.h",
  30. ".\\inc\\IISVER.h",
  31. "#define VER_PRODUCTBUILD .*",
  32. "#define VER_PRODUCTBUILD $VER_NUM");
  33. #------------------------------------------------------------------
  34. # Replace versions in _NTVERP.h
  35. #------------------------------------------------------------------
  36. Replace (".\\inc\\_NTVERP.h",
  37. ".\\inc\\_NTVERP.h",
  38. "#define VER_PRODUCTVERSION_STR \"5.00.*",
  39. "#define VER_PRODUCTVERSION_STR \"5.00.$VER_NUM\"");
  40. Replace (".\\inc\\_NTVERP.h",
  41. ".\\inc\\_NTVERP.h",
  42. "#define VER_PRODUCTBUILD /.? NT .?/ .*",
  43. "#define VER_PRODUCTBUILD /* NT */ $VER_NUM");
  44. }
  45. #------------------------------------------------------------------
  46. # Replace: Create a new file, replacing pattern with value
  47. #
  48. # Parameters:
  49. # Input file name
  50. # Output file name
  51. # Input pattern (implicitly surrounded by .*)
  52. # Value to replace pattern with
  53. #------------------------------------------------------------------
  54. sub Replace
  55. {
  56. $FileName = $_[0];
  57. $OutFile = $_[1];
  58. $Pattern = $_[2];
  59. $Value = $_[3];
  60. if ($Filename eq $Outfile)
  61. {
  62. $IsTemp = 1;
  63. $OutFile = "RepTemp.xxx";
  64. }
  65. open(fhandle, "$FileName") || die "Can't open $FileName\n";
  66. open(ohandle, ">$OutFile") || die "Can't open $OutFile for writing\n";
  67. while (<fhandle>)
  68. {
  69. if (/(.*)($Pattern)(.*)/)
  70. {
  71. print ohandle $1.$Value.$3."\n";
  72. } else
  73. {
  74. print ohandle $_;
  75. }
  76. }
  77. close(fhandle);
  78. close(ohandle);
  79. if ($IsTemp eq 1)
  80. {
  81. system("erase $FileName") == 0 || die "Erase $FileName failed!\n";
  82. system("move $OutFile $FileName > nul: 2>&1") == 0 || die "MOVE $FileName failed!\n" ;
  83. }
  84. }