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.

2016 lines
60 KiB

  1. @echo off
  2. if defined _echo echo on
  3. if defined verbose echo on
  4. setlocal ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
  5. REM -------------------------------------------------------------------------------------------
  6. REM Template for the postbuild scripts:
  7. REM SD Location: %sdxroot%\tools\postbuildscripts
  8. REM
  9. REM (1) Code section description:
  10. REM PreMain - Developer adaptable code. Use this model and add your script params
  11. REM Main - Developer code section. This is where your work gets done.
  12. REM PostMain - Logging support code. No changes should be made here.
  13. REM
  14. REM (2) GetParams.pm - Usage
  15. REM run perl.exe GetParams.pm /? for complete usage
  16. REM
  17. REM (3) Reserved Variables -
  18. REM lang - The specified language. Defaults to USA.
  19. REM logfile - The path and filename of the logs file.
  20. REM logfile_bak - The path and filename of the logfile.
  21. REM errfile - The path and filename of the error file.
  22. REM tmpfile - The path and filename of the temp file.
  23. REM errors - The scripts errorlevel.
  24. REM script_name - The script name.
  25. REM script_args - The arguments passed to the script.
  26. REM CMD_LINE - The script name plus arguments passed to the script.
  27. REM _NTPostBld - Abstracts the language from the files path that
  28. REM postbuild operates on.
  29. REM
  30. REM (4) Reserved Subs -
  31. REM Usage - Use this sub to discribe the scripts usage.
  32. REM ValidateParams - Use this sub to verify the parameters passed to the script.
  33. REM
  34. REM
  35. REM (8) Do not turn echo off, copy the 3 lines from the beginning of the template
  36. REM instead.
  37. REM
  38. REM (9) Use setlocal/endlocal as in this template.
  39. REM
  40. REM (10)Have your changes reviewed by a member of the US build team (ntbusa) and
  41. REM by a member of the international build team (ntbintl).
  42. REM
  43. REM -------------------------------------------------------------------------------------------
  44. REM PreMainPreMainPreMainPreMainPreMainPreMainPreMainPreMainPreMainPreMainPreMain
  45. REM Begin PreProcessing Section - Adapt this section but do not remove support
  46. REM scripts or reorder section.
  47. REM PreMainPreMainPreMainPreMainPreMainPreMainPreMainPreMainPreMainPreMainPreMain
  48. :PreMain
  49. REM
  50. REM Define SCRIPT_NAME. Used by the logging scripts.
  51. REM Define CMD_LINE. Used by the logging scripts.
  52. REM Define SCRIPT_ARGS. Used by the logging scripts.
  53. REM
  54. for %%i in (%0) do set SCRIPT_NAME=%%~ni.cmd
  55. set CMD_LINE=%script_name% %*
  56. set SCRIPT_ARGS=%*
  57. REM
  58. REM Parse the command line arguments - Add your scripts command line arguments
  59. REM as indicated by brackets.
  60. REM For complete usage run: perl.exe GetParams.pm /?
  61. REM
  62. for %%h in (./ .- .) do if ".%SCRIPT_ARGS%." == "%%h?." goto Usage
  63. REM call :GetParams -n <add required prams> -o l:<add optional params> -p "lang <add variable names>" %SCRIPT_ARGS%
  64. call :GetParams -o l:c -p "lang cleanbuild" %SCRIPT_ARGS%
  65. if errorlevel 1 goto :End
  66. REM
  67. REM Set up the local enviroment extensions.
  68. REM
  69. call :LocalEnvEx -i
  70. if errorlevel 1 goto :End
  71. REM
  72. REM Validate the command line parameters.
  73. REM
  74. call :ValidateParams
  75. if errorlevel 1 goto :End
  76. REM
  77. REM Execute Main
  78. REM
  79. call :Main
  80. :End_PreMain
  81. goto PostMain
  82. REM /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  83. REM Begin Main code section
  84. REM /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  85. REM (5) Call other executables or command scripts by using:
  86. REM call ExecuteCmd.cmd "<command>"
  87. REM Check for errors by using:
  88. REM if errorlevel 1 ...
  89. REM Note that the executable/script you're calling with ExecuteCmd must return a
  90. REM non-zero value on errors to make the error checking mechanism work.
  91. REM
  92. REM Example
  93. REM call ExecuteCmd.cmd "xcopy /f foo1 foo2"
  94. REM if errorlevel 1 (
  95. REM set errors=%errorlevel%
  96. REM goto end
  97. REM )
  98. REM
  99. REM (6) Log non-error information by using:
  100. REM call logmsg.cmd "<log message>"
  101. REM and log error information by using:
  102. REM call errmsg.cmd "<error message>"
  103. REM
  104. REM (7) Exit from the option routines with
  105. REM set errors=%errorlevel%
  106. REM goto end
  107. REM if errors found during execution and with
  108. REM goto end
  109. REM otherwise.
  110. :Main
  111. REM Main code section
  112. REM <Start your script's code here>
  113. REM
  114. REM Only official build machines need to run this script
  115. REM
  116. set langroot=%_NTPostBld%\symbolcd\%lang%
  117. set symbolcd.txt=%_NTPostBld%\symbolcd\%lang%\symbolcd.txt
  118. set ml=perl %RazzleToolPath%\makelist.pl
  119. if not defined OFFICIAL_BUILD_MACHINE (
  120. if /i not "!__BUILDMACHINE__!" == "LB6RI" (
  121. call logmsg.cmd "OFFICIAL_BUILD_MACHINE is not defined ... script is exiting"
  122. goto end
  123. )
  124. )
  125. if /i "!Comp!" == "No" (
  126. call logmsg.cmd "Compression disabled ... script is exiting"
  127. goto end
  128. )
  129. if /i "%lang%" == "psu" (
  130. call logmsg.cmd "PSEUDOLOC build ... script is exiting"
  131. goto end
  132. )
  133. if /i "%lang%" == "mir" (
  134. call logmsg.cmd "Mirrored build ... script is exiting"
  135. goto end
  136. )
  137. if /i "%lang%" NEQ "usa" goto SymLists
  138. REM Fix the localized eula for international builds
  139. REM If dbg_x86.msi and/or dbg_ia64.msi is not a retail build, then we
  140. REM don't localize the eula. Sometimes this will be commented out.
  141. set MyPath=%_NTPostBld%\symbolcd\cd\tools
  142. set X86Eula=%_NTPostBld%\symbolcd\dbgeula\retail\eula.rtf
  143. set IA64Eula=%_NTPostBld%\symbolcd\dbgeula\beta\eula.rtf
  144. if /i "%lang%" NEQ "usa" (
  145. REM call dbgeula -m %MyPath%\dbg_x86.msi -e %X86Eula% -b %lang%
  146. REM call dbgeula -m %MyPath%\dbg_ia64.msi -e %IA64Eula% -b %lang%
  147. )
  148. REM
  149. REM Munge the public symbol files. We put selected type info in some of the public
  150. REM pdb files so that retail customers can run more debugger commands.
  151. REM
  152. call :MungePublics
  153. if defined ThereWereErrors goto End_Main
  154. REM
  155. REM Coverage builds do not have stripped public symbols
  156. REM so don't check if they are stripped when building the symbolCD
  157. REM
  158. set PUB_SYM_FLAG=/p
  159. if defined _COVERAGE_BUILD (
  160. call logmsg.cmd "Coverage build ... turning off public symbol checking"
  161. set PUB_SYM_FLAG=
  162. )
  163. REM
  164. REM Symbolcd.cmd keeps breaking due to coverage changes
  165. REM and I don't catch them in time because I never build as offical build machine
  166. REM so lets pretend if this test flag is set
  167. REM
  168. if defined _COVERAGE_BUILD_TEST (
  169. call logmsg.cmd "Coverage build test ... treating as offical build machine"
  170. set RunAlways=1
  171. )
  172. :Symbad
  173. REM Skip this for now
  174. goto EndSymbad
  175. REM ********************************************************************
  176. REM Owner: Barb Kess
  177. REM
  178. REM This script finds out which files in symbad.txt are either not found
  179. REM or pass symbol checking.
  180. REM
  181. REM It creates a new symbad.txt based on this build machine.
  182. REM To check in a new symbad.txt, take the union of symbad.txt.new on all
  183. REM build machines.
  184. REM
  185. REM ********************************************************************
  186. set SymDir=%_NTPostBld%\symbad
  187. set NewSymbad=%SymDir%\symbad.txt.new
  188. set SymchkLog=%SymDir%\symchk.log
  189. if EXIST %NewSymbad% goto EndSymbad
  190. if EXIST %SymDir% rd /s /q %SymDir%
  191. md %SymDir%
  192. REM Find out which files pass
  193. for /f "tokens=1* delims= ; " %%a in (%RazzleToolPath%\symbad.txt) do (
  194. if exist %_NTPostBld%\%%a (
  195. symchk.exe /t %PUB_SYM_FLAG% %_NTPostBld%\%%a /s %_NTPostBld%\symbols\retail>>%SymchkLog%
  196. if !ERRORLEVEL! EQU 1 (
  197. echo %%a ; %%b>>%NewSymbad%
  198. )
  199. )
  200. )
  201. REM Add the international files back in
  202. findstr /i "INTL" %RazzleToolPath%\symbad.txt>> %SymDir%\symbad.txt.new
  203. REM Add back files that error during a clean build
  204. REM This happens because they have a private placefil.txt that
  205. REM binplaces them to "retail". These are files not in the product
  206. findstr /i "clean" %RazzleToolPath%\symbad.txt>> %SymDir%\symbad.txt.new
  207. call logmsg "New symbad.txt = %SymDir%\symbad.txt.new"
  208. :EndSymbad
  209. REM *********************************************************************
  210. REM Create the lists for the symbol cabs and do symbol checking
  211. REM
  212. REM *********************************************************************
  213. :SymLists
  214. REM Now, create the symbol cabs
  215. REM Add any cab generation processing here.
  216. REM If myerrors, goto end
  217. REM ThereWereSymchkErrors is a special variable to determine if there were
  218. REM symbol checking errors. If it is "yes", then mail gets sent, but
  219. REM postbuild does not record the errors --- then BVT's will continue.
  220. set ThereWereErrors=no
  221. set ThereWereSymchkErrors=no
  222. set langroot=%_NTPostBld%\symbolcd\%lang%
  223. set SymCabName=symbols
  224. set build_bindiff=%_NTPostBld%\build_logs\bindiff.txt
  225. REM
  226. REM Decide which build we are working on
  227. REM debug vs. retail and i386 vs. amd64 vs. ia64
  228. REM
  229. set SUBDIR=
  230. if /i "%_BuildArch%" == "x86" (
  231. if /i "%lang%" == "NEC_98" (
  232. set SUBDIR=NEC98
  233. ) else (
  234. set SUBDIR=i386
  235. )
  236. )
  237. if /i "%_BuildArch%" == "amd64" (
  238. set SUBDIR=amd64
  239. )
  240. if /i "%_BuildArch%" == "ia64" (
  241. set SUBDIR=ia64
  242. )
  243. if "%SUBDIR%" == "" (
  244. call errmsg "Environment variables PROCESSOR_ARCHITECTURE is not recognized"
  245. goto end
  246. )
  247. if /i "%_BuildType%" == "chk" (
  248. set FRECHK=Debug
  249. ) else (
  250. set FRECHK=Retail
  251. )
  252. REM
  253. REM symbad.txt - don't write errors to the error log
  254. REM for files in symbad.txt
  255. REM
  256. set symbad.txt=%RazzleToolPath%\symbad.txt
  257. REM
  258. REM symlist.txt - list of all files that we should
  259. REM check symbols for
  260. REM
  261. set symlist.txt=%langroot%\symlist.txt
  262. REM symlistwithtypes.txt - list of all the files that we
  263. REM should check symbols for, but have private type info
  264. REM in the public symbols
  265. set symlistwithtypes.txt=%langroot%\symlistwithtypes.txt
  266. REM
  267. REM symbolcd.txt - list of all the files to put into
  268. REM symbol cabs. This is the result of running
  269. REM symchk on symlist.txt.
  270. REM
  271. set symbolcd.txt=%langroot%\symbolcd.txt
  272. REM
  273. REM symbolcd.tmp - used when generating the right path
  274. REM information for symbols in alternate project targets
  275. REM
  276. set symbolcd.tmp=%langroot%\symbolcd.tmp
  277. REM
  278. REM symerror.log - files that had errors when symchk
  279. REM was run on symlist.txt
  280. REM
  281. REM symerror.txt - the text file of errors that gets sent
  282. REM to a mail alias
  283. set symerror.txt=%langroot%\symerror.txt
  284. set symerror.log=%langroot%\symerror.log
  285. set symerror.winnt32.log=%langroot%\symerror.winnt32.log
  286. REM
  287. REM cabgenerr.log - error file when generating cabs
  288. REM
  289. set cabgenerr.log=%langroot%\cabgenerr.log
  290. REM
  291. REM exclude.txt - files that are not to be shipped
  292. REM
  293. set exclude.txt=%langroot%\exclude.txt
  294. REM
  295. REM symmake - program that creates the makefile and
  296. REM ddfs for cab creation
  297. REM
  298. set symmake=symmake.exe
  299. REM
  300. REM DDFDir - directory that contains the makefile and
  301. REM ddfs for cab creation
  302. REM
  303. set DDFDir=%langroot%\ddf
  304. set USDDFDir=%_NTPostBld%\symbolCD\usa\ddf
  305. REM
  306. REM Perl script that takes union and intersection of lists
  307. REM
  308. set MakeList=%RazzleToolPath%\makelist.pl
  309. REM
  310. REM Perl
  311. REM
  312. set perl=perl.exe
  313. REM
  314. REM SYMCD - root of the symbol CD. Everything under here
  315. REM will appear as is on the symbol CD.
  316. REM
  317. set SYMCD=%_NTPostBld%\symbolCD\CD
  318. REM
  319. REM InfDestDir - final destination directory for the infs
  320. REM and the final cab
  321. REM
  322. set InfDestDir=%SYMCD%\Symbols\%SUBDIR%\%FRECHK%
  323. REM
  324. REM CabDestDir - directory where the individual cabs are
  325. REM placed before they get merged into one cab
  326. REM
  327. set CabDestDir=%langroot%\cabs
  328. REM
  329. REM RedistDir has cabs that are on the CD, but are not
  330. REM installed
  331. REM
  332. set RedistDir=%_NTPostBld%\symbolCD\redist
  333. REM
  334. REM If we want to do a clean build, erase %symcabname%.inf
  335. REM
  336. if exist %symerror.txt% (
  337. set cleanbuild=1
  338. call logmsg "There were errors previously -- will do cleanbuild"
  339. )
  340. if not exist %build_bindiff% (
  341. set cleanbuild=1
  342. call logmsg "%build_bindiff% does not exist -- will do cleanbuild"
  343. )
  344. if not exist %InfDestDir%\%SymCabName%.inf (
  345. set cleanbuild=1
  346. call logmsg "%InfDestDir%\%SymCabName%.inf does not exist -- will do cleanbuild"
  347. )
  348. if not exist %InfDestDir%\%SymCabName%.cat (
  349. set cleanbuild=1
  350. call logmsg "%InfDestDir%\%SymCabName%.cat does not exist -- will do cleanbuild"
  351. )
  352. if defined cleanbuild (
  353. del /q %InfDestDir%\%SymCabName%.inf >nul 2>nul
  354. del /q %InfDestDir%\%SymCabName%.cat >nul 2>nul
  355. del /q %InfDestDir%\%SymCabName%.cab >nul 2>nul
  356. )
  357. REM
  358. REM If this is incremental, only create the cabs
  359. REM
  360. if /i "%lang%" == "usa" (
  361. if not defined cleanbuild (
  362. call logmsg "Running in incremental mode"
  363. goto CreateCatalog
  364. )
  365. ) else (
  366. REM localized builds can skip the cab generation
  367. if exist %build_bindiff% (
  368. goto EndSymbolCD
  369. )
  370. )
  371. REM
  372. REM Otherwise, do a clean build of everything
  373. REM
  374. REM Delete the %langroot% directory
  375. call :ReMD %langroot%
  376. call :ReMD %langroot%.bak
  377. call :ReMD %DDFDir%\temp
  378. if /i "%lang%" NEQ "usa" goto CreateFileList
  379. REM Make the necessary directories
  380. if not exist %InfDestDir% md %InfDestDir%
  381. call :ReMD %DDFDir%\..\ddf.bak
  382. call :ReMD %CabDestDir%
  383. REM
  384. REM Create the exclude list. Right now exclusion list consists of the
  385. REM list of symbol files we are not supposed to ship. Symbad.txt is not
  386. REM included in the exclusion list because symbad.txt might not be up to
  387. REM data and some of the files in symbad could have correct symbols. We
  388. REM want to get as many symbols as possible, as long as they pass symbol
  389. REM checking.
  390. REM
  391. :CreateExcludeList
  392. copy %RazzleToolPath%\symdontship.txt %exclude.txt%
  393. type %RazzleToolPath%\symbolswithtypes.txt >> %exclude.txt%
  394. if exist %symlistwithtypes.txt% del /q %symlistwithtypes.txt%
  395. for /f %%a in (%RazzleToolPath%\symbolswithtypes.txt) do (
  396. echo %_NTPostBld%\%%a>> %symlistwithtypes.txt%
  397. )
  398. REM
  399. REM Create the list of files. This is the list of retail files that
  400. REM we will attempt to find symbols for.
  401. REM
  402. :CreateFileList
  403. call logmsg.cmd "Creating the list of files to check symbols for"
  404. REM Get the list of subdirectories that have dosnet and excdosnet in them.
  405. REM And, make it compliant with the international builds.
  406. REM Set the first one to be workstation, which is the current directory
  407. set inflist= .
  408. perl %RazzleToolPath%\cksku.pm -t:per -l:%lang%
  409. if %errorlevel% EQU 0 set inflist=%inflist% perinf
  410. perl %RazzleToolPath%\cksku.pm -t:bla -l:%lang%
  411. if %errorlevel% EQU 0 set inflist=%inflist% blainf
  412. perl %RazzleToolPath%\cksku.pm -t:sbs -l:%lang%
  413. if %errorlevel% EQU 0 set inflist=%inflist% sbsinf
  414. perl %RazzleToolPath%\cksku.pm -t:srv -l:%lang%
  415. if %errorlevel% EQU 0 set inflist=%inflist% srvinf
  416. perl %RazzleToolPath%\cksku.pm -t:ads -l:%lang%
  417. if %errorlevel% EQU 0 set inflist=%inflist% entinf
  418. perl %RazzleToolPath%\cksku.pm -t:dtc -l:%lang%
  419. if %errorlevel% EQU 0 set inflist=%inflist% dtcinf
  420. REM Take the union of dosnet.inf and excdosnet.inf for all subdirectories
  421. for %%a in (%inflist%) do (
  422. if /i EXIST %_NTPostBld%\%%a (
  423. %perl% %MakeList% -n %_NTPostBld%\%%a\dosnet.inf -o %DDFDir%\temp\dosnet.lst
  424. %perl% %MakeList% -q %_NTPostBld%\%%a\excdosnt.inf -o %DDFDir%\temp\drivers.lst
  425. %perl% %MakeList% -u %DDFDir%\temp\drivers.lst %DDFDir%\temp\dosnet.lst -o %DDFDir%\temp\%%a.lst
  426. if NOT exist %DDFDir%\temp\all.lst (
  427. copy %DDFDir%\temp\%%a.lst %DDFDir%\temp\all.lst
  428. ) else (
  429. %perl% %MakeList% -u %DDFDir%\temp\all.lst %DDFDir%\temp\%%a.lst -o %DDFDir%\temp\all.lst
  430. )
  431. )
  432. )
  433. REM People who own cabs have supplied lists of the files in the cabs
  434. REM These lists are in the directory symbolcd\cablists
  435. REM Add them to the end of the list we just created
  436. call logmsg.cmd "Adding the files that are in cabs"
  437. if EXIST %_NTPostBld%\symbolcd\cablists (
  438. dir /a-d /b %_NTPostBld%\symbolcd\cablists > %DDFDir%\temp\cablists.lst
  439. )
  440. if EXIST %DDFDir%\temp\cablists.lst (
  441. for /f %%a in (%DDFDir%\temp\cablists.lst) do (
  442. type %_NTPostBld%\symbolcd\cablists\%%a >> %DDFDir%\temp\all.lst
  443. )
  444. )
  445. REM
  446. REM Find out which of these files are in %_NTPostBld%
  447. REM Put the output in %symlist.txt%
  448. REM
  449. call logmsg.cmd "Computing which files are in %_NTPostBld%"
  450. for /f %%b in (%DDFDir%\temp\all.lst) do (
  451. if /i EXIST %_NTPostBld%\%%b (
  452. echo %_NTPostBld%\%%b >> %DDFDir%\temp\all2.lst
  453. )
  454. )
  455. sort %DDFDir%\temp\all2.lst > %symlist.txt%
  456. call logmsg.cmd "Finished creating %symlist.txt%"
  457. :EndSymLists
  458. :SymbolCheck
  459. REM
  460. REM Create the list of files to copy onto the symbolcd.
  461. REM Result is %symbolcd.txt%
  462. REM
  463. REM /c output list of symbols. THis is used as input to symmake for
  464. REM creating the makefile and ddfs.
  465. REM /l input list of files to find symbols for
  466. REM %_NTPostBld% - directory where files in %symlist.txt% are located
  467. REM /s symbol search path
  468. REM /e don't look for symbols for these files (i.e., files we should not
  469. REM ship symbols for
  470. REM /x Don't write errors for these files to the error log
  471. REM %symerror.log% Errors during symbol checking --- these should be
  472. REM examined because the errors are genuine.
  473. REM
  474. REM Delete the error file that gets sent to people
  475. if exist %symerror.txt% del /q %symerror.txt%
  476. if /i "%lang%" == "usa" (
  477. call logmsg.cmd "Examining file headers to compute the list of symbol files ..."
  478. symchk.exe /t %PUB_SYM_FLAG% /c %symbolcd.txt% /l %symlist.txt% %_NTPostBld%\* /s %_NTPostBld%\symbols\retail /e %exclude.txt% /x %symbad.txt% > %symerror.log%
  479. call logmsg.cmd "Examining file headers for symbols that may have type info to compute the list of symbol files ..."
  480. symchk.exe /t /c %symbolcd.txt% /l %symlistwithtypes.txt% %_NTPostBld%\* /s %_NTPostBld%\symbols\retail /x %symbad.txt% >> %symerror.log%
  481. ) else (
  482. REM localized builds just need to add the binaries
  483. if exist %symbolcd.txt% del /q %symbolcd.txt%
  484. for /f %%a in (%symlist.txt%) do (
  485. echo %%a,,%%a, >> %symbolcd.txt%
  486. )
  487. )
  488. :winnt32
  489. REM
  490. REM Recursively add files in the winnt32 subdirectory
  491. REM
  492. REM Don't use a list, just go through the subdirectories
  493. REM
  494. call logmsg.cmd "Adding files in the winnt32 subdirectory"
  495. if /i "%lang%" == "usa" (
  496. copy %exclude.txt% %exclude.txt%.winnt32
  497. @echo winntbbu.dll>>%exclude.txt%.winnt32
  498. symchk.exe /t %PUB_SYM_FLAG% /r /c %symbolcd.txt% %_NTPostBld%\winnt32\* /s %_NTPostBld%\symbols\winnt32 /x %symbad.txt% /e %exclude.txt%.winnt32 > %symerror.winnt32.log%
  499. ) else (
  500. for /f %%a in ('dir /s /b %_NTPostBld%\winnt32\*') do (
  501. echo %%a,,%%a, >> %symbolcd.txt%
  502. )
  503. )
  504. REM don't log these -- there are a log of errors
  505. REM call :LogSymbolErrors %symerror.winnt32.log%
  506. call logmsg.cmd "Adding *.sym files in the %_NTPostBld%\system32 directory"
  507. dir /b %_NTPostBld%\system32\*.sym > %DDFDir%\temp\symfiles.txt
  508. for /f %%a in (%DDFDir%\temp\symfiles.txt) do (
  509. echo %_NTPostBld%\system32\%%a,%%a,system32\%%a,16bit>> %symbolcd.txt%
  510. )
  511. REM
  512. REM Also add files in the wow6432 directory
  513. REM Wow6432 should only exist on x86fre and x86chk
  514. REM
  515. if exist %_NTPostBld%\wow6432 (
  516. if /i "%lang%" == "usa" (
  517. call logmsg.cmd "Adding files in the %_NTPostBld%\wow6432 directory"
  518. symchk.exe /t %PUB_SYM_FLAG% /c %symbolcd.tmp% %_NTPostBld%\wow6432\* /s %_NTPostBld%\wow6432\symbols\retail /x %symbad.txt% >> %symerror.log%
  519. REM add wow6432 before the symbols directory and also before the install directory
  520. for /f "tokens=1,2,3,4 delims=," %%a in (%symbolcd.tmp%) do (
  521. echo %%a,%%b,wow6432\%%c,wow6432\%%d>> %symbolcd.txt%
  522. )
  523. ) else (
  524. for /f %%a in ('dir /b %_NTPostBld%\wow6432') do (
  525. echo %_NTPostBld%\wow6432\%%a,,%_NTPostBld%\wow6432\%%a, >> %symbolcd.txt%
  526. )
  527. )
  528. )
  529. REM
  530. REM Add the asms directory
  531. REM
  532. if exist %_NTPostBld%\asms (
  533. call logmsg.cmd "Adding the asms symbols"
  534. if /i "%lang%" == "usa" (
  535. symchk.exe /t %PUB_SYM_FLAG% /r /c %symbolcd.txt% %_NTPostBld%\asms\* /s %_NTPostBld%\symbols\retail /x %symbad.txt% /e %exclude.txt% >> %symerror.log%
  536. ) else (
  537. for /f %%a in ('dir /s /b %_NTPostBld%\asms') do (
  538. echo %%a,,%%a, >> %symbolcd.txt%
  539. )
  540. )
  541. )
  542. REM
  543. REM Add the wow6432\asms directory
  544. REM
  545. if exist %symerror.log%.wow6432.asms del %symerror.log%.wow6432.asms >nul
  546. if exist %symbolcd.txt%.wow6432.asms del %symbolcd.txt%.wow6432.asms >nul
  547. if exist %_NTPostBld%\wow6432\asms (
  548. call logmsg.cmd "Adding the wow6432 asms symbols"
  549. if /i "%lang%" == "usa" (
  550. symchk.exe /t %PUB_SYM_FLAG% /r /c %symbolcd.txt%.wow6432.asms %_NTPostBld%\wow6432\asms\* /s %_NTPostBld%\wow6432\symbols\retail /x %symbad.txt% /e %exclude.txt% >> %symerror.log%.wow6432.asms
  551. for /f "tokens=1,2,3,4 delims=," %%a in (%symbolcd.txt%.wow6432.asms) do (
  552. echo %%a,%%b,wow6432\%%c,%%d >> %symbolcd.txt%
  553. )
  554. ) else (
  555. for /f %%a in ('dir /s /b %_NTPostBld%\wow6432\asms') do (
  556. echo %%a,,%%a, >> %symbolcd.txt%
  557. )
  558. )
  559. )
  560. REM
  561. REM Add the lang directory
  562. REM
  563. if exist %_NTPostBld%\lang (
  564. call logmsg.cmd "Adding the lang symbols"
  565. if /i "%lang%" == "usa" (
  566. symchk.exe /t %PUB_SYM_FLAG% /r /c %symbolcd.txt% %_NTPostBld%\lang\* /s %_NTPostBld%\symbols\lang /x %symbad.txt% /e %exclude.txt% >> %symerror.log%
  567. ) else (
  568. for /f %%a in ('dir /s /b %_NTPostBld%\lang') do (
  569. echo %%a,,%%a, >> %symbolcd.txt%
  570. )
  571. )
  572. )
  573. REM
  574. REM Add the netfx directory
  575. REM
  576. if exist %_NTPostBld%\netfx (
  577. call logmsg.cmd "Adding the netfx symbols"
  578. if /i "%lang%" == "usa" (
  579. symchk.exe /t %PUB_SYM_FLAG% /r /c %symbolcd.txt% %_NTPostBld%\netfx\* /s %_NTPostBld%\symbols\netfx /x %symbad.txt% /e %exclude.txt% >> %symerror.log%
  580. ) else (
  581. for /f %%a in ('dir /s /b %_NTPostBld%\netfx') do (
  582. echo %%a,,%%a, >> %symbolcd.txt%
  583. )
  584. )
  585. )
  586. REM
  587. REM Add the wms directory
  588. REM
  589. if exist %symerror.log%.wms del %symerror.log%.wms >nul
  590. if exist %_NTPostBld%\wms (
  591. call logmsg.cmd "Adding the wms symbols"
  592. if /i "%lang%" == "usa" (
  593. symchk.exe /t %PUB_SYM_FLAG% /r /c %symbolcd.txt% %_NTPostBld%\wms\* /s %_NTPostBld%\symbols\wms /x %symbad.txt% /e %exclude.txt% >> %symerror.log%.wms
  594. ) else (
  595. for /f %%a in ('dir /s /b %_NTPostBld%\wms') do (
  596. echo %%a,,%%a, >> %symbolcd.txt%
  597. )
  598. )
  599. )
  600. REM
  601. REM Look for language's symbols
  602. REM
  603. REM
  604. if exist %symerror.log%.languages del %symerror.log%.languages>nul
  605. if /i "%lang%" EQU "usa" (
  606. for /f "tokens=1 eol=;" %%f in (%RazzleToolPath%\codes.txt) do (
  607. if exist %_NTPostBld%\%%f (
  608. if exist %symbolcd.txt%.%%f del %symbolcd.txt%.%%f>nul
  609. call logmsg.cmd "Add the %%f symbols"
  610. symchk.exe /t %PUB_SYM_FLAG% /r /c %symbolcd.txt%.%%f %_NTPostBld%\%%f\* /s %_NTPostBld%\%%f\symbols\retail /x %symbad.txt% /e %exclude.txt% >> %symerror.log%.languages
  611. for /f "tokens=1,2,3,4 delims=," %%m in (%symbolcd.txt%.%%f) do (
  612. @echo %%m,%%n,%%f\%%o,%%f\%%p>>%symbolcd.txt%
  613. )
  614. )
  615. )
  616. )
  617. REM
  618. REM Look for FE symbols
  619. REM
  620. REM
  621. if /i "%lang%" EQU "usa" (
  622. for %%f in (FE) do (
  623. if exist %_NTPostBld%\%%f (
  624. if exist %symbolcd.txt%.%%f del %symbolcd.txt%.%%f>nul
  625. call logmsg.cmd "Add the %%f symbols"
  626. symchk.exe /t %PUB_SYM_FLAG% /r /c %symbolcd.txt%.%%f %_NTPostBld%\%%f\* /s %_NTPostBld%\%%f\symbols\retail /x %symbad.txt% /e %exclude.txt% >> %symerror.log%.languages
  627. for /f "tokens=1,2,3,4 delims=," %%m in (%symbolcd.txt%.%%f) do (
  628. @echo %%m,%%n,%%f\%%o,%%f\%%p>>%symbolcd.txt%
  629. )
  630. )
  631. )
  632. )
  633. if /i "%lang%" NEQ "usa" (
  634. call logmsg.cmd "Finished creating %symbolcd.txt%"
  635. goto EndSymbolCD
  636. )
  637. call :LogSymbolErrors %symerror.log%
  638. call :ReportSymchkErrors
  639. call :ReportSymbolDuplicates
  640. call :FlatSymbolInstalledPath
  641. call logmsg.cmd "Finished creating %symbolcd.txt%"
  642. :CreateMakefile
  643. REM
  644. REM We don't need a real symbol CD cab for coverage builds
  645. REM so lets save time/space and not make one
  646. REM
  647. if defined _COVERAGE_BUILD (
  648. call logmsg.cmd "Coverage build ... skipping making the cab file"
  649. goto :Symsrv
  650. )
  651. REM
  652. REM /i symbol inf that lists the symbol files to be cabbed
  653. REM /o directory to place the DDF files and the makefile
  654. REM /s Number of files to put into a cab
  655. REM /m Tell inf that all cabs will be merged into %SymCabName%.inf
  656. REM
  657. REM
  658. REM Create the makefile and all the DDF's
  659. REM This also creates
  660. REM %DDFDir%\symcabs.txt - a list of all the cabs
  661. REM
  662. call logmsg.cmd "Creating the makefile and the DDF's for creating the cabs"
  663. REM
  664. REM This is the symmake command to use if we are planning to merge all the cabs into one
  665. REM
  666. %symmake% /m /c %SymCabName% /i %symbolcd.txt% /o %DDFDir% /s 800 /t %_NTPostBld% /x %CabDestDir% /y %InfDestDir%
  667. REM
  668. REM Create the catalog
  669. REM
  670. REM
  671. REM Put the name of the catalog file into the header
  672. REM Symmake already output %SymCabName%.CDF
  673. REM
  674. :CreateCatalog
  675. REM
  676. REM Incremental catalog
  677. REM
  678. if not exist %InfDestDir%\%SymCabName%.CAT goto CleanCatalog
  679. REM This echo's the files that need to be readded to
  680. REM %SymCabName%.CDF.update
  681. REM
  682. if exist %DDFDir%\%SymCabName%.update del /f /q %DDFDir%\%SymCabName%.update
  683. nmake /f %DDFDir%\%SymCabName%.CDF.makefile
  684. if not exist %DDFDir%\%SymCabName%.update (
  685. call logmsg "%InfDestDir%\%SymCabName%.CAT is up-to-date"
  686. goto CreateCabs
  687. )
  688. REM Now, add each file to the catalog
  689. for /f %%a in (%DDFDir%\%SymCabName%.update) do (
  690. call updcat %InfDestDir%\%SymCabName%.CAT -a %%a >nul 2>nul
  691. call logmsg "%%a successfully added to %InfDestDir%\%SymCabName%.CAT
  692. )
  693. call logmsg "%InfDestDir%\%SymCabName%.CAT needs to be resigned"
  694. )
  695. goto CreateCabs
  696. REM
  697. REM Clean Catalog generation
  698. REM
  699. :CleanCatalog
  700. call logmsg.cmd "Creating header for %SymCabName%.CDF"
  701. %perl% %MakeList% -h %SymCabName% -o %DDFDir%\%SymCabName%.CDF > nul 2>&1
  702. call logmsg.cmd "Adding files to %SymCabName%.CDF"
  703. echo ^<HASH^>%InfDestDir%\%SymCabName%.inf=%InfDestDir%\%SymCabName%.inf>> %DDFDir%\%SymCabName%.CDF
  704. type %DDFDir%\%SymCabName%.CDF.noheader >> %DDFDir%\%SymCabName%.CDF
  705. call logmsg.cmd "Creating %InfDestDir%\%SymCabName%.CAT"
  706. start "PB_SymCabGen %SymCabName%.CAT" /MIN cmd /c "%RazzleToolPath%\Postbuildscripts\SymCabGen.cmd -f:%SymCabName% -s:%DDFDir% -t:CAT -d:%InfDestDir%"
  707. :CreateCabs
  708. if NOT EXIST %DDFDir%\cabs md %DDFDir%\cabs
  709. if /i EXIST %DDFDir%\temp\*.txt del /f /q %DDFDir%\temp\*.txt
  710. for /F "tokens=1" %%a in (%DDFDir%\symcabs.txt) do (
  711. sleep 1
  712. call logmsg.cmd "%RazzleToolPath%\PostBuildScripts\SymCabGen.cmd -f:%%a -s:%DDFDir% -t:CAB -d:%CabDestDir%"
  713. start "PB_SymCabGen %%a" /MIN cmd /c "%RazzleToolPath%\PostBuildScripts\SymCabGen.cmd -f:%%a -s:%DDFDir% -t:CAB -d:%CabDestDir%"
  714. )
  715. call logmsg.cmd "Waiting for symbol cabs to finish"
  716. :wait
  717. sleep 5
  718. if EXIST %DDFDir%\temp\*.txt goto wait
  719. :Verify
  720. REM
  721. REM Verify that the Catalog is there
  722. REM
  723. if not exist %InfDestDir%\%SymCabName%.CAT (
  724. REM call errmsg.cmd "%InfDestDir%\%SymCabName%.CAT did not get created"
  725. )
  726. REM
  727. REM Verify that all the cabs are there
  728. REM
  729. if /i EXIST %DDFDir%\temp\*.txt del /f /q %DDFDir%\temp\*.txt
  730. set AllCreated=TRUE
  731. call logmsg.cmd "Verifying that all the cabs got created"
  732. for /F "tokens=1" %%a in (%DDFDir%\symcabs.txt) do (
  733. if NOT EXIST %CabDestDir%\%%a (
  734. set AllCreated=FALSE
  735. call logmsg.cmd "%CabDestDir%\%%a didn't get created ... Trying again"
  736. sleep 1
  737. start "PB_SymCabGen %%a" /MIN cmd /c "%_NTPostBld%\SymbolCD\SymCabGen.cmd -f:%%a -d:%CabDestDir%"
  738. )
  739. )
  740. if /i "%AllCreated%" == "TRUE" goto Final
  741. REM
  742. REM Wait for cabs to finish
  743. REM
  744. call logmsg.cmd "Trying again for symbol cabs to finish"
  745. :wait2
  746. sleep 5
  747. if EXIST %DDFDir%\temp\*.txt goto wait2
  748. REM
  749. REM This time print an error message if the cabs do not exist
  750. REM
  751. :FinalVerify
  752. call logmsg.cmd "Verifying that all the cabs got created"
  753. set AllCreated=TRUE
  754. if /i EXIST %cabgenerr.log% del /f /q %cabgenerr.log%
  755. for /F "tokens=1" %%a in (%DDFDir%\symcabs.txt) do (
  756. if /i NOT EXIST %CabDestDir%\%%a (
  757. set AllCreated=FALSE
  758. echo %CabDestDir%\%%a was not created >> %cabgenerr.log%
  759. call errmsg.cmd "%CabDestDir%\%%a was not created"
  760. )
  761. )
  762. if /i EXIST %cabgenerr.log% (
  763. goto end
  764. )
  765. :Final
  766. REM
  767. REM Combine all the cabs into one cab
  768. REM
  769. set first=yes
  770. for /F "tokens=1" %%a in (%DDFDir%\symcabs.txt) do (
  771. REM Make a copy of it
  772. REM copy %CabDestDir%\%%a %InfDestDir%\%%a
  773. if "!first!" == "yes" (
  774. set MergeCommand=load %CabDestDir%\%%a
  775. set first=no
  776. ) else (
  777. set MergeCommand=!MergeCommand! load %CabDestDir%\%%a merge
  778. )
  779. )
  780. set MergeCommand=%MergeCommand% save %InfDestDir%\%SymCabName%.cab
  781. call logmsg.cmd "Merging cabs into %InfDestDir%\%SymCabName%.cab"
  782. cabbench.exe %MergeCommand%
  783. REM
  784. REM Copy the ADC no-install cab
  785. REM
  786. :CopyRedist
  787. if EXIST %RedistDir%\*.cab (
  788. call logmsg.cmd "Copying cabs from %RedistDir% to %InfDestDir%"
  789. copy %RedistDir%\*.cab %InfDestDir%
  790. )
  791. :SignFiles
  792. call logmsg.cmd "Test signing files on CD"
  793. for %%b in (retail debug) do (
  794. REM symbolsx.exe gets checked in as signed, so it is no longer
  795. REM test signed.
  796. if exist %SYMCD%\Symbols\i386\%%b\%SymCabName%.CAT (
  797. call logmsg "Signing %SYMCD%\Symbols\i386\%%b\%SymCabName%.CAT"
  798. call ntsign.cmd %SYMCD%\Symbols\i386\%%b\%SymCabName%.CAT
  799. )
  800. if exist %SYMCD%\Symbols\amd64\%%b\%SymCabName%.CAT (
  801. call logmsg "Signing %SYMCD%\Symbols\amd64\%%b\%SymCabName%.CAT"
  802. call ntsign.cmd %SYMCD%\Symbols\amd64\%%b\%SymCabName%.CAT
  803. )
  804. if exist %SYMCD%\Symbols\ia64\%%b\%SymCabName%.CAT (
  805. call logmsg "Signing %SYMCD%\Symbols\ia64\%%b\%SymCabName%.CAT"
  806. call ntsign.cmd %SYMCD%\Symbols\ia64\%%b\%SymCabName%.CAT
  807. )
  808. )
  809. call logmsg "Finished with the symbolcd!!"
  810. :EndSymbolCD
  811. :Symsrv
  812. REM *********************************************************************
  813. REM Now examine the files in symbols.pri to build a symbol server index
  814. REM file.
  815. REM *********************************************************************
  816. :StartSymsrv
  817. call logmsg "Creating the index files for the symbol server"
  818. :SymsrvSetForkedDirs
  819. set new_fork=
  820. REM International builds and forked builds want to only index the
  821. REM difference between the original usa build.
  822. REm Determine if this is one of those cases. Also, handle the case
  823. REM where international inherits a forked build.
  824. REM SymsrvDir where the current symsrv directory is
  825. REM SymsrvDir_1 where the original US symsrv directory is
  826. REM SymsrvDir_2 where the US symsrv directory is that has the
  827. REM incremental changes from the fork.
  828. set SymsrvDir=%_NTPostBld%\symsrv\%lang%
  829. set SymsrvDir_1=%_NTTREE%\symsrv\usa.1
  830. set SymsrvDir_2=%_NTTREE%\symsrv\usa
  831. set SymsrvMakefile=%_NTPostBld%\symsrv\%lang%\makefile
  832. set SymsrvLatest=%_NTPostBld%\symsrv\%lang%\latest.txt
  833. REM
  834. REM coverage builds are not incremental builds, so
  835. REM wipe out any previous symsrv stuff
  836. REM
  837. if defined _COVERAGE_BUILD (
  838. call logmsg.cmd "Coverage build ... wiping out pre-existing symsrv dir"
  839. rd /s /q %_NTPostBld%\symsrv
  840. )
  841. if /i "%lang%" NEQ "usa" (
  842. if not exist %SymsrvDir_2% (
  843. call errmsg.cmd "The USA symsrv directory does not exist - %SymsrvDir_2%"
  844. goto End_Main
  845. )
  846. call logmsg "Will not re-index what's in %SymsrvDir_2%"
  847. if exist %SymsrvDir_1% (
  848. call logmsg "US build was a forked build - will not re-index what's in %SymsrvDir_1%"
  849. )
  850. )
  851. :EndSymsrvSetForkedDirs
  852. set st=%SymsrvDir%\temp
  853. if NOT exist %SymsrvDir% md %SymsrvDir%
  854. if NOT exist %SymsrvDir%\temp md %SymsrvDir%\temp
  855. set SymsrvLogDir=%SymsrvDir%\Logs
  856. if NOT exist %SymsrvLogDir% md %SymsrvLogDir%
  857. REM Requests are generated by this script
  858. REM The release script moves the requests to working before
  859. REM it copies the file to the server
  860. REM The release script moves the working to finished when the request is done
  861. if not exist %SymsrvDir%\add_requests md %SymsrvDir%\add_requests
  862. if not exist %SymsrvDir%\add_finished md %SymsrvDir%\add_finished
  863. if not exist %SymsrvDir%\del_requests md %SymsrvDir%\del_requests
  864. REM Each request has a count associated with it in case someone
  865. REM tries to run postbuild a bunch of times. If the previous
  866. REM postbuild got indexed on the symbols server, it will be sitting
  867. REM in add_finished and the count will get incremented.
  868. if not exist %SymsrvDir%\count (
  869. echo ^1>%SymsrvDir%\count
  870. )
  871. for /f "tokens=1 delims=" %%a in (%SymsrvDir%\count) do (
  872. set /a count=%%a
  873. )
  874. if defined new_fork (
  875. call logmsg "Incrementing count for new forked build"
  876. set /a count=!count!+1
  877. echo !count!>%SymsrvDir%\count
  878. )
  879. for /f "tokens=1 delims=" %%a in ( '%RazzleToolPath%\postbuildscripts\buildname build_name' ) do (
  880. set BuildName=%%a
  881. )
  882. set IndexFile=%BuildName%.%lang%
  883. REM
  884. REM coverage builds need a different index file name
  885. REM so they don't collide with any other build
  886. REM
  887. if defined _COVERAGE_BUILD (
  888. set IndexFile=%BuildName%.cov
  889. )
  890. REM See if this count has already been put in add_finished
  891. REM Nothing should exist in add_working
  892. dir /b %SymsrvDir%\add_finished\%IndexFile%.!count!.* >NUL 2>NUL
  893. if !ERRORLEVEL! EQU 0 (
  894. goto NewCount
  895. )
  896. goto CreateIndices
  897. :NewCount
  898. set /a count=!count!+1
  899. echo !count!>%SymsrvDir%\count
  900. :CreateIndices
  901. set IndexFile=%IndexFile%.!count!
  902. set SymsrvLog=%IndexFile%.log
  903. call logmsg.cmd "Index file name is %IndexFile%"
  904. REM ********************************************
  905. REM Incremental Symsrv
  906. REM
  907. REM Decide if this is an incremental build
  908. REM Get set up for incremental symbol indexing
  909. REM ********************************************
  910. set st=%SymsrvDir%\temp
  911. set bindiff=%SymsrvDir%\mybindiff.txt
  912. set ml=perl %RazzleToolPath%\makelist.pl
  913. if exist %bindiff% del /f /q %bindiff%
  914. if defined cleanbuild (
  915. call logmsg "Cleanbuild is defined -- will create full indexes"
  916. goto CreateFullIndex
  917. )
  918. REM Now, use the makefile to create a list of what's has changed.
  919. call logmsg "Creating %bindiff%"
  920. nmake /f %SymsrvMakefile% %SymsrvLatest% >nul
  921. set /a BinDiffCount=0
  922. if exist %bindiff% (
  923. for /f %%a in (%bindiff%) do (
  924. set /a BinDiffCount=!BinDiffCount! + 1
  925. if !BinDiffCount! GEQ 50 goto CreateFullIndex
  926. )
  927. ) else (
  928. goto CreateFullIndex
  929. )
  930. call logmsg "Creating incremental symbol server index lists"
  931. REM Save bindiff.txt so we can see what happened
  932. call logmsg "saving bindiff.txt in %st%\bindiff.!count!"
  933. copy %bindiff% %st%\bindiff.!count!
  934. REM Decide if anything is even relevant
  935. REM Put the files that need to be updated into %IncrementalList%
  936. for %%a in ( bin pri pub ) do (
  937. if exist %st%\%IndexFile%.inc.%%a del /f /q %st%\%IndexFile%.inc.%%a
  938. if exist %st%\%IndexFile%.inc.%%a.tmp del /f /q %st%\%IndexFile%.inc.%%a.tmp
  939. if exist %st%\%IndexFile%.inc.%%a.keep del /f /q %st%\%IndexFile%.inc.%%a.keep
  940. if exist %st%\%IndexFile%.%%a.remove del /f /q %st%\%IndexFile%.%%a.remove
  941. if exist %st%\%IndexFile%.%%a.tmp2 del /f /q %st%\%IndexFile%.%%a.tmp2
  942. )
  943. REM See which directory each file is in to determine if it goes into the pri, pub, or bin file
  944. REM Symstore does not append, so append each log file manually.
  945. call logmsg.cmd "Creating indexes for the files in %bindiff% ..."
  946. for /f %%a in ( %bindiff% ) do (
  947. echo %%a | findstr /ic:"%_NTPostBld%\symbols.pri" >nul 2>nul
  948. if !ERRORLEVEL! EQU 0 (
  949. call logmsg "Adding %%a to pri file"
  950. symstore.exe add /a /p /f %%a /g %_NTPostBld%\symbols.pri /x %st%\%IndexFile%.inc.pri > nul
  951. ) else (
  952. echo %%a | findstr /ic:"%_NTPostBld%\symbols" >nul 2>nul
  953. if !ERRORLEVEL! EQU 0 (
  954. call logmsg "Adding %%a to pub file"
  955. symstore.exe add /a /p /f %%a /g %_NTPostBld%\symbols /x %st%\%IndexFile%.inc.pub >nul
  956. ) else (
  957. call logmsg "Adding %%a to bin file"
  958. symstore.exe add /a /p /f %%a /g %_NTPostBld% /x %st%\%IndexFile%.inc.bin >nul
  959. )
  960. )
  961. )
  962. if /i "%lang%" NEQ "usa" goto EndSymsrvIncrementalDiff
  963. REM
  964. REM Munge the lists to decide which symbols to pull from symbols and
  965. REM which to pull from symbols.pri
  966. REM Subtract the pri list from the public list
  967. REM
  968. if not exist %st%\%IndexFile%.inc.pub goto EndSymsrvIncrementalDiff
  969. if not exist %st%\%IndexFile%.inc.pri goto EndSymsrvIncrementalDiff
  970. call logmsg "Removing %IndexFile%.pri entries from %IndexFile%.pub ..."
  971. %ml% -d %st%\%IndexFile%.inc.pub %st%\%IndexFile%.inc.pri -o %st%\%IndexFile%.inc.pub.tmp
  972. copy %st%\%IndexFile%.inc.pub.tmp %st%\%IndexFile%.inc.pub
  973. del %st%\%IndexFile%.inc.pub.tmp
  974. for %%a in (%st%\%IndexFile%.inc.pub) do (
  975. if %%~za EQU 0 (
  976. del /f /q %%a
  977. call logmsg.cmd "There are no public symbols to index"
  978. )
  979. )
  980. :EndSymsrvIncrementalDiff
  981. REM Now, figure out which ones to keep. Only keep the ones that are actually in the
  982. REM product and being put into the symbol cabs. This is why we look at symbolcd.txt.
  983. REM
  984. set symbolcd.txt=%langroot%\symbolcd.txt
  985. call logmsg.cmd "Verifying new indexes with files listed in %symbolcd.txt% ..."
  986. for %%a in ( bin pri pub ) do (
  987. if exist %st%\%IndexFile%.inc.%%a (
  988. for /f "tokens=1* delims=," %%b in ( %st%\%IndexFile%.inc.%%a ) do (
  989. REM Only keep the ones that are in %symbolcd.txt%.
  990. REM then add it to what we are indexing
  991. if "%%a" == "bin" (
  992. findstr /ilc:"%_NTPostBld%\%%b" %symbolcd.txt% >NUL
  993. if !ERRORLEVEL! EQU 0 (
  994. call logmsg.cmd "Keeping %%b in bin file"
  995. echo %%b,%%c>>%st%\%IndexFile%.inc.%%a.keep
  996. )
  997. )
  998. REM If its in symbols.pri and its public counterpart
  999. REM is in symbolcd.txt go ahead and index it.
  1000. if "%%a" == "pri" (
  1001. findstr /ilc:"%%b" %symbolcd.txt% >NUL
  1002. if !ERRORLEVEL! EQU 0 (
  1003. call logmsg.cmd "Keeping %%b in pri file"
  1004. echo %%b,%%c>>%st%\%IndexFile%.inc.%%a.keep
  1005. )
  1006. )
  1007. if "%%a" == "pub" (
  1008. findstr /ilc:"%%b" %symbolcd.txt% >NUL
  1009. if !ERRORLEVEL! EQU 0 (
  1010. call logmsg.cmd "Keeping %%b in pub file"
  1011. echo %%b,%%c>>%st%\%IndexFile%.inc.%%a.keep
  1012. )
  1013. )
  1014. )
  1015. )
  1016. )
  1017. REM Now what's left is to replace the old entries with the new entries
  1018. REM If there is no file in add_requests, copy the file with the latest date
  1019. REM from add_finished. If there is a file in add_requests, then use that as
  1020. REM the starting point.
  1021. for %%a in ( bin pri pub ) do (
  1022. if exist %st%\%IndexFile%.inc.%%a.keep (
  1023. call logmsg.cmd "Creating the new %%a file ..."
  1024. if not exist %SymsrvDir%\add_requests\%IndexFile%.%%a (
  1025. set LatestFile=
  1026. for /f %%b in ('dir /b /od %SymsrvDir%\add_finished\*.%%a') do (
  1027. set LatestFile=%%b
  1028. )
  1029. if defined LatestFile (
  1030. call logmsg "Starting with %SymsrvDir%\add_finished\!LatestFile! "
  1031. copy /y %SymsrvDir%\add_finished\!LatestFile! %st%\%IndexFile%.%%a.tmp >nul
  1032. ) else (
  1033. call logmsg "No previous file to update in add_requests or add_finished"
  1034. )
  1035. ) else (
  1036. call logmsg "Starting with %SymsrvDir%\add_requests\%IndexFile%.%%a "
  1037. copy /y %SymsrvDir%\add_requests\%IndexFile%.%%a %st%\%IndexFile%.%%a.tmp >nul
  1038. )
  1039. REM What we need to do next is take out the old entry and replace it with the new one
  1040. REM For example, if we rebuild advapi32.dll, we don't need to index the advapi32.dll with the
  1041. REM old timestamp.
  1042. REM First, make a file with entries for everything that needs to be removed
  1043. if exist %st%\%IndexFile%.%%a.tmp (
  1044. call logmsg "Removing old files from previous list ..."
  1045. for /f "tokens=1* delims=," %%c in (%st%\%IndexFile%.inc.%%a.keep) do (
  1046. REM Find its corresponding entry in the old list and add it to
  1047. REM the list of things to remove
  1048. findstr /ilc:"%%c" %st%\%IndexFile%.%%a.tmp >>%st%\%IndexFile%.%%a.remove
  1049. if !ERRORLEVEL! EQU 0 (
  1050. call logmsg "Remove %%c"
  1051. )
  1052. )
  1053. REM Now, remove it by subtracting it from the index file
  1054. if exist %st%\%IndexFile%.%%a.remove (
  1055. for %%b in ( %st%\%IndexFile%.%%a.remove ) do (
  1056. if %%~zb GTR 0 (
  1057. %ml% -d %st%\%IndexFile%.%%a.tmp %st%\%IndexFile%.%%a.remove -o %st%\%IndexFile%.%%a.tmp2
  1058. ) else (
  1059. copy %st%\%IndexFile%.%%a.tmp %st%\%IndexFile%.%%a.tmp2 >nul
  1060. )
  1061. )
  1062. ) else (
  1063. copy %st%\%IndexFile%.%%a.tmp %st%\%IndexFile%.%%a.tmp2 >nul
  1064. )
  1065. )
  1066. REM Put the keep stuff at the end
  1067. call logmsg "Add new files we are going to keep"
  1068. type %st%\%IndexFile%.inc.%%a.keep >> %st%\%IndexFile%.%%a.tmp2
  1069. sort %st%\%IndexFile%.%%a.tmp2 > %SymsrvDir%\add_requests\%IndexFile%.%%a
  1070. call logmsg.cmd "Update finished for %SymsrvDir%\add_requests\%IndexFile%.%%a"
  1071. ) else (
  1072. call logmsg.cmd "There are no new %%a files to index"
  1073. )
  1074. )
  1075. goto EndSymsrv
  1076. REM *******************************************************************
  1077. REM Full indexing for symbol server
  1078. REM
  1079. REM International builds will always subtract what is already indexed by
  1080. REM the US build.
  1081. REM
  1082. REM ********************************************************************
  1083. :CreateFullIndex
  1084. call logmsg "Creating full symbol server index lists"
  1085. REM Delete initial files
  1086. for %%a in ( bin pri pub ) do (
  1087. if exist %SymsrvDir%\add_requests\%IndexFile%.%%a del /f /q %SymsrvDir%\add_requests\%IndexFile%.%%a
  1088. if exist %SymsrvDir%\temp\%IndexFile%.%%a del /f /q %SymsrvDir%\temp\%IndexFile%.%%a
  1089. )
  1090. REM
  1091. REM Use symbolcd.txt as a list of what to index
  1092. REM
  1093. :IndexSymbolcdFiles
  1094. call logmsg "Creating %SymsrvDir%\add_requests\%IndexFile%.bin"
  1095. set ShareDir=%_NTPostBld%
  1096. set IndexDir=%_NTPostBld%
  1097. if not exist %symbolcd.txt% (
  1098. call errmsg.cmd "%symbolcd.txt% does not exist"
  1099. goto end
  1100. )
  1101. if /i "%lang%" == "usa" (
  1102. set LastBinaryFileSpec=
  1103. for /f "tokens=1,3 delims=," %%b in (%symbolcd.txt%) do (
  1104. REM store the binaries and symbols via symstore to .bin, .pri, .pub file
  1105. call :StoreSymbol %%b %%c
  1106. )
  1107. ) else (
  1108. for /f "tokens=1 delims=," %%b in (%symbolcd.txt%) do (
  1109. REM store the binaries and symbols via symstore to .bin, .pri, .pub file
  1110. call :SymStoreRoutine %%b %ShareDir% bin
  1111. )
  1112. )
  1113. REM Store the binaries and private symbols for files that we don't ship publicly on
  1114. REM the symbol server.
  1115. if /i "%lang%" == "usa" (
  1116. call logmsg "Adding files in %RazzleToolPath%\symdontship.txt to symbol server lists"
  1117. set LastBinaryFileSpec=
  1118. for /f "tokens=1 delims= " %%b in (%RazzleToolPath%\symdontship.txt) do (
  1119. REM store the binaries and symbols via symstore to .bin, .pri, .pub file
  1120. set ext=%%~xb
  1121. set ext=!ext:~1,3!
  1122. if exist %_NTPostBld%\%%b (
  1123. if exist %_NTPostBld%\symbols\retail\!ext!\%%~nb.pdb (
  1124. call :StoreSymbol %_NTPostBld%\%%b symbols\retail\!ext!\%%~nb.pdb
  1125. )
  1126. )
  1127. )
  1128. ) else (
  1129. for /f "tokens=1 delims= " %%b in (%RazzleToolPath%\symdontship.txt) do (
  1130. REM store the binaries and symbols via symstore to .bin, .pri, .pub file
  1131. call :SymStoreRoutine %_NTPostBld%\%%b %ShareDir% bin
  1132. )
  1133. )
  1134. if exist %ShareDir%\symbols.pri\instmsi\dll\msi_l.pdb (
  1135. call :SymStoreRoutine %ShareDir%\symbols.pri\instmsi\dll\msi_l.pdb %ShareDir%\symbols.pri pri
  1136. )
  1137. REM Now, use these to create a makefile for incremental builds
  1138. :CreateSymsrvMakefile
  1139. if exist %SymsrvMakefile% del /f /q %SymsrvMakefile%
  1140. echotime /n "%SymsrvLatest%: " >> %SymsrvMakefile%
  1141. for %%a in ( bin pri pub ) do (
  1142. if exist %SymsrvDir%\temp\%IndexFile%.%%a (
  1143. copy %SymsrvDir%\temp\%IndexFile%.%%a %SymsrvDir%\add_requests\%IndexFile%.%%a>nul 2>nul
  1144. )
  1145. if exist %SymsrvDir%\add_requests\%IndexFile%.%%a (
  1146. for /f "tokens=1 delims=," %%b in ( %SymsrvDir%\add_requests\%IndexFile%.%%a ) do (
  1147. echotime /N " \\" >> %SymsrvMakefile%
  1148. if /i "%%a" == "bin" (
  1149. echotime /N /n " %_NTPOSTBLD%\%%b">> %SymsrvMakefile%
  1150. )
  1151. if /i "%%a" == "pri" (
  1152. echotime /N /n " %_NTPOSTBLD%\symbols.pri\%%b">> %SymsrvMakefile%
  1153. )
  1154. if /i "%%a" == "pub" (
  1155. echotime /N /n " %_NTPOSTBLD%\symbols\%%b">> %SymsrvMakefile%
  1156. )
  1157. )
  1158. ) else (
  1159. call logmsg "%SymsrvDir%\add_requests\%IndexFile%.%%a does not exist"
  1160. )
  1161. )
  1162. echo.>> %SymsrvMakefile%
  1163. setlocal DISABLEDELAYEDEXPANSION
  1164. echo !echo $?^>^> %bindiff%>> %SymsrvMakefile%
  1165. setlocal ENABLEDELAYEDEXPANSION
  1166. REM if this is a usa forked build, subtract the original symbols that are already
  1167. REM indexed.
  1168. if /i "%lang%" == "usa" (
  1169. if not exist !SymsrvDir_1! (
  1170. REM This is a US build and it is not forked
  1171. goto EndSymsrv
  1172. )
  1173. REM Subtract previous indexes for the US build and only index
  1174. REM the changes in the fork
  1175. call logmsg "Removing files already indexed on symbol server"
  1176. for %%b in ( bin pri pub ) do (
  1177. if exist %SymsrvDir%\add_requests\%IndexFile%.%%b (
  1178. set us_file=
  1179. for /f %%c in ('dir /b /od %SymsrvDir_1%\add_finished\*.%%b') do (
  1180. set us_file=%SymsrvDir_1%\add_finished\%%c
  1181. )
  1182. if defined us_file (
  1183. call logmsg "Removing !us_file! from %SymsrvDir%\add_requests\%IndexFile%.%%b"
  1184. copy %SymsrvDir%\add_requests\%IndexFile%.%%b %st%\%IndexFile%.%%b.full
  1185. del /f /q %SymsrvDir%\add_requests\%IndexFile%.%%b
  1186. %ml% -d %st%\%IndexFile%.%%b.full !us_file! -o %st%\%IndexFile%.%%b.full.unsorted
  1187. sort %st%\%IndexFile%.%%b.full.unsorted > %SymsrvDir%\add_requests\%IndexFile%.%%b
  1188. ) else (
  1189. call logmsg "Nothing to subtract from %SymsrvDir%\add_requests\%IndexFile%.%%b"
  1190. )
  1191. ) else (
  1192. call logmsg "%SymsrvDir%\add_requests\%IndexFile%.%%b does not exist -- no need to subtract"
  1193. )
  1194. )
  1195. )
  1196. :EndSymsrvDir_usa
  1197. REM For international builds, subtract what's already been indexed by the US build
  1198. :SymsrvDir_Intl
  1199. if /i "%lang%" NEQ "usa" (
  1200. call logmsg "Subtracting the US lists from the %lang% lists"
  1201. for %%b in ( bin ) do (
  1202. if exist %SymsrvDir%\add_requests\%IndexFile%.%%b (
  1203. REM Subtract files from the original USA dir and from the fork -
  1204. REM if they exist
  1205. for %%c in ( %SymsrvDir_1% %SymsrvDir_2% ) do (
  1206. REM Get the most recent US file that was indexed. If there was a fork
  1207. REM get the one that was indexed before the fork.
  1208. set us_file=
  1209. if /i "%%b" == "bin" (
  1210. if exist %%c\add_finished\*.%%b (
  1211. for /f %%d in ('dir /b /od %%c\add_finished\*.%%b') do (
  1212. set us_file=%%c\add_finished\%%d
  1213. )
  1214. )
  1215. ) else (
  1216. if exist %st%\us_pri_pub.txt (
  1217. set us_file=%st%\us_pri_pub.txt
  1218. )
  1219. )
  1220. if defined us_file (
  1221. call logmsg "Removing !us_file! from %SymsrvDir%\add_requests\%IndexFile%.%%b"
  1222. %ml% -d %SymsrvDir%\add_requests\%IndexFile%.%%b !us_file! -o %st%\%IndexFile%.%%b.tmp
  1223. sort %st%\%IndexFile%.%%b.tmp > %SymsrvDir%\add_requests\%IndexFile%.%%b
  1224. )
  1225. )
  1226. ) else (
  1227. call logmsg "%SymsrvDir%\add_requests\%IndexFile%.%%b does not exist -- no need to subtract"
  1228. )
  1229. )
  1230. )
  1231. :EndSymsrvDir_intl
  1232. REM Now, make sure that none of them are 0
  1233. for %%a in ( bin pri pub ) do (
  1234. if exist %SymsrvDir%\add_requests\%IndexFile%.%%a (
  1235. for %%b in ( %SymsrvDir%\add_requests\%IndexFile%.%%a ) do (
  1236. if %%~zb EQU 0 (
  1237. call logmsg "Deleting 0 length file - %SymsrvDir%\add_requests\%IndexFile%.%%a"
  1238. del /f /q %SymsrvDir%\add_requests\%IndexFile%.%%a
  1239. )
  1240. )
  1241. )
  1242. )
  1243. :EndSymsrv
  1244. REM Create the latest.txt file
  1245. echo Don't delete this >> %SymsrvLatest%
  1246. REM
  1247. REM Check for errors
  1248. REM
  1249. if "%ThereWereErrors%" == "yes" goto end
  1250. goto end
  1251. REM
  1252. REM Report the symbol checking errors
  1253. REM
  1254. :ReportSymchkErrors
  1255. if "%ThereWereSymchkErrors%" == "no" goto EndReportSymchkErrors
  1256. if exist %symerror.txt% (
  1257. for /f "tokens=1 delims=" %%a in (%symerror.txt%) do (
  1258. call errmsg.cmd "%%a"
  1259. )
  1260. )
  1261. :EndReportSymchkErrors
  1262. goto :EOF
  1263. REM
  1264. REM Report the symbol checking errors
  1265. REM
  1266. :ReportSymbolDuplicates
  1267. if exist %symerror.log%.duplicates del %symerror.log%.duplicates>nul
  1268. call logmsg "Finding any duplicates in symbolcd.txt"
  1269. for /f "tokens=1,2 delims=," %%f in (%symbolcd.txt%) do (
  1270. set duplicate_counter=0
  1271. for /f %%d in ('findstr /ilc:"%%~nxf,%%g" %symbolcd.txt%') do (
  1272. set /A duplicate_counter+=1
  1273. )
  1274. if !duplicate_counter! GTR 1 (
  1275. for /f "tokens=1,4 delims=," %%i in ('findstr /ilc:"%%~nxf,%%g" %symbolcd.txt%') do (
  1276. if /i "%%~dpj" NEQ "%cd%\" (
  1277. @echo %%i>>%symerror.log%.duplicates
  1278. )
  1279. )
  1280. )
  1281. )
  1282. :EndReportSymbolDuplicates
  1283. goto :EOF
  1284. REM
  1285. REM Make Symbol Installed Path to be flat
  1286. REM
  1287. :FlatSymbolInstalledPath
  1288. call logmsg "FlatSymbolInstalledPath"
  1289. copy %symbolcd.txt% %symbolcd.txt%.backup
  1290. if errorlevel 1 (
  1291. call errmsg.cmd "Copy %symbolcd.txt% to %symbolcd.txt%.backup failed"
  1292. goto :EndFlatSymbolInstalledPath
  1293. )
  1294. del %symbolcd.txt%
  1295. for /f "tokens=1,2,3,4 delims=," %%f in (%symbolcd.txt%.backup) do (
  1296. findstr /ilc:%%f %symerror.log%.duplicates >nul 2>nul
  1297. REM If not found in duplicates list, we could flat the directory
  1298. if errorlevel 1 (
  1299. echo %%f,%%g,%%h,%%~ni>>%symbolcd.txt%
  1300. )
  1301. )
  1302. :EndFlatSymbolInstalledPath
  1303. goto :EOF
  1304. :MungePublics
  1305. rem Munge publics breaks when coverage builds are made
  1306. rem since we don't really care about creating a symbol cd
  1307. rem for coverage builds, let skip this part
  1308. if defined _COVERAGE_BUILD (
  1309. call logmsg.cmd "Coverage build ... skipping MungePublics"
  1310. goto :EndMungePublics
  1311. )
  1312. set ThereWereErrors=
  1313. call logmsg "Adding type info to some public pdb files for debugging"
  1314. REM Save the values of CL, LINK, ML because they differ for VC6 and VC7
  1315. if /i "%_BuildArch%" == "x86" (
  1316. set CL_Save=%_CL_%
  1317. set LINK_Save=%_LINK_%
  1318. set ML_Save=%_ML_%
  1319. )
  1320. if exist %_NTPostBld%\pp\* (
  1321. for /f %%a in ('dir /b /ad %_NTPostBld%\pp') do (
  1322. set ext=%%a
  1323. set ext=!ext:~-3!
  1324. set file=%%a
  1325. set file=!file:~0,-4!
  1326. if "!file!.!ext!" NEQ "%%a" (
  1327. call errmsg "%_NTPostBld%\pp\!file!.!ext! name has wrong format"
  1328. goto MungePublicsError
  1329. )
  1330. call logmsg "Working on !file!.!ext!"
  1331. REM See if we need to do anything, or if the symbol file has already been updated
  1332. REM If the symbol file passes symbol checking, but it fails because it has private info in it,
  1333. REM then don't update it.
  1334. set update=yes
  1335. symchk /t %_NTPostBld%\%%a /s %_NTPostBld%\symbols\retail | findstr /ilc:"FAILED files = 0" >nul 2>nul
  1336. if !ERRORLEVEL! == 0 (
  1337. symchk /t %_NTPostBld%\%%a %PUB_SYM_FLAG% /s %_NTPostBld%\symbols\retail | findstr /ilc:"FAILED files = 0" >nul 2>nul
  1338. if !ERRORLEVEL! == 1 set update=no
  1339. )
  1340. if "!update!" == "no" (
  1341. call logmsg "Skipping !file!.!ext! because it's public pdb already has type info in it."
  1342. ) else (
  1343. if not exist %_NTPostBld%\pp\%%a\original (
  1344. mkdir %_NTPostBld%\pp\%%a\original
  1345. )
  1346. if not exist %_NTPostBld%\pp\%%a\updated (
  1347. mkdir %_NTPostBld%\pp\%%a\updated
  1348. )
  1349. REM See if the pdb, if it exists, in original matches the exe in binaries
  1350. symchk /t %_NTPostBld%\%%a /s %_NTPostBld%\pp\%%a\original %PUB_SYM_FLAG% | findstr /ilc:"FAILED files = 0" >nul 2>nul
  1351. if !ERRORLEVEL! == 1 (
  1352. REM It doesn't match
  1353. call logmsg "Saving a copy of !file!.pdb to %_NTPostBld%\pp\%%a\original"
  1354. copy /y %_NTPostBld%\symbols\retail\!ext!\!file!.pdb %_NTPostBld%\pp\%%a\original >nul 2>nul
  1355. )
  1356. REM Verify that the pdb is good
  1357. symchk /t %_NTPostBld%\%%a /s %_NTPostBld%\pp\%%a\original | findstr /ilc:"FAILED files = 0" >nul 2>nul
  1358. if !ERRORLEVEL! == 1 (
  1359. call errmsg "Cannot copy the correct pdb file to %_NTPostBld%\pp\%%a\original"
  1360. goto MungePublicsError
  1361. )
  1362. if exist %_NTPostBld%\pp\%%a\*.* (
  1363. if exist %_NTPostBld%\pp\%%a\updated\!file!.pdb del /q %_NTPostBld%\pp\%%a\updated\!file!.pdb
  1364. copy /y %_NTPostBld%\pp\%%a\original\!file!.pdb %_NTPostBld%\pp\%%a\updated >nul 2>nul
  1365. if not exist %_NTPostBld%\pp\%%a\updated\!file!.pdb (
  1366. call errmsg "Copy failed for %_NTPostBld%\pp\%%a\original\!file!.pdb to %_NTPostBld%\pp\%%a\updated"
  1367. goto MungePublicsError
  1368. )
  1369. call logmsg "Pushing type info into the stripped !file!.pdb"
  1370. if exist %_NTPostBld%\pp\%%a\!file!.c (
  1371. set c_ext=c
  1372. ) else (
  1373. set c_ext=cpp
  1374. )
  1375. if /i "%_BuildArch%" == "x86" (
  1376. pdbdump %_NTPostBld%\pp\%%a\updated\!file!.pdb hdr | findstr /i 0000-0000-0000-000000000000 > nul
  1377. if !ERRORLEVEL! == 0 (
  1378. call logmsg "This is a vc6 pdb"
  1379. set _CL_=%CL_Save%
  1380. set _ML_=%ML_Save%
  1381. set _LINK_=%LINK_Save%
  1382. ) else (
  1383. call logmsg "This is a vc7 pdb"
  1384. set _CL_=
  1385. set _ML_=
  1386. set _LINK_=
  1387. )
  1388. )
  1389. cl /nologo /Zi /Gz /c %_NTPostBld%\pp\%%a\!file!.!c_ext! /Fd%_NTPostBld%\pp\%%a\updated\!file!.pdb /Fo%_NTPostBld%\pp\%%a\updated\!file!.obj
  1390. if !ERRORLEVEL! NEQ 0 (
  1391. call errmsg "cl /Zi /c %_NTPostBld%\pp\%%a\!file!.!c_ext! /Fd%_NTPostBld%\pp\%%a\updated\!file!.pdb had errors"
  1392. goto MungePublicsError
  1393. )
  1394. symchk /t %_NTPostBld%\%%a /s %_NTPostBld%\pp\%%a\updated | findstr /ilc:"FAILED files = 0" >nul 2>nul
  1395. if !ERRORLEVEL! == 1 (
  1396. call errmsg "The munged %_NTPostBld%\pp\%%a\updated\!file!.pdb doesn't match %_NTPostBld%\%%a"
  1397. goto MungePublicsError
  1398. )
  1399. del /q %_NTPostBld%\symbols\retail\!ext!\!file!.pdb
  1400. call logmsg "Copying %_NTPostBld%\pp\%%a\updated\!file!.pdb to %_NTPostBld%\symbols\retail\!ext!"
  1401. copy /y %_NTPostBld%\pp\%%a\updated\!file!.pdb %_NTPostBld%\symbols\retail\!ext! >nul 2>nul
  1402. REM Verify that this pdb got copied
  1403. symchk /t %_NTPostBld%\%%a /s %_NTPostBld%\pp\%%a\updated | findstr /ilc:"FAILED files = 0" >nul 2>nul
  1404. if !ERRORLEVEL! == 1 (
  1405. REM Try copying the original back
  1406. copy /y %_NTPostBld%\pp\%%a\original\!file!.pdb %_NTPostBld%\symbols\retail\!ext! >nul 2>nul
  1407. call errmsg "The munged %_NTPostBld%\pp\%%a\updated\!file!.pdb didn't get copied to %_NTPostBld%\symbols\retail\!ext!"
  1408. call logmsg "Copying the original pdb back to %_NTPostBld%\symbols\retail\!ext!"
  1409. copy /y %_NTPostBld%\pp\%%a\original\!file!.pdb %_NTPostBld%\symbols\retail\!ext! >nul 2>nul
  1410. if not exist %_NTPostBld%\symbols\retail\!ext!\!file!.pdb (
  1411. call errmsg "Cannot get %%a symbols copied back to %_NTPostBld%\symbols\retail\!ext!"
  1412. goto MungePublicsError
  1413. )
  1414. goto MungePublicsError
  1415. )
  1416. )
  1417. )
  1418. )
  1419. )
  1420. if /i "%_BuildArch%" == "x86" (
  1421. set _CL_=%CL_Save%
  1422. set _ML_=%ML_Save%
  1423. set _LINK_=%LINK_Save%
  1424. )
  1425. :EndMungePublics
  1426. goto :EOF
  1427. :MungePublicsError
  1428. set ThereWereErrors=TRUE
  1429. goto :EOF
  1430. REM *********************************************************************
  1431. REM StoreSymbol(BinaryFileSpec, PublicSymbolFileSpec)
  1432. REM
  1433. REM Call symstore to create the symbol link to .bin .pri and .pub
  1434. REM
  1435. REM *********************************************************************
  1436. :StoreSymbol
  1437. set BinaryFileSpec=%1
  1438. set PublicSymbolFileSpec=%2
  1439. set PrivateSymbolFileSpec=%PublicSymbolFileSpec:symbols=symbols.pri%
  1440. if /i "%LastBinaryFileSpec%" neq "%BinaryFileSpec%" (
  1441. call :SymStoreRoutine %BinaryFileSpec% %ShareDir% bin
  1442. set LastBinaryFileSpec=%BinaryFileSpec%
  1443. )
  1444. REM Skip to store symbol file if symbol file name is equal to binary file name.
  1445. REM It is for 16bit binaries.
  1446. if /i "%BinaryFileSpec%" EQU "%ShareDir%\%PublicSymbolFileSpec%" (
  1447. goto :EOF
  1448. )
  1449. REM Store Rule
  1450. REM 1. If private Symbol exist, store private symbol (in .pri)
  1451. REM 2. If not under symbols.pri or symbols folder, store the file thru %ShareDir% (in .bin)
  1452. if exist "%ShareDir%\%PrivateSymbolFileSpec%" (
  1453. if /i "%PrivateSymbolFileSpec:~0,12%" EQU "symbols.pri\" (
  1454. call :SymStoreRoutine %ShareDir%\%PrivateSymbolFileSpec% %ShareDir%\symbols.pri pri
  1455. goto :EOF
  1456. )
  1457. call :SymStoreRoutine %ShareDir%\%PrivateSymbolFileSpec% %ShareDir% bin
  1458. goto :EOF
  1459. )
  1460. if exist "%ShareDir%\%PublicSymbolFileSpec%" (
  1461. if /i "%PublicSymbolFileSpec:~0,8%" EQU "symbols\" (
  1462. call :SymStoreRoutine %ShareDir%\%PublicSymbolFileSpec% %ShareDir%\symbols pub
  1463. goto :EOF
  1464. )
  1465. call :SymStoreRoutine %ShareDir%\%PublicSymbolFileSpec% %ShareDir% bin
  1466. goto :EOF
  1467. )
  1468. REM If we can not find the symbol file, we should repro the error
  1469. call errmsg.cmd "Can not find symbol file %ShareDir%\%PublicSymbolFileSpec%"
  1470. :EndStoreSymbol
  1471. goto :EOF
  1472. REM *********************************************************************
  1473. REM SymStoreRoutine(FileSpec, ShareDirLoc, StoreType)
  1474. REM
  1475. REM Call symstore for sending the vary part
  1476. REM
  1477. REM *********************************************************************
  1478. :SymStoreRoutine
  1479. set FileSpec=%1
  1480. set ShareDirLoc=%2
  1481. set StoreType=%3
  1482. symstore.exe add /a %RecursiveSymStore% /p /f %FileSpec% /g %ShareDirLoc% /x %SymsrvDir%\temp\%IndexFile%.!StoreType! >> %SymsrvDir%\temp\symstore.err
  1483. if errorlevel 1 (
  1484. call errmsg.cmd "SymStore Error - symstore.exe add /a %RecursiveSymStore% /p /f %FileSpec% /g %ShareDirLoc% /x %SymsrvDir%\temp\%IndexFile%.!StoreType!
  1485. )
  1486. :EndSymStoreRoutine
  1487. goto :EOF
  1488. REM *********************************************************************
  1489. REM ReMD(Path)
  1490. REM
  1491. REM Remove directory and create a new one
  1492. REM
  1493. REM *********************************************************************
  1494. :ReMD
  1495. call logmsg.cmd "Remove and Create directory %1"
  1496. set ReMDPath=%1
  1497. if exist %ReMDPath% (
  1498. rd %ReMDPath% /s /q
  1499. )
  1500. MD %ReMDPath%
  1501. if errorlevel 1 (
  1502. call errmsg.cmd "Cannot create %ReMDPath% correctly."
  1503. )
  1504. goto :EOF
  1505. REM This puts the symbol errors in the symbol error log into the error file
  1506. REM for congeal scripts. %1 is the symbol error log that is passed in.
  1507. REM If there are errors, the script should continue on and finish, but know
  1508. REM later that there were errors, so that it can goto end when the script
  1509. REM is done. That's the purpose of having the ThereWereSymchkErrors variable.
  1510. goto end
  1511. :LogSymbolErrors
  1512. for /f "tokens=1,2* delims= " %%f in (%1) do (
  1513. if /i not "%%g" == "FAILED" (
  1514. if /i not "%%g" == "PASSED" (
  1515. if /i not "%%g" == "IGNORED" (
  1516. echotime "%%f %%g %%h" >>%symerror.txt%
  1517. set ThereWereSymchkErrors=yes
  1518. )))
  1519. )
  1520. goto :EOF
  1521. :ValidateParams
  1522. REM
  1523. REM Validate the option given as parameter.
  1524. REM
  1525. goto end
  1526. :Usage
  1527. REM Usage of the script
  1528. REM If errors, goto end
  1529. echo Usage: %script_name% [-l lang][-c] [-?]
  1530. echo -l lang 2-3 letter language identifier
  1531. echo -c clean build
  1532. echo -? Displays usage
  1533. set ERRORS=1
  1534. goto end
  1535. REM /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  1536. REM End Main code section
  1537. REM /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  1538. :End_Main
  1539. goto PostMain
  1540. REM SupportSubsSupportSubsSupportSubsSupportSubsSupportSubsSupportSubsSupportSubs
  1541. REM Support Subs - Do not touch this section!
  1542. REM SupportSubsSupportSubsSupportSubsSupportSubsSupportSubsSupportSubsSupportSubs
  1543. :GetParams
  1544. REM
  1545. REM Parse the command line arguments
  1546. REM
  1547. set ERRORS=0
  1548. for %%h in (./ .- .) do if ".%SCRIPT_ARGS%." == "%%h?." goto Usage
  1549. pushd %RazzleToolPath%\PostBuildScripts
  1550. set ERRORS=0
  1551. for /f "tokens=1 delims=;" %%c in ('perl.exe GetParams.pm %*') do (
  1552. set commandline=%%c
  1553. set commandtest=!commandline:~0,3!
  1554. if /i "!commandtest!" neq "set" (
  1555. if /i "!commandtest!" neq "ech" (
  1556. echo %%c
  1557. ) else (
  1558. %%c
  1559. )
  1560. ) else (
  1561. %%c
  1562. )
  1563. )
  1564. if "%errorlevel%" neq "0" (
  1565. set ERRORS=%errorlevel%
  1566. goto end
  1567. )
  1568. popd
  1569. goto end
  1570. :LocalEnvEx
  1571. REM
  1572. REM Manage local script environment extensions
  1573. REM
  1574. pushd %RazzleToolPath%\PostBuildScripts
  1575. for /f "tokens=1 delims=;" %%c in ('perl.exe LocalEnvEx.pm %1') do (
  1576. set commandline=%%c
  1577. set commandtest=!commandline:~0,3!
  1578. if /i "!commandtest!" neq "set" (
  1579. if /i "!commandtest!" neq "ech" (
  1580. echo %%c
  1581. ) else (
  1582. %%c
  1583. )
  1584. ) else (
  1585. %%c
  1586. )
  1587. )
  1588. if "%errorlevel%" neq "0" (
  1589. set errors=%errorlevel%
  1590. goto end
  1591. )
  1592. popd
  1593. goto end
  1594. :end
  1595. seterror.exe "%errors%"& goto :EOF
  1596. REM PostMainPostMainPostMainPostMainPostMainPostMainPostMainPostMainPostMain
  1597. REM Begin PostProcessing - Do not touch this section!
  1598. REM PostMainPostMainPostMainPostMainPostMainPostMainPostMainPostMainPostMain
  1599. :PostMain
  1600. REM
  1601. REM End the local environment extensions.
  1602. REM
  1603. call :LocalEnvEx -e
  1604. REM
  1605. REM Check for errors
  1606. REM
  1607. endlocal& seterror.exe "%errors%"