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.

152 lines
3.2 KiB

  1. @echo off
  2. setlocal EnableDelayedExpansion
  3. REM
  4. REM PlaceLdo.cmd
  5. REM
  6. REM Arguments: none
  7. REM
  8. REM Returns: 0 if successful, non-zero otherwise
  9. REM
  10. REM Purpose: this tool copies .ldo files resulting from prejitting
  11. REM Freestyle managed code binaries from the LDO share point
  12. REM into the build.
  13. REM
  14. set /a ErrorCount=0
  15. if "%1"=="" goto :Usage
  16. set LDO_PICKUP_SITE=%1
  17. REM first, parse command line
  18. REM :SwitchLoop
  19. REM for %%a in (./ .- .) do if ".%1." == "%%a?." goto :Usage
  20. REM if "%1" == "" goto :EndSwitchLoop
  21. REM for /f "tokens=1,2 delims=:" %%a in ('echo %1') do (
  22. REM set Switch=%%a
  23. REM set Arg=%%b
  24. REM for %%c in (./ .-) do (
  25. REM if /i ".!Switch!." == "%%cl." (set Lang=!Arg!&&goto :ShiftArg)
  26. REM )
  27. REM REM if we're here, we didn't encounter any switches and thus we have
  28. REM REM an unrecognized argument
  29. REM goto :Usage
  30. REM )
  31. REM :ShiftArg
  32. REM shift
  33. REM goto :SwitchLoop
  34. REM :EndSwitchLoop
  35. REM begin
  36. echo "Placing .ldo files for prejitted Freestyle managed code binaries ..."
  37. REM
  38. REM setup and initial verification
  39. REM
  40. REM 1) make sure the build is at %_nttree%
  41. REM 2) make sure the LDO return share exists, and there are files there
  42. REM 1) make sure the build is at %_nttree%
  43. if not exist %_nttree% (
  44. echo "No build found under %_nttree%, exiting"
  45. set /a ErrorCount=!ErrorCount! + 1
  46. goto :ErrEnd
  47. )
  48. REM 2) make sure the LDO return share exists, and there are files there
  49. if "%LDO_PICKUP_SITE%" == "" (
  50. echo "No LDO pickup site defined in LDO_PICKUP_SITE environement variable."
  51. set /a ErrorCount=!ErrorCount! + 1
  52. goto :ErrEnd
  53. )
  54. if not exist %LDO_PICKUP_SITE% (
  55. echo "%LDO_PICKUP_SITE% specified in env var LDO_PICKUP_SITE does not exist, exiting."
  56. set /a ErrorCount=!ErrorCount! + 1
  57. goto :ErrEnd
  58. )
  59. echo "Will take LDO files from %LDO_PICKUP_SITE% ..."
  60. REM Delete any old copies of the private placefile
  61. if exist %LDO_PICKUP_SITE%\priv_place.txt del %LDO_PICKUP_SITE%\priv_place.txt
  62. )
  63. REM
  64. REM now binplace LDO files into the build
  65. REM
  66. echo "Binplacing LDO files ..."
  67. REM Build place file
  68. for /f %%a in ('dir /b /a-d %LDO_PICKUP_SITE%') do (
  69. echo %%a
  70. echo %%a retail>>%LDO_PICKUP_SITE%\priv_place.txt
  71. )
  72. set BinplaceCmd=binplace -R %_NTPOSTBLD% -p %LDO_PICKUP_SITE%\priv_place.txt
  73. set /a LdoFileCount=0
  74. for /f %%a in ('dir /a-d /b %LDO_PICKUP_SITE%\*.ldo') do (
  75. %BinplaceCmd% %LDO_PICKUP_SITE%\%%a
  76. if !ErrorLevel! NEQ 0 (
  77. echo "Failed to binplace %LDO_PICKUP_SITE%\%%a"
  78. set /a ErrorCount=!ErrorCount! + 1
  79. ) else (
  80. set /a LdoFileCount=!LdoFileCount! + 1
  81. )
  82. )
  83. REM if there were errors at this point, say so, but continue
  84. if !ErrorCount! NEQ 0 (
  85. echo "Errors encountered, but script completed ..."
  86. )
  87. REM success
  88. echo "%LdoFileCount% files were binplaced."
  89. REM finished
  90. echo "Finished."
  91. goto :End
  92. :Usage
  93. echo Usage: %0 LDO_file_location
  94. echo.
  95. echo This tool will copy ldo files for Freestyle managed code binaries
  96. echo into the build.
  97. echo.
  98. REM set ErrorCount=1
  99. goto :End
  100. :ErrEnd
  101. if "!ErrorCount!" == "0" (
  102. set /a ErrorCount=!ErrorCount! + 1
  103. )
  104. goto :End
  105. :End
  106. if "!ErrorCount!" NEQ "0" (
  107. echo "encountered !ErrorCount! error(s)"
  108. ) else (
  109. echo "success."
  110. )
  111. endlocal & goto :EOF