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.

303 lines
8.0 KiB

  1. @echo off
  2. REM init
  3. set xe_err=
  4. set xe_dll=
  5. set xe_pdb=
  6. set xe_os_str=
  7. set xe_req_id=
  8. set xe_prs_uns_path=
  9. set xe_prs_s_path=
  10. set xe_platform=
  11. set xe_target=scrdenrl
  12. set xe_prs_web=http://prslab/cs2001/createjob.asp
  13. set xe_prs_uns_prefix=\\prslab\unsigned2
  14. REM set xe_prs_uns_prefix=c:\t-unsign
  15. set xe_prs_s_prefix=\\prslab\signed2
  16. REM set xe_prs_s_prefix=c:\t-sign
  17. set xe_os_str=32-bit Windows
  18. REM wait 1 minutes
  19. set xe_wait=60
  20. REM make sure no PRS release location change
  21. if not exist %xe_prs_uns_prefix% (
  22. set xe_err=%xe_prs_uns_prefix% doesn't exist. Please contact %xe_target%.dll dev owner.
  23. goto error
  24. )
  25. if not exist %xe_prs_s_prefix% (
  26. set xe_err=%xe_prs_s_prefix% doesn't exist. Please contact %xe_target%.dll dev owner.
  27. goto error
  28. )
  29. REM make sure %xe_target%.dll and %xe_target%.pdb files exist
  30. if "%1"=="" (
  31. set xe_err=%xe_target%.dll file is missed
  32. goto error
  33. )
  34. if "%2"=="" (
  35. set xe_err=%xe_target%.pdb file is missed
  36. goto error
  37. )
  38. set xe_dll_path=%1
  39. set xe_pdb_path=%2
  40. if not "%3" == "" (
  41. call :GetNextArg %3 %4 %5 %6 %7 %8 %9
  42. REM should never be here
  43. goto :EOF
  44. )
  45. :GetStarted
  46. if "%xe_platform%"=="" (
  47. if "%BUILD_DEFAULT_TARGETS%"=="-x86" (
  48. set xe_platform=i386
  49. goto init_sd
  50. )
  51. if "%BUILD_DEFAULT_TARGETS%"=="-ia64" (
  52. set xe_platform=ia64
  53. goto init_sd
  54. )
  55. REM can't determine
  56. set xe_err=can't determine the platform. please make sure you run %0 from a razzle window with a proper platform.
  57. goto error
  58. )
  59. if not "%xe_platform%"=="" (
  60. if /i "i386"=="%xe_platform%" goto init_sd
  61. if /i "ia64"=="%xe_platform%" goto init_sd
  62. REM not supported
  63. set xe_err=%xe_platform% platform is not supported.
  64. goto error
  65. )
  66. :init_sd
  67. REM determine more variables
  68. set xe_rel_path=%sdxroot%\ds\security\cryptoapi\pki\activex\release\%xe_target%
  69. set xe_dll=%xe_dll_path%\%xe_target%.dll
  70. set xe_pdb=%xe_pdb_path%\%xe_target%.pdb
  71. REM make sure current machine has DS enlistment
  72. if not exist %xe_rel_path% (
  73. set xe_err=%xe_target% release enlistment %sdxroot%\%xe_rel_path% not found on this machine. Please make sure you have run %0 from a razzle window or make sure you have DS enlistment on the machine.
  74. goto error
  75. )
  76. if not exist %xe_dll% (
  77. set xe_err=%xe_dll% doesn't exist
  78. goto error
  79. )
  80. if not exist %xe_pdb% (
  81. set xe_err=%xe_pdb% doesn't exist
  82. goto error
  83. )
  84. REM scan virus here
  85. echo.
  86. echo scanning virus...
  87. echo.
  88. REM inocucmd.exe is only local command in xenroll
  89. cd /d ..\xenroll
  90. inocucmd.exe %xe_dll%
  91. echo.
  92. echo Finished virus checking on %xe_dll%
  93. set /p xe_goon=Is virus checking OK?(y/n):
  94. if /i not "%xe_goon%"=="y" (
  95. set xe_err=VIRUS may have been detected. Please make sure your dll or symbols are OK
  96. goto error
  97. )
  98. cd /d %xe_rel_path%
  99. REM display signing instruction
  100. if /i "%xe_platform%"=="ia64" set xe_os_str=Whistler 64-bit Windows
  101. echo.
  102. echo You have to sign %xe_target%.dll by going to %xe_prs_web%
  103. echo Here is the steps:
  104. echo.
  105. echo 1. Click [Create Request] button
  106. echo.
  107. echo 2. Fill in or select the following:
  108. echo.
  109. echo Job Description: %xe_target%.dll signing for %xe_platform%
  110. echo Certificate Type: Microsoft External Code Distribution
  111. echo Virus Checker: Cheyenne (Innoculan)
  112. echo Virus Checker Eng Ver: 4.0
  113. echo Macro Virus Check?: Yes
  114. echo Encryption: Not High Crypto
  115. echo Operating System: %xe_os_str%
  116. echo Product Version: Whistler
  117. echo Language: English
  118. echo.
  119. echo 2. Provide at least two MS employee email aliases who can
  120. echo sign off the request
  121. echo.
  122. echo 3. Please select TRUE for Year 2000 Compliant question
  123. echo.
  124. echo 4. You may consider to enter %xe_dll%
  125. echo in Notes to indicate where you get your %xe_target%.dll
  126. echo.
  127. echo 5. Click [Create Request] at the bottom of the page
  128. echo.
  129. echo 6. Look at the PRS web page for a path to %xe_prs_uns_prefix%\^<userid#####^>
  130. echo.
  131. echo It is about to invoke IE at %xe_prs_web%
  132. pause
  133. start %xe_prs_web%
  134. :enter_userid
  135. echo.
  136. set /p xe_req_id= 7. After step 6, enter PRS job ^<userid#####^>:
  137. if "%xe_req_id%"=="" (
  138. set xe_err=^<userid#####^> cannot be empty
  139. goto error
  140. )
  141. set xe_prs_uns_path=%xe_prs_uns_prefix%\%xe_req_id%
  142. if not exist %xe_prs_uns_path% (
  143. echo.
  144. echo Error: %xe_prs_uns_path% not found
  145. echo Make sure you entered the correct ^<userid#####^> above.
  146. echo For example, xtan62520.
  147. set xe_req_id=
  148. echo.
  149. goto enter_userid
  150. )
  151. REM get unsigned share
  152. set xe_prs_s_path=%xe_prs_s_prefix%\%xe_req_id%
  153. REM make sure creat empty list.txt file
  154. if exist %xe_prs_uns_path%\list.txt del /f /q %xe_prs_uns_path%\list.txt
  155. REM have to set > to a variable
  156. echo.
  157. echo copying your unsigned %xe_dll% files
  158. echo to %xe_prs_uns_path%\%xe_target%.dll...
  159. copy /v /y %xe_dll% %xe_prs_uns_path%\%xe_target%.dll
  160. REM generate list.txt file for signing
  161. echo %xe_target%.dll,Microsoft Smart Card Enrollment Control,http://www.microsoft.com >>%xe_prs_uns_path%\list.txt
  162. echo.
  163. echo 8. Click [Generate File List] button
  164. echo Verify that your files show up.
  165. echo.
  166. echo 9. Click [Activate] button at the top of the page
  167. echo Make sure your submission is accepted. You should see the following:
  168. echo "Your Code Signing Request is now available for sign-off by..."
  169. echo.
  170. echo 10. Sign off on your request
  171. echo Note: sometimes PRSLAB can fail to notify the persons you entered for
  172. echo the request sign-off. You may consider to notify them by yourself.
  173. echo.
  174. echo 11. Hit any key to begin waiting for the files to be signed.
  175. echo.
  176. pause
  177. REM wait in a loop to check if each signed dll appears
  178. :wait_signing
  179. echo.
  180. echo waiting in increments of %xe_wait% seconds for %xe_target%.dll
  181. echo to be signed in %xe_prs_s_path%
  182. if not exist %xe_prs_s_path%\%xe_target%.dll (
  183. sleep %xe_wait%
  184. goto wait_signing
  185. )
  186. echo %xe_target%.dll has been signed and released at %xe_prs_s_path%
  187. REM looks signing process puts un-signed dll there first,
  188. REM some seconds sleep to help getting signed dll
  189. sleep %xe_wait%
  190. echo.
  191. echo. Verify signature/timestamp on signed dll %xe_prs_s_path%\%xe_target%.dll
  192. echo.
  193. chktrust.exe -q -tswarn %xe_prs_s_path%\%xe_target%.dll
  194. echo.
  195. echo please make sure chktrust test is passed.
  196. pause
  197. echo.
  198. echo. check out %xe_target%.dll and %xe_target%.pdb files
  199. sd edit %xe_rel_path%\%xe_platform%\%xe_target%.dll
  200. sd edit %xe_rel_path%\%xe_platform%\%xe_target%.pdb
  201. echo.
  202. echo. copying %xe_prs_s_path%\%xe_target%.dll .\%xe_platform%\%xe_target%.dll
  203. echo.
  204. copy /y %xe_prs_s_path%\%xe_target%.dll %xe_rel_path%\%xe_platform%\%xe_target%.dll
  205. copy /y %xe_pdb% %xe_rel_path%\%xe_platform%\%xe_target%.pdb
  206. echo.
  207. echo Please check in the following files as guided by your VBL
  208. echo.
  209. echo %xe_rel_path%\%xe_platform%\%xe_target%.dll
  210. echo %xe_rel_path%\%xe_platform%\%xe_target%.pdb
  211. :cleanup
  212. REM clean up temp files
  213. cd /d %xe_rel_path%
  214. set xe_err=
  215. set xe_platform=
  216. set xe_os_str=
  217. set xe_target=
  218. set xe_prs_path=
  219. set xe_prs_s_path=
  220. set xe_prs_s_prefix=
  221. set xe_prs_uns_path=
  222. set xe_prs_uns_prefix=
  223. set xe_prs_web=
  224. set xe_rel_path=
  225. set xe_req_id=
  226. set xe_uns_path_prfx=
  227. set xe_wait=
  228. set xe_dll=
  229. set xe_pdb=
  230. set xe_dll_path=
  231. set xe_pdb_path=
  232. set xe_goon=
  233. goto end
  234. :error
  235. echo.
  236. if not "%xe_err%"=="" echo Error: %xe_err%
  237. :usage
  238. echo.
  239. echo Usage:
  240. echo.
  241. echo %0 DLLPath PDBPath [Options]
  242. echo.
  243. echo Options:
  244. echo -p Platform either i386 or ia64,
  245. echo the default is the same as the current machine
  246. echo.
  247. goto cleanup
  248. :end
  249. echo.
  250. echo Done
  251. goto :EOF
  252. :GetNextArg
  253. if "%1" == "help" goto usage
  254. if "%1" == "-?" goto usage
  255. if "%1" == "/?" goto usage
  256. if "%1" == "-help" goto usage
  257. if "%1" == "/help?" goto usage
  258. if /I "%1" == "-p" (
  259. if "%2" == "" (
  260. set xe_err = missing platform define after %1
  261. goto error
  262. )
  263. set xe_platform=%2
  264. shift
  265. shift
  266. goto ArgOK
  267. )
  268. if NOT "%1" == "" (
  269. set xe_err = Unknown argument: %1
  270. goto usage
  271. )
  272. if "%1" == "" goto :GetStarted
  273. :ArgOK
  274. goto :GetNextArg