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.

175 lines
6.0 KiB

  1. @echo off
  2. REM Installs new build of NTFRS.
  3. REM stops the service, renames the current files to old, copy new files into place, start the service.
  4. REM
  5. if "%1"=="BUILD" goto NEWBUILD
  6. if "%1"=="build" goto NEWBUILD
  7. if "%1"=="PRIVATE" goto NEWPRIVATE
  8. if "%1"=="private" goto NEWPRIVATE
  9. if "%1"=="CLEANSYSVOL" goto CLEANSYSVOL
  10. if "%1"=="cleansysvol" goto CLEANSYSVOL
  11. if "%1"=="CLEANDB" goto CLEANDB
  12. if "%1"=="cleandb" goto CLEANDB
  13. goto HELP
  14. :CLEANSYSVOL
  15. echo Stopping FRS and deleting sysvol directory trees, staging areas and FRS Database.
  16. net stop ntfrs
  17. pushd .
  18. rem delete the sysvol directory trees, leaving the root dirs.
  19. cd /d %windir%\sysvol\domain
  20. del /s /f /q *.*
  21. del /s /f /q /A:H *.*
  22. cd /d %windir%\sysvol\enterprise
  23. del /s /f /q *.*
  24. del /s /f /q /A:H *.*
  25. rem delete the ntfrs database and delete old logs.
  26. cd /d %windir%
  27. rd /s /q ntfrs
  28. del debug\*ntfrs*
  29. echo Done. FRS was left stopped in preparation for upgrade.
  30. popd
  31. goto QUIT
  32. :CLEANDB
  33. echo Stopping FRS and deleting FRS Database.
  34. net stop ntfrs
  35. pushd .
  36. cd /d %windir%
  37. rem delete the ntfrs database and delete old logs.
  38. rd /s /q ntfrs
  39. del debug\*ntfrs*
  40. echo Done. FRS was left stopped in preparation for upgrade.
  41. popd
  42. goto QUIT
  43. :NEWPRIVATE
  44. set DOCLEANUP=REM
  45. set SRCDIR=%PROCESSOR_ARCHITECTURE%
  46. if NOT "%2"=="" set SRCDIR=%PROCESSOR_ARCHITECTURE%\%2
  47. set SRC=\\davidor2\ntfrs\%SRCDIR%
  48. echo Looking for private build of ntfrs on %SRC%
  49. if EXIST %SRC%\ntfrs.exe goto INSTALL
  50. set SRC=\\mastiff\scratch\ntfrs\%SRCDIR%
  51. echo Looking for private build of ntfrs on %SRC%
  52. if EXIST %SRC%\ntfrs.exe goto INSTALL
  53. set SRC=\\scratch\scratch\ntfrs\%SRCDIR%
  54. echo Looking for private build of ntfrs on %SRC%
  55. if EXIST %SRC%\ntfrs.exe goto INSTALL
  56. echo Cannot access share with NTFRS\%SRCDIR% private.
  57. goto QUIT
  58. :INSTALL
  59. pushd .
  60. echo Stopping NTFRS service.
  61. net stop ntfrs >NUL: 2>NUL:
  62. cd /d %windir%\system32
  63. rename ntfrs.exe ntfrs.exe_old >NUL: 2>NUL:
  64. rename ntfrsapi.dll ntfrsapi.dll_old >NUL: 2>NUL:
  65. rename ntfrsupg.exe ntfrsupg.exe_old >NUL: 2>NUL:
  66. rename ntfrsutl.exe ntfrsutl.exe_old >NUL: 2>NUL:
  67. rename netevent.dll netevent.dll_old >NUL: 2>NUL:
  68. rename ntfrsres.dll ntfrsres.dll_old >NUL: 2>NUL:
  69. cd /d %windir%\symbols\exe
  70. rename ntfrs.dbg ntfrs.dbg_old >NUL: 2>NUL:
  71. rename ntfrs.pdb ntfrs.pdb_old >NUL: 2>NUL:
  72. cd /d ..\dll
  73. rename ntfrsapi.pdb ntfrsapi.pdb_old >NUL: 2>NUL:
  74. popd
  75. copy /y %SRC%\ntfrs.exe %windir%\system32 >NUL: 2>NUL:
  76. copy /y %SRC%\ntfrsapi.dll %windir%\system32 >NUL: 2>NUL:
  77. copy /y %SRC%\netevent.dll %windir%\system32 >NUL: 2>NUL:
  78. copy /y %SRC%\ntfrsres.dll %windir%\system32 >NUL: 2>NUL:
  79. copy /y %SRC%\ntfrsupg.exe %windir%\system32 >NUL: 2>NUL:
  80. copy /y %SRC%\ntfrsutl.exe %windir%\system32 >NUL: 2>NUL:
  81. copy /y %SRC%\ntfrsprf.dll %windir%\system32 >NUL: 2>NUL:
  82. copy /y %SRC%\ntfrsrep.ini %windir%\system32 >NUL: 2>NUL:
  83. copy /y %SRC%\ntfrsrep.h %windir%\system32 >NUL: 2>NUL:
  84. copy /y %SRC%\ntfrscon.ini %windir%\system32 >NUL: 2>NUL:
  85. copy /y %SRC%\ntfrscon.h %windir%\system32 >NUL: 2>NUL:
  86. if NOT EXIST %windir%\symbols\exe md %windir%\symbols\exe
  87. copy /y %SRC%\ntfrsapi.pdb %windir%\symbols\dll >NUL: 2>NUL:
  88. copy /y %SRC%\ntfrs.pdb %windir%\symbols\exe >NUL: 2>NUL:
  89. echo Starting NTFRS service.
  90. net start ntfrs >NUL: 2>NUL:
  91. %DOCLEANUP% >NUL: 2>NUL:
  92. set newfrslog=\\davidor2\ntfrs\newfrs.log
  93. if EXIST %newfrslog% goto LOGIT
  94. set newfrslog=\\mastiff\scratch\ntfrs\newfrs.log
  95. if EXIST %newfrslog% goto LOGIT
  96. echo New NTFRS installed.
  97. goto QUIT
  98. :LOGIT
  99. echo newfrs %1 %2 %3 installed on %COMPUTERNAME% [%PROCESSOR_ARCHITECTURE%-%NUMBER_OF_PROCESSORS%P] by %USERDOMAIN%\%USERNAME% on %DATE%, %TIME% >> %newfrslog%
  100. dir %windir%\system32\ntfrs.exe | findstr ntfrs.exe >> %newfrslog%
  101. goto QUIT
  102. REM BUILD <lab> <date>
  103. REM lab date
  104. REM \\winbuilds\release\lab01\release\x86fre\2400.x86fre.Lab01_N.001022-2228
  105. REM
  106. :NEWBUILD
  107. echo on
  108. if "%2"=="" goto HELP
  109. if "%3"=="" goto HELP
  110. for /D %%x in ("\\winbuilds\release\%2\release\%PROCESSOR_ARCHITECTURE%fre\*%3*") do set SRC=%%x
  111. echo Looking for %2 %3 released build of ntfrs on %SRC%
  112. if NOT EXIST !SRC!\ntfrs.exe goto QUIT
  113. copy !SRC!\ntfrs.exe %temp%\ntfrs.exe >NUL: 2>NUL:
  114. copy !SRC!\ntfrsapi.dll %temp%\ntfrsapi.dll >NUL: 2>NUL:
  115. copy !SRC!\netevent.dll %temp%\netevent.dll >NUL: 2>NUL:
  116. copy !SRC!\ntfrsres.dll %temp%\ntfrsres.dll >NUL: 2>NUL:
  117. copy !SRC!\ntfrsupg.exe %temp%\ntfrsupg.exe >NUL: 2>NUL:
  118. copy !SRC!\ntfrsprf.dll %temp%\ntfrsprf.dll >NUL: 2>NUL:
  119. copy !SRC!\ntfrsrep.ini %temp%\ntfrsrep.ini >NUL: 2>NUL:
  120. copy !SRC!\ntfrsrep.h %temp%\ntfrsrep.h >NUL: 2>NUL:
  121. copy !SRC!\ntfrscon.ini %temp%\ntfrscon.ini >NUL: 2>NUL:
  122. copy !SRC!\ntfrscon.h %temp%\ntfrscon.h >NUL: 2>NUL:
  123. copy !SRC!\idw\ntfrsutl.exe %temp% >NUL: 2>NUL:
  124. copy !SRC!\symbols\retail\exe\ntfrs.* %temp% >NUL: 2>NUL:
  125. copy !SRC!\symbols\retail\dll\ntfrsapi.* %temp% >NUL: 2>NUL:
  126. set SRC=%TEMP%
  127. set DOCLEANUP=del %temp%\ntfrs*.* %temp%\netevent.dll
  128. goto INSTALL
  129. :HELP
  130. echo "newfrs [private [buildnum] | build labnn build_date | cleandb | cleansysvol]"
  131. echo Cmds to stop the service, renames the current files to old, copy new files into place, restarts service.
  132. echo newfrs private // installs the current default private NTFRS binaries on your system.
  133. echo newfrs private 1848 // installs the private NTFRS binaries built for 1848 on your system.
  134. echo newfrs build lab01 001016 // installs NTFRS binaries from lab01 built on Oct 10, 2000.
  135. echo Cmds to delete database and or sysvol file tree
  136. echo newfrs cleandb // Stops service and deletes database
  137. echo newfrs cleansysvol // Stops service, deletes database, deletes enterprise and domain sysvol file trees.
  138. :QUIT