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.

149 lines
4.2 KiB

  1. @REM -----------------------------------------------------------------
  2. @REM
  3. @REM MkTabCab.cmd - dougpa
  4. @REM Generate TabletPC.cab file.
  5. @REM
  6. @REM Copyright (c) Microsoft Corporation. All rights reserved.
  7. @REM
  8. @REM -----------------------------------------------------------------
  9. @if NOT defined HOST_PROCESSOR_ARCHITECTURE set HOST_PROCESSOR_ARCHITECTURE=%PROCESSOR_ARCHITECTURE%
  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. MkTabCab.cmd [-l <language>]
  21. This sript creates TabletPC.cab. This cabinet contains files which
  22. are only installed on Windows XP TabletPC edition.
  23. USAGE
  24. parseargs('?' => \&Usage);
  25. # *** TEMPLATE CODE ***
  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 Only build this .cab for x86
  33. if not defined x86 goto :End
  34. perl %RazzleToolPath%\cksku.pm -t:pro -l:%lang%
  35. if errorlevel 1 (
  36. goto :End
  37. )
  38. call logmsg.cmd "MkTabCab: Start TabletPC postbuild..."
  39. @REM
  40. @REM Use Iexpress.exe to generate the .cab
  41. @REM
  42. @REM First, update the sed with the correct PostBuild directory.
  43. REM
  44. set DoubledPath=%_NTPostBld:\=\\%
  45. set NewSedFile=%Temp%\TabletPC.sed
  46. if exist %NewSedFile% del /f %NewSedFile%
  47. perl -n -e "s/_NTPOSTBLD/%DoubledPath%/g;print $_;" < %_NTPostBld%\TabletPC.sed > %NewSedFile%
  48. if not exist %NewSedFile% (
  49. call errmsg.cmd "File %NewSedFile% not found."
  50. goto :End
  51. )
  52. @REM
  53. @REM Generate TabletPC.cat
  54. REM
  55. set TabletPCTmp=%_NTPostBld%\TabletPC.tmp
  56. rd /s /q %TabletPCTmp%
  57. md %TabletPCTmp%
  58. set SourceFiles0=%_NTPOSTBLD%
  59. set SourceFiles1=%_NTPOSTBLD%
  60. if defined LANG if /i not "%LANG%"=="usa" set SourceFiles1=%_NTPOSTBLD%\%LANG%
  61. if defined LANGUAGE if /i not "%LANGUAGE%"=="usa" set SourceFiles1=%_NTPOSTBLD%\%LANGUAGE%
  62. set set SourceDir=%SourceFiles0%
  63. set CopyFile=
  64. for /f "tokens=1" %%a in (%NewSedFile%) do (
  65. if /i "%%a"=="[SourceFiles0]" (
  66. set CopyFile=1
  67. set SourceDir=%SourceFiles0%
  68. ) else (
  69. if /i "%%a"=="[SourceFiles1]" (
  70. set CopyFile=1
  71. set SourceDir=%SourceFiles1%
  72. ) else (
  73. if /i "!copyFile!"=="1" (
  74. set File=%%a
  75. set File=!File:~0,-1!
  76. copy /y !SourceDir!\!File! %TabletPCTmp%\!File!
  77. if errorlevel 1 (
  78. call errmsg.cmd "Could not copy %_NTPostBld%\!File!"
  79. set CopyErrors=1
  80. )
  81. )
  82. )
  83. )
  84. )
  85. if defined CopyErrors goto :End
  86. call deltacat %TabletPCTmp%
  87. if not exist %TabletPCTmp%\delta.cat (
  88. call errmsg.cmd "Could not find %TabletPCTmp%\delta.cat> Deltacat failed."
  89. goto :End
  90. )
  91. if exist %TabletPCTmp%\TabletPC.cat del /f /q %TabletPCTmp%\tabletpc.cat
  92. ren %TabletPCTmp%\Delta.cat TabletPC.cat
  93. if errorlevel 1 (
  94. call errmsg.cmd "Could not rename delta.cat to TabletPC.cat"
  95. goto :End
  96. )
  97. copy %TabletPCTmp%\TabletPC.cat %_NTPostBld%\TabletPC.cat
  98. if errorlevel 1 (
  99. call errmsg.cmd "Could not copy %TabletPCTmp%\TabletPC.cat to %_NTPostBld%"
  100. goto :End
  101. )
  102. REM
  103. REM Now generated TabletPC.cab
  104. REM
  105. if exist %_NTPostBld%\TabletPC.cab del /f %_NTPostBld%\TabletPC.cab
  106. REM
  107. REM Munge the path so we use the correct wextract.exe to build the package with...
  108. REM NOTE: We *want* to use the one we just built (and for Intl localized)!
  109. REM
  110. set _NEW_PATH_TO_PREPEND=%RazzleToolPath%\%HOST_PROCESSOR_ARCHITECTURE%\loc\%LANG%
  111. set _OLD_PATH_BEFORE_PREPENDING=%PATH%
  112. set PATH=%_NEW_PATH_TO_PREPEND%;%PATH%
  113. call ExecuteCmd.cmd "start /min /wait iexpress.exe /M /N /Q %NewSedFile%"
  114. REM
  115. REM Return the path to what it was before...
  116. REM
  117. set PATH=%_OLD_PATH_BEFORE_PREPENDING%
  118. if not exist %_NtPostBld%\TabletPC.cab (
  119. call errmsg.cmd "IExpress.exe failed on %NewSedFile%. One or more files may be missing."
  120. goto :End
  121. )
  122. :End
  123. if defined TabletPCTmp if exist %TabletPCTmp% rd /s /q %TabletPCTmp%
  124. if "%errors%" == "" set errors=0
  125. seterror.exe %errors%& goto :EOF