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.

130 lines
4.3 KiB

  1. @REM -----------------------------------------------------------------
  2. @REM
  3. @REM bindsys.cmd - BryanT, BPerkins
  4. @REM Binds the NT system binaries
  5. @REM
  6. @REM Copyright (c) Microsoft Corporation. All rights reserved.
  7. @REM
  8. @REM -----------------------------------------------------------------
  9. @if defined _CPCMAGIC goto CPCBegin
  10. @perl -x "%~f0" %*
  11. @goto :EOF
  12. #!perl
  13. use strict;
  14. use lib $ENV{RAZZLETOOLPATH} . "\\PostBuildScripts";
  15. use lib $ENV{RAZZLETOOLPATH};
  16. use PbuildEnv;
  17. use ParseArgs;
  18. sub Usage { print<<USAGE; exit(1) }
  19. $ENV{SCRIPT_NAME} [-l <language]
  20. Binds the NT binaries. Run during postbuild.
  21. USAGE
  22. parseargs('?' => \&Usage);
  23. # *** TEMPLATE CODE ***
  24. $ENV{"_CPCMAGIC"}++;exit(system($0)>>8);
  25. __END__
  26. @:CPCBegin
  27. @set _CPCMAGIC=
  28. @setlocal ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
  29. @if not defined DEBUG echo off
  30. @REM *** CMD SCRIPT BELOW ***
  31. REM REM Don't bind on incremental
  32. REM if NOT defined SafePass (
  33. REM if exist %_NTPostBld%\build_logs\bindiff.txt (
  34. REM call logmsg.cmd "Don't bind on incremental for now."
  35. REM goto :EOF
  36. REM )
  37. REM )
  38. :OK
  39. REM ---------------------------------------------------------------------------
  40. REM BINDSYS.CMD - bind the NT binaries
  41. REM
  42. REM ---------------------------------------------------------------------------
  43. if "%_NTPostBld%" == "" echo _NTPostBld not defined && goto :EOF
  44. set _BIND_LOG=%_NTPostBld%\build_logs\bind.log
  45. set _BIND_LOG_BAK=%_NTPostBld%\build_logs\"bind.bak-%DATE:/=.% %TIME::=.%"
  46. set _BIND_LOG_BAK=%_BIND_LOG_BAK: =_%
  47. if exist %_BIND_LOG% copy %_BIND_LOG% %_BIND_LOG_BAK%
  48. erase %_BIND_LOG%
  49. REM
  50. REM To work around imagehlp::BindImageEx/ImageLoad's assumption of . being in the path,
  51. REM we must not be sitting in the binaries directory, so that asms\...\comctl32.dll can
  52. REM beat retail\comctl32.dll. We must list %binplacedir%; explicitly in many paths
  53. REM where before we did not.
  54. REM
  55. REM As well, we don't want to be in some random directory that contains .dlls, like
  56. REM %windir%\system32 or %sdxroot%\tools\x86
  57. REM
  58. REM presumably no .dlls in build_logs
  59. REM
  60. pushd %_NTPostBld%\build_logs
  61. REM ------------------------------------------------
  62. REM Exclude these crypto binaries:
  63. REM ------------------------------------------------
  64. set ExcludeExe=ntoskrnl ntkrnlmp ntkrnlpa ntkrpamp
  65. set Excludedll= gpkcsp rsaenh dssenh
  66. set ExcludeDll=%ExcludeDll% slbcsp sccbase
  67. set ExcludeDll=%ExcludeDll% disdnci disdnsu
  68. set ExcludeDll=%ExcludeDll% scrdaxp scrdenrl scrdsign scrdx86
  69. set ExcludeDll=%ExcludeDll% xenraxp xenroll xenrsign xenrx86
  70. set ExcludeDirs=netfx win9xupg win9xmig winnt32 asms
  71. REM
  72. REM Bind TO asms, even in non usa builds..
  73. REM
  74. set asmspath=
  75. set asmspath=%asmspath%;%_NTPostBld%\asms\6010\msft\windows\common\controls
  76. set asmspath=%asmspath%;%_NTPostBld%\asms\1010\msft\windows\gdiplus
  77. :CalculateBindTargets
  78. set BindList=%_NTPostBld%\build_logs\bind.targets.txt
  79. if exist %BindList% del %BindList%
  80. for %%i in (drv cpl scr ocx acm ax tsp) do @(
  81. for /f %%x in ('findstr /v "%ExcludeDirs%" %_NTPostBld%\congeal_scripts\exts\%%i_files.lst ^| sort') do @(
  82. echo %_NTPostBld%\%%x>>%BindList%
  83. )
  84. )
  85. for %%i in (exe) do @(
  86. for /f %%x in ('findstr /v "%ExcludeExe% %ExcludeDirs%" %_NTPostBld%\congeal_scripts\exts\%%i_files.lst ^| sort') do @(
  87. echo %_NTPostBld%\%%x>>%BindList%
  88. )
  89. )
  90. for %%i in (dll) do @(
  91. for /f %%x in ('findstr /v "%ExcludeDll% %ExcludeDirs%" %_NTPostBld%\congeal_scripts\exts\%%i_files.lst ^| sort') do @(
  92. echo %_NTPostBld%\%%x>>%BindList%
  93. )
  94. )
  95. bind.exe -u -s %_NTPostBld%\Symbols\retail -p %asmspath%;%_NTPostBld%;%_NTPostBld%\lang @%BindList% >> %_BIND_LOG% 2>&1
  96. REM
  97. REM ..but only bind FROM asms for usa builds.
  98. REM
  99. REM Don't bind asms for now.
  100. REM We must only bind the ones we build, not the "frozen" ones.
  101. REM Ones we build can be identified either by their presences in binplace.log-sxs, or by their .dlls
  102. REM having a version that matches the build number, at least in the third part (ie: msvcrt.dll only matches
  103. REM in the third part.)
  104. REM
  105. REM if /i "%LANG%" equ "usa" for /f %%i in ('dir /s/b/ad %_NTPostBld%\asms') do Bind -u -s %_NTPostBld%\Symbols\retail -p %asmspath%;%_NTPostBld% %%i\*.dll
  106. popd