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.

206 lines
5.7 KiB

  1. @REM -----------------------------------------------------------------
  2. @REM
  3. @REM migwiz.cmd - JThaler, CalinN
  4. @REM This will call iexpress to generate a self-extracting CAB that
  5. @REM will be used when running our tool off the installation CD's
  6. @REM tools menu.
  7. @REM This also copies shfolder.dll into valueadd/msft/usmt
  8. @REM for use in our command line distribution
  9. @REM
  10. @REM Copyright (c) Microsoft Corporation. All rights reserved.
  11. @REM
  12. @REM -----------------------------------------------------------------
  13. @if NOT defined HOST_PROCESSOR_ARCHITECTURE set HOST_PROCESSOR_ARCHITECTURE=%PROCESSOR_ARCHITECTURE%
  14. @if defined _CPCMAGIC goto CPCBegin
  15. @perl -x "%~f0" %*
  16. @goto :EOF
  17. #!perl
  18. use strict;
  19. use lib $ENV{RAZZLETOOLPATH} . "\\PostBuildScripts";
  20. use lib $ENV{RAZZLETOOLPATH};
  21. use PbuildEnv;
  22. use ParseArgs;
  23. sub Usage { print<<USAGE; exit(1) }
  24. migwiz.cmd [-l <language>]
  25. This is for the Files and Settings Transfer Wizard (aka Migration
  26. Wizard, or migwiz). It will do:
  27. 1. run iexpress to generate a self-extracting CAB and install
  28. into support\tools.
  29. 2. copy shfolder.dll into valueadd\\msft\\usmt for distribution
  30. with the command line tool.
  31. 3. prepare a valueadd\\msft\\usmt\\ansi directory (ANSI version of
  32. the tool) with binaries from valueadd\\msft\\usmt
  33. Currently (for .NET Server) #1 is disabled
  34. USAGE
  35. parseargs('?' => \&Usage);
  36. # *** NEXT FEW LINES ARE TEMPLATE ***
  37. $ENV{"_CPCMAGIC"}++;exit(system($0)>>8);
  38. __END__
  39. :CPCBegin
  40. set _CPCMAGIC=
  41. setlocal ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
  42. REM *** BEGIN YOUR CMD SCRIPT BELOW ***
  43. REM
  44. REM x86 only!
  45. REM
  46. if not defined x86 goto end
  47. REM temporarily create the migwiz.exe.manifest file
  48. call ExecuteCmd.cmd "copy /Y %_NtPostBld%\migwiz.man %_NtPostBld%\migwiz.exe.manifest"
  49. REM
  50. REM For .NET Server we are not going to create the selfextract EXE.
  51. REM
  52. goto skipcab
  53. REM
  54. REM Use iexpress.exe to generate the self-extracting executable;
  55. REM
  56. set doubledpath=%_NtPostBld:\=\\%
  57. REM build the CAB that is placed inside the exe
  58. REM first update the sed with the proper binaries directory
  59. set migcab.sed=%temp%\migcab.sed
  60. perl -n -e "s/BINARIES_DIR/%doubledpath%/g;print $_;" < %_NtPostBld%\migcab.sed > %migcab.sed%
  61. REM call iexpress on the new sed
  62. if not exist %migcab.sed% (
  63. call errmsg.cmd "File %migcab.sed% not found."
  64. popd& goto end
  65. )
  66. if exist %_NtPostBld%\migwiz.cab del /f %_NtPostBld%\migwiz.cab
  67. REM
  68. REM Munge the path so we use the correct wextract.exe to build the package with...
  69. REM NOTE: We *want* to use the one we just built (and for Intl localized)!
  70. REM
  71. set _NEW_PATH_TO_PREPEND=%RazzleToolPath%\%HOST_PROCESSOR_ARCHITECTURE%\loc\%LANG%
  72. set _OLD_PATH_BEFORE_PREPENDING=%PATH%
  73. set PATH=%_NEW_PATH_TO_PREPEND%;%PATH%
  74. call ExecuteCmd.cmd "start /min /wait iexpress.exe /M /N /Q %migcab.sed%"
  75. REM
  76. REM Return the path to what it was before...
  77. REM
  78. set PATH=%_OLD_PATH_BEFORE_PREPENDING%
  79. if not exist %_NtPostBld%\migwiz.cab (
  80. call errmsg.cmd "IExpress.exe failed on %migcab.sed%."
  81. popd& goto end
  82. )
  83. REM Now build the self-extracting EXE
  84. REM first update the sed with the proper binaries directory
  85. set migwiz.sed=%temp%\migwiz.sed
  86. perl -n -e "s/BINARIES_DIR/%doubledpath%/g;print $_;" < %_NtPostBld%\migwiz.sed > %migwiz.sed%
  87. REM call iexpress on the new sed
  88. if not exist %migwiz.sed% (
  89. call errmsg.cmd "File %migwiz.sed% not found."
  90. popd& goto end
  91. )
  92. set outpath=%_NTPostBld%\support\tools
  93. if exist %outpath%\fastwiz.exe del /f %outpath%\fastwiz.exe
  94. REM
  95. REM Munge the path so we use the correct wextract.exe to build the package with...
  96. REM NOTE: We *want* to use the one we just built (and for Intl localized)!
  97. REM
  98. set _NEW_PATH_TO_PREPEND=%RazzleToolPath%\%HOST_PROCESSOR_ARCHITECTURE%\loc\%LANG%
  99. set _OLD_PATH_BEFORE_PREPENDING=%PATH%
  100. set PATH=%_NEW_PATH_TO_PREPEND%;%PATH%
  101. call ExecuteCmd.cmd "start /min /wait iexpress.exe /M /N /Q %migwiz.sed%"
  102. REM
  103. REM Return the path to what it was before...
  104. REM
  105. set PATH=%_OLD_PATH_BEFORE_PREPENDING%
  106. if not exist %outpath%\fastwiz.exe (
  107. call errmsg.cmd "IExpress.exe failed on %migwiz.sed%."
  108. popd& goto end
  109. )
  110. popd
  111. :skipcab
  112. REM
  113. REM Now copy shfolder.dll into the loadstate/scanstate distribution
  114. REM
  115. set shfolder.dll=%_NTPostBld%\shfolder.dll
  116. if not exist %shfolder.dll% (
  117. call errmsg.cmd "File %shfolder.dll% not found."
  118. goto end
  119. )
  120. if exist %_NTPostBld%\valueadd\msft\usmt\shfolder.dll del /f %_NTPostBld%\valueadd\msft\usmt\shfolder.dll
  121. call ExecuteCmd.cmd "xcopy /fd /Y %shfolder.dll% %_NTPostBld%\valueadd\msft\usmt\"
  122. REM
  123. REM create the ansi subdirectory inside valueadd\msft\usmt
  124. REM
  125. set valueadd=%_NTPostBld%\valueadd\msft\usmt
  126. set ansidir=%valueadd%\ansi
  127. if exist %ansidir% rd /q /s %ansidir%
  128. call ExecuteCmd.cmd "xcopy /fd /i /Y %valueadd%\*.inf %ansidir%"
  129. call ExecuteCmd.cmd "xcopy /fd /i /Y %valueadd%\iconlib.dll %ansidir%"
  130. call ExecuteCmd.cmd "xcopy /fd /i /Y %valueadd%\log.dll %ansidir%"
  131. call ExecuteCmd.cmd "xcopy /fd /i /Y %valueadd%\shfolder.dll %ansidir%"
  132. REM
  133. REM Hey guess what? I can't MOVE stuff, or it'll break PopulateFromVBL
  134. REM Either binplace to the final destination or use [x]copy
  135. REM
  136. call ExecuteCmd.cmd "copy /Y %valueadd%\scanstate_a.exe %ansidir%\scanstate.exe"
  137. call ExecuteCmd.cmd "copy /Y %valueadd%\migism_a.dll %ansidir%\migism.dll"
  138. call ExecuteCmd.cmd "copy /Y %valueadd%\script_a.dll %ansidir%\script.dll"
  139. call ExecuteCmd.cmd "copy /Y %valueadd%\sysmod_a.dll %ansidir%\sysmod.dll"
  140. call ExecuteCmd.cmd "copy /Y %valueadd%\unctrn_a.dll %ansidir%\unctrn.dll"
  141. :end
  142. if exist %_NtPostBld%\migwiz.exe.manifest del /f %_NtPostBld%\migwiz.exe.manifest
  143. seterror.exe "%errors%"& goto :EOF