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.

114 lines
4.3 KiB

  1. @REM -----------------------------------------------------------------
  2. @REM
  3. @REM SwapInOriginalFiles.cmd - WadeLa
  4. @REM swap in original, unprocessed files before rebasing. Allows
  5. @REM incremental postbuild to work
  6. @REM
  7. @REM Copyright (c) Microsoft Corporation. All rights reserved.
  8. @REM
  9. @REM -----------------------------------------------------------------
  10. @if defined _CPCMAGIC goto CPCBegin
  11. @perl -x "%~f0" %*
  12. @goto :EOF
  13. #!perl
  14. use strict;
  15. use lib $ENV{RAZZLETOOLPATH} . "\\PostBuildScripts";
  16. use lib $ENV{RAZZLETOOLPATH};
  17. use PbuildEnv;
  18. use ParseArgs;
  19. sub Usage { print<<USAGE; exit(1) }
  20. SwapInOriginalFiles [-l <language>]
  21. Swap in original, unprocessed files before rebasing. Allows incremental
  22. postbuild to work.
  23. USAGE
  24. parseargs('?' => \&Usage);
  25. # *** NEXT FEW LINES ARE TEMPLATE ***
  26. $ENV{"_CPCMAGIC"}++;exit(system($0)>>8);
  27. __END__
  28. :CPCBegin
  29. set _CPCMAGIC=
  30. setlocal ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
  31. @if not defined DEBUG echo off
  32. REM *** BEGIN YOUR CMD SCRIPT BELOW ***
  33. REM Swap in unprocessed files so that rebase won't rebase them, thus allowing incremental postbuild
  34. REM to work.
  35. if /i NOT "%lang%" == "usa" goto :EOF
  36. set AlternateDir=prerebase
  37. set FakeSymbolName=sym
  38. set SymbolDirs=dll exe
  39. set BinFile=%_NTPostBld%\build_logs\build.binlist
  40. set SwapDir=%_NTPostBld%\SwapFiles
  41. set SwapSymbolDllDir=%_NTPostBld%\%AlternateDir%\%FakeSymbolName%\dll
  42. set SwapSymbolExeDir=%_NTPostBld%\%AlternateDir%\%FakeSymbolName%\exe
  43. set SymbolDllDir=%_NTPostBld%\symbols.pri\retail\dll
  44. set SymbolExeDir=%_NTPostBld%\symbols.pri\retail\exe
  45. set SwapList=termdd.sys tdpipe.sys
  46. set SwapList=%SwapList% tdtcp.sys tsddd.dll rdpdd.dll rdpwd.sys rdpwsx.dll
  47. if NOT "%_BuildArch%" == "x86" goto NoScpP
  48. set SwapList=%SwapList% winlogon.exe licdll.dll licwmi.dll
  49. rem
  50. rem the symbols for instrumented binaries have a different name
  51. rem This should relly get the PDB name using getpdbname.exe
  52. rem so it works w/o change when instrumenation is added/removed from other files
  53. rem
  54. if defined _COVERAGE_BUILD (
  55. set SwapSymbolDllList=licdll.dll.instr.pdb licwmi.dll.instr.pdb
  56. set SwapSymbolExeList=winlogon.exe.instr.pdb
  57. ) else (
  58. set SwapSymbolDllList=licdll.pdb licwmi.pdb
  59. set SwapSymbolExeList=winlogon.pdb
  60. )
  61. :NoScp
  62. REM First off, rename the symbols directory so that populatefromvbl
  63. REM won't filter out the symbols. Do not do this on machines running populatefromvbl
  64. if exist %_NTPostBld%\symbols.pri\%AlternateDir% (
  65. if not exist %AlternateDir%\%FakeSymbolName% md %AlternateDir%\%FakeSymbolName%
  66. for %%a in (%SymbolDirs%) do (
  67. if exist %_NTPostBld%\symbols.pri\%AlternateDir%\%%a (
  68. if not exist %_NTPostBld%\%AlternateDir%\%FakeSymbolName%\%%a call executecmd.cmd "md %_NTPostBld%\%AlternateDir%\%FakeSymbolName%\%%a"
  69. call executecmd.cmd "copy %_NTPostBld%\symbols.pri\%AlternateDir%\%%a\*.* %_NTPostBld%\%AlternateDir%\%FakeSymbolName%\%%a\*.*"
  70. )
  71. )
  72. )
  73. REM Now fake out populatefromvbl by adding these lines to build.binlist
  74. dir /b /s /a-d %_NTPostBld%\%AlternateDir%\%FakeSymbolName% >> %BinFile%
  75. REM Copy in the alternate directory to binaries
  76. for %%a in (%SwapList%) do call executecmd.cmd "copy %_NTPostBld%\%AlternateDir%\%%a %_NTPostBld%"
  77. if not exist %SymbolDllDir% md %SymbolDllDir%
  78. for %%a in (%SwapSymbolDllList%) do call executecmd.cmd "copy %SwapSymbolDllDir%\%%a %SymbolDllDir%"
  79. if not exist %SymbolExeDir% md %SymbolExeDir%
  80. for %%a in (%SwapSymbolExeList%) do call executecmd.cmd "copy %SwapSymbolExeDir%\%%a %SymbolExeDir%"
  81. rem
  82. rem This script should really create public symbols for the bins & place them in the right location
  83. rem it gets away with not doing it if the binary/symbols get modified then the script which modifies it handled the
  84. rem update
  85. rem
  86. rem For coverage builds we will copy the private symbols into the pub dir so symbolcd.cmd passes.
  87. rem
  88. if not defined _COVERAGE_BUILD goto :EOF
  89. set PubSymbolDllDir=%_NTPostBld%\symbols\retail\dll
  90. set PubSymbolExeDir=%_NTPostBld%\symbols\retail\exe
  91. if not exist %PubSymbolDllDir% md %SymbolDllDir%
  92. for %%a in (%SwapSymbolDllList%) do call executecmd.cmd "copy %SwapSymbolDllDir%\%%a %PubSymbolDllDir%"
  93. if not exist %PubSymbolExeDir% md %SymbolExeDir%
  94. for %%a in (%SwapSymbolExeList%) do call executecmd.cmd "copy %SwapSymbolExeDir%\%%a %PubSymbolExeDir%"