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.

182 lines
4.3 KiB

  1. @REM -----------------------------------------------------------------
  2. @REM
  3. @REM Cmbins.cmd - QuintinB
  4. @REM Create an iexpress self-extracting EXE (Cmbins.exe) from the
  5. @REM CM binaries built during the build
  6. @REM
  7. @REM Copyright 2001 (c) Microsoft Corporation. All rights reserved.
  8. @REM
  9. @REM -----------------------------------------------------------------
  10. @if NOT defined HOST_PROCESSOR_ARCHITECTURE set HOST_PROCESSOR_ARCHITECTURE=%PROCESSOR_ARCHITECTURE%
  11. @if defined _CPCMAGIC goto CPCBegin
  12. @perl -x "%~f0" %*
  13. @goto :EOF
  14. #!perl
  15. use strict;
  16. use lib $ENV{RAZZLETOOLPATH} . "\\PostBuildScripts";
  17. use lib $ENV{RAZZLETOOLPATH};
  18. use PbuildEnv;
  19. use ParseArgs;
  20. sub Usage { print<<USAGE; exit(1) }
  21. Cmbins.cmd
  22. contact: Quintinb or CmDev
  23. Make Cmbins.exe (Binary cabinet used by Connection Manager Administration Kit)
  24. USAGE
  25. parseargs('?' => \&Usage, 'p' =>\$ENV{PRS});
  26. # *** TEMPLATE CODE ***
  27. $ENV{"_CPCMAGIC"}++;exit(system($0)>>8);
  28. __END__
  29. @:CPCBegin
  30. @set _CPCMAGIC=
  31. @setlocal ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
  32. @if not defined DEBUG echo off
  33. @REM *** CMD SCRIPT BELOW ***
  34. REM
  35. REM Nothing to do on ia64 as cmbins.exe is only needed on x86. Just exit happily.
  36. REM
  37. if /i "%_BuildArch%" == "ia64" (
  38. call logmsg.cmd "Nothing to do on IA64 => Cmbins.cmd completed successfully"
  39. popd& goto :EOF
  40. )
  41. if /i "%Prs%" == "1" (
  42. call LogMsg.cmd "-p switch specified - just rebuilding cmbins.exe for PRS signing"
  43. pushd %_NTPostBld%\cmbins
  44. goto :JustRebuild
  45. )
  46. REM
  47. REM go to our cab directory
  48. REM
  49. rd /q /s %_NTPostBld%\cmbins
  50. md %_NTPostBld%\cmbins
  51. pushd %_NTPostBld%\cmbins
  52. REM
  53. REM Now, copy all of the files we need from %_NTPostBld% to %_NTPostBld%\cmbins
  54. REM
  55. for %%i in (
  56. ccfgnt.dll
  57. cmcfg32.dll
  58. cmdial32.dll
  59. cmdl32.exe
  60. cmmgr32.exe
  61. cmmgr32.hlp
  62. cmmon32.exe
  63. cmpbk32.dll
  64. cmstp.exe
  65. cmutil.dll
  66. cnetcfg.dll
  67. cmexcept.inf
  68. ) do (
  69. copy /y %_NTPostBld%\%%i %_NTPostBld%\cmbins\%%i
  70. if errorlevel 1 (
  71. call errmsg.cmd "File %_NTPostBld%\%%i not found."
  72. popd& goto :EOF
  73. )
  74. )
  75. REM
  76. REM Sign the binaries
  77. REM
  78. call deltacat.cmd /5.0 %_NTPostBld%\cmbins
  79. if not exist %_NTPostBld%\cmbins\delta.cat (
  80. call errmsg.cmd "File %_NTPostBld%\cmbins\delta.cat not found. Deltacat failed."
  81. popd& goto :EOF
  82. )
  83. REM
  84. REM Ren delta.cat to cmexcept.cat
  85. REM
  86. if exist %_NTPostBld%\cmbins\cmexcept.cat del /f %_NTPostBld%\cmbins\cmexcept.cat
  87. ren %_NTPostBld%\cmbins\delta.cat cmexcept.cat
  88. if errorlevel 1 goto :EOF
  89. REM
  90. REM Copy in cmbins.sed
  91. REM
  92. copy /y %_NTPostBld%\cmbins.SED %_NTPostBld%\cmbins\cmbins.SED
  93. if errorlevel 1 (
  94. call errmsg.cmd "File %_NTPostBld%\cmbins.SED not found."
  95. popd& goto :EOF
  96. )
  97. REM
  98. REM Here is where we will jump if we are called for PRS signing (-p switch)
  99. REM
  100. :JustRebuild
  101. REM
  102. REM Create cmbins.exe.
  103. REM As iexpress.exe does not set errorlevel in all error cases,
  104. REM base verification on cmbins.exe's existence.
  105. REM
  106. if exist .\cmbins.exe call ExecuteCmd.cmd "del /f cmbins.exe"
  107. if errorlevel 1 goto :EOF
  108. REM
  109. REM Munge the path so we use the correct wextract.exe to build the package with...
  110. REM NOTE: We *want* to use the one we just built (and for Intl localized)!
  111. REM
  112. set _NEW_PATH_TO_PREPEND=%RazzleToolPath%\%HOST_PROCESSOR_ARCHITECTURE%\loc\%LANG%
  113. set _OLD_PATH_BEFORE_PREPENDING=%PATH%
  114. set PATH=%_NEW_PATH_TO_PREPEND%;%PATH%
  115. call ExecuteCmd.cmd "start /wait iexpress.exe /M /N /Q cmbins.sed"
  116. REM
  117. REM Return the path to what it was before...
  118. REM
  119. set PATH=%_OLD_PATH_BEFORE_PREPENDING%
  120. if not exist cmbins.exe (
  121. call errmsg.cmd "iexpress.exe cmbins.sed failed."
  122. popd& goto :EOF
  123. )
  124. REM
  125. REM Copy cmbins.exe to %_NTPostBld%
  126. REM
  127. copy /y %_NTPostBld%\cmbins\cmbins.exe %_NTPostBld%\cmbins.exe
  128. if errorlevel 1 (
  129. call errmsg.cmd "unable to copy %_NTPostBld%\cmbins\cmbins.exe to %_NTPostBld%\cmbins.exe"
  130. popd& goto :EOF
  131. )
  132. REM
  133. REM Copy cmexcept.cat to %_NTPostBld%
  134. REM
  135. copy /y %_NTPostBld%\cmbins\cmexcept.cat %_NTPostBld%\cmexcept.cat
  136. if errorlevel 1 (
  137. call errmsg.cmd "unable to copy %_NTPostBld%\cmbins\cmexcept.cat to %_NTPostBld%\cmexcept.cat0"
  138. popd& goto :EOF
  139. )
  140. call logmsg.cmd "Cmbins.cmd completed successfully"
  141. popd