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.

190 lines
5.5 KiB

  1. @echo off
  2. setlocal ENABLEEXTENSIONS
  3. setlocal ENABLEDELAYEDEXPANSION
  4. if DEFINED _echo echo on
  5. if DEFINED verbose echo on
  6. REM testing
  7. REM ------------------------------------------------
  8. REM Get command-line options
  9. REM ------------------------------------------------
  10. set quiet_mode=
  11. if /I "%1" == "/q" set quiet_mode=1
  12. if /I "%1" == "-q" set quiet_mode=1
  13. if "%quiet_mode%" == "1" shift
  14. set Version=5.2
  15. if /I "%1" == "/5.0" set Version=5.0
  16. if /I "%1" == "-5.0" set Version=5.0
  17. if /I "%1" == "/5.1" set Version=5.1
  18. if /I "%1" == "-5.1" set Version=5.1
  19. if NOT "%Version%" == "5.2" shift
  20. set UpdateFile=
  21. if /I "%1" == "/f" set UpdateFile=%2
  22. if /I "%1" == "-f" set UpdateFile=%2
  23. if defined UpdateFile shift
  24. if defined UpdateFile shift
  25. for %%a in (./ .- .) do if ".%1." == "%%a?." goto Usage
  26. if "%1" == "" goto Usage
  27. if "%_NTBINDIR%"=="" echo please set "_NTBINDIR" = to your nt drive, e.g. _NTBINDIR=d:\nt&goto usage
  28. REM ------------------------------------------------
  29. REM Set environment variables, make temp directories,
  30. REM delete stale files
  31. REM ------------------------------------------------
  32. set infflag=
  33. set mydir=%1
  34. set workdir=
  35. for /l %%a in (1,1,100) do (
  36. mkdir %temp%\deltacat.%%a
  37. if not errorlevel 1 (
  38. set workdir=%temp%\deltacat.%%a
  39. goto haveworkdir
  40. )
  41. )
  42. echo unable to find a working directory
  43. goto end
  44. :haveworkdir
  45. set cdf=%workdir%\cdf
  46. set log=%workdir%\log
  47. if NOT exist %cdf% md %cdf%
  48. if NOT exist %log% md %log%
  49. if exist %cdf%\delta.cdf del %cdf%\delta.cdf
  50. if exist %cdf%\delta.log del %log%\delta.log
  51. pushd %mydir%
  52. if exist delta.cat del delta.cat
  53. if exist layout.inf set infflag=1
  54. if exist syssetup.inf set infflag=1
  55. if "%quiet_mode%" == "1" goto skiphelp
  56. if "%infflag%"=="1" call :nt5inf
  57. :skiphelp
  58. REM ------------------------------------------------
  59. REM Prepare a cdf file
  60. REM ------------------------------------------------
  61. echo Creating the delta.cdf ...
  62. REM Put the header on and output it as a CDF
  63. echo ^[CatalogHeader^]> %cdf%\delta.CDF
  64. echo Name=delta>> %cdf%\delta.CDF
  65. echo PublicVersion=0x0000001>> %cdf%\delta.CDF
  66. echo EncodingType=0x00010001>> %cdf%\delta.CDF
  67. echo CATATTR1=0x10010001:OSAttr:2:!Version!>> %cdf%\delta.CDF
  68. REM Get extra attributes from UpdateFile if necessary
  69. if defined UpdateFile (
  70. for /f "tokens=1,2 delims=," %%a in (%UpdateFile%) do (
  71. echo CATATTR%%b=0x10010001:%%a>>%cdf%\delta.CDF
  72. )
  73. )
  74. echo ^[CatalogFiles^]>> %cdf%\delta.CDF
  75. for /f %%a in ('dir /a-d /b %mydir%') do (
  76. if NOT "%%a"=="" echo ^<hash^>%mydir%\%%a=%mydir%\%%a>>%cdf%\delta.cdf)
  77. REM ------------------------------------------------
  78. REM Make the catalog and test sign it
  79. REM ------------------------------------------------
  80. echo Making the delta.cat ...
  81. REM popd and pushd just in case some sneaky dlls are hanging around in
  82. REM the user passed %mydir%
  83. popd
  84. makecat -v %cdf%\delta.cdf > %log%\delta.log
  85. copy delta.cat %mydir%
  86. copy %cdf%\delta.cdf %mydir%
  87. pushd %SDXROOT%
  88. echo Signing delta.cat ...
  89. signtool sign %SIGNTOOL_SIGN% "%mydir%\delta.CAT"
  90. echo Done.
  91. popd
  92. rd /s/q %workdir%
  93. goto end
  94. :nt5inf
  95. echo IF you have either layout.inf or syssetup.inf
  96. echo in your signing directory. Deltacat will not
  97. echo sign these files which must be signed in nt5inf.cat.
  98. echo.
  99. echo Let deltacat run then do the following:
  100. echo 1. Copy nt5inf.ca_ to your signing directory
  101. echo from wherever your are installing, e.g.
  102. echo \\ntbuilds\release\usa\latest.tst\x86\fre.wks,
  103. echo or, e.g. e:\i386.
  104. echo 2. Make sure you have the most recent updcat.exe
  105. echo in your %windir%\idw directory
  106. echo 3. Run infsign.cmd
  107. echo 4. Then run winnt32 with /m:signing directory
  108. echo.
  109. echo These instructions are also in the help for
  110. echo deltacat.cmd and infsign.cmd
  111. echo.
  112. pause
  113. goto :eof
  114. REM ------------------------------------------------
  115. REM Display Usage:
  116. REM ------------------------------------------------
  117. :usage
  118. echo Deltacat.cmd [q] [5.0] [/f text file with extra catalog attributes] ^<path to bins^>
  119. echo.
  120. echo [/q] [-q] Quiet mode
  121. echo [/5.0] [-5.0] Nt 5 version - NT 5.2 is default
  122. echo [/5.1] [-5.1] Nt 5.1 version - NT 5.2 is default
  123. echo ^<path to bins^> FULL PATH to bins. Do not run in bins directory.
  124. echo.
  125. echo.
  126. echo Creates a catalog file, "delta.cat" for files in the directory
  127. echo passed as input. For example: If you have ntoskrnl.exe and pci.sys
  128. echo in a directory "d:\BINARIES," running "deltacat d:\BINARIES"
  129. echo will create a delta.cat and place it in the d:\BINARIES directory.
  130. echo.
  131. echo Then to setup test your binaries use the /m switch with winnt32
  132. echo get your binaries and catalog file from d:\BINARIES. For example,
  133. echo run \\ntubilds\release\usa\latest.tst\x86\fre.wks\winnt32
  134. echo \winnt32.exe /m:d:\BINARIES.
  135. echo.
  136. echo IF you have either LAYOUT.INF or SYSSETUP.INF
  137. echo in your signing directory. Deltacat will not
  138. echo sign these files which must be signed in nt5inf.cat.
  139. echo.
  140. echo Let deltacat run then do the following:
  141. echo 1. Copy nt5inf.ca_ to your signing directory
  142. echo from wherever your are installing, e.g.
  143. echo \\ntbuilds\release\usa\latest.tst\x86\fre.wks,
  144. echo or, e.g. e:\i386.
  145. echo 2. Make sure you have the most recent updcat.exe
  146. echo in your %windir%\idw directory
  147. echo 3. Run infsign.cmd
  148. echo 4. Then run winnt32 with /m:signing directory
  149. echo.
  150. :end
  151. @ENDLOCAL