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.

193 lines
8.0 KiB

  1. @REM -----------------------------------------------------------------
  2. @REM
  3. @REM shimbind.cmd - AEDev
  4. @REM Binds the appcompat shims
  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. shimbind [-l <language>]
  21. Binds the appcompat shims
  22. USAGE
  23. parseargs('?' => \&Usage);
  24. # *** TEMPLATE CODE ***
  25. $ENV{"_CPCMAGIC"}++;exit(system($0)>>8);
  26. __END__
  27. @:CPCBegin
  28. @set _CPCMAGIC=
  29. @setlocal ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
  30. @if not defined DEBUG echo off
  31. @REM *** CMD SCRIPT BELOW ***
  32. REM Incremental check
  33. set Bindiff=%_NTPostBld%\build_logs\bindiff.txt
  34. set Inputs=driver.xml dbu.xml apphelp.xml apphelpu.xml secdrv.sys
  35. if exist %Bindiff% (
  36. set ChangedInputs=0
  37. for %%a in (%Inputs%) do (
  38. findstr /ilc:"%_NTPostBld%\shimdll\%%a" %BinDiff%
  39. if /i "!ErrorLevel!" == "0" set /a ChangedInputs=!ChangedInputs! + 1
  40. )
  41. if !ChangedInputs! EQU 0 (
  42. @echo Skipping - No inputs changed
  43. goto :IncrementalSkip
  44. )
  45. )
  46. pushd %_NTPostBld%\shimdll
  47. md drvmain
  48. set _SLANG=%LANG%
  49. if /I "%LANG%" equ "USA" goto :LANGOK
  50. set APPHELPU=APPHELPU.XML
  51. unitext.exe /z %_NTPOSTBLD%\SHIMDLL\%APPHELPU% %TEMP%\%APPHELPU% 2>NUL 1>NUL
  52. if not exist %TEMP%\%APPHELPU% goto :LD
  53. SET LANGID=
  54. SET LTAG=
  55. SET DATA=
  56. SET LTOK=
  57. SET LATTR=
  58. FOR /F "tokens=* delims==" %%. in ('findstr /irc:"\< *<DATABASE NAME=.*> *\>" %TEMP%\%APPHELPU%') do @set LTAG=%%.
  59. set LTAG=!LTAG:^<=!
  60. set LTAG=!LTAG:^>=!
  61. :LC
  62. IF /I "_!LTAG!_"=="__" GOTO :LX
  63. FOR /F "tokens=1,* delims= " %%i in ('ECHO !LTAG!') do @set LTAG=%%j&set LATTR=%%i
  64. SET LTOK=
  65. FOR /F "tokens=1,2 DELIMS==" %%K in ('echo !LATTR!') do @(
  66. IF /I "%%K"=="LANGID" set LTOK=%%L)
  67. IF /I NOT "_!LTOK!_"=="__" GOTO :LX
  68. goto LC
  69. :LX
  70. IF /I "_!LTOK!_"=="__" GOTO :LD
  71. FOR /F "tokens=1" %%. in ('echo !LTOK!') DO @set DATA=%%.
  72. SET _SLANG=%DATA:"=%
  73. IF /I "_!_SLANG!_"=="__" GOTO :LD
  74. GOTO :LOK
  75. :LD
  76. SET _SLANG=USA
  77. :LOK
  78. echo setting LANG="%_SLANG%"
  79. :LANGOK
  80. if /I "%LANG%" equ "PSU" (set _SLANG=USA)
  81. if /I "%LANG%" equ "psu" (set _SLANG=USA)
  82. if /I "%LANG%" equ "FE" (set _SLANG=USA)
  83. if /I "%LANG%" equ "fe" (set _SLANG=USA)
  84. if /I "%LANG%" equ "MIR" (set _SLANG=USA)
  85. if /I "%LANG%" equ "mir" (set _SLANG=USA)
  86. if "%ia64%" neq "1" goto buildX86
  87. call ExecuteCmd.cmd "shimdbc custom -l %_SLANG% -op IA64 -ov 5.1 -x makefile.xml"
  88. goto buildCont
  89. :buildX86
  90. call ExecuteCmd.cmd "shimdbc custom -l %_SLANG% -ov 5.1 -x makefile.xml"
  91. :buildCont
  92. set RegSvr_Name=regsvr32.exe
  93. if "%HOST_PROCESSOR_ARCHITECTURE%" neq "x86" set RegSvr_Name=%windir%\syswow64\%RegSvr_Name%
  94. call ExecuteCmd.cmd "%RegSvr_Name% /s itcc.dll"
  95. set RegSvr_Name=
  96. %_NTPostBld%\shimdll\hhc apps.hhp
  97. pushd %_NTPostBld%\shimdll\drvmain
  98. %_NTPostBld%\shimdll\hhc drvmain.hhp
  99. popd
  100. call ExecuteCmd.cmd "copy sysmain.sdb %_NTPostBld%"
  101. call ExecuteCmd.cmd "copy apphelp.sdb %_NTPostBld%"
  102. call ExecuteCmd.cmd "copy msimain.sdb %_NTPostBld%"
  103. call ExecuteCmd.cmd "copy drvmain.sdb %_NTPostBld%"
  104. call ExecuteCmd.cmd "copy apps.chm %_NTPostBld%"
  105. REM Copy HTMs to ASPs for microsoft.com propogation...
  106. md ASPs
  107. call ExecuteCmd.cmd "copy /y /b idh*.htm ASPs\*.asp"
  108. REM Copy CHM and INF messages to compdata dirs
  109. call ExecuteCmd.cmd "copy /y drvmain\drvmain.inf %_NTPostBld%\winnt32\compdata"
  110. call ExecuteCmd.cmd "copy /y drvmain\drvmain.inf %_NTPostBld%\perinf\winnt32\compdata"
  111. call ExecuteCmd.cmd "copy /y drvmain\drvmain.inf %_NTPostBld%\srvinf\winnt32\compdata"
  112. call ExecuteCmd.cmd "copy /y drvmain\drvmain.inf %_NTPostBld%\blainf\winnt32\compdata"
  113. call ExecuteCmd.cmd "copy /y drvmain\drvmain.inf %_NTPostBld%\entinf\winnt32\compdata"
  114. call ExecuteCmd.cmd "copy /y drvmain\drvmain.inf %_NTPostBld%\dtcinf\winnt32\compdata"
  115. call ExecuteCmd.cmd "copy /y drvmain\drvmain.inf %_NTPostBld%\sbsinf\winnt32\compdata"
  116. call ExecuteCmd.cmd "copy /y drvmain\drvmain.chm %_NTPostBld%\winnt32\compdata"
  117. call ExecuteCmd.cmd "copy /y drvmain\drvmain.chm %_NTPostBld%\perinf\winnt32\compdata"
  118. call ExecuteCmd.cmd "copy /y drvmain\drvmain.chm %_NTPostBld%\srvinf\winnt32\compdata"
  119. call ExecuteCmd.cmd "copy /y drvmain\drvmain.chm %_NTPostBld%\blainf\winnt32\compdata"
  120. call ExecuteCmd.cmd "copy /y drvmain\drvmain.chm %_NTPostBld%\entinf\winnt32\compdata"
  121. call ExecuteCmd.cmd "copy /y drvmain\drvmain.chm %_NTPostBld%\dtcinf\winnt32\compdata"
  122. call ExecuteCmd.cmd "copy /y drvmain\drvmain.chm %_NTPostBld%\sbsinf\winnt32\compdata"
  123. REM Remove this line once Setup has removed their dependency on appmig.inf
  124. call ExecuteCmd.cmd "copy appmig.inx %_NTPostBld%\appmig.inf"
  125. REM Append migration entries from AppCompat XML db to setup's migdb.inf
  126. REM Only do this for pro and per, since those are the only SKUs that allow migration
  127. if /i "%_BuildArch%" neq "x86" goto SkipAppendAppCompat
  128. @echo Appending to MigDB...
  129. call ExecuteCmd.cmd "copy %_NTPostBld%\winnt32\win9xupg\migdb.inf .\migdb_pro.inf"
  130. call ExecuteCmd.cmd "copy %_NTPostBld%\perinf\winnt32\win9xupg\migdb.inf .\migdb_per.inf"
  131. call ExecuteCmd.cmd "infstrip migdb_pro.inf ___APPCOMPAT_MIG_ENTRIES___"
  132. call ExecuteCmd.cmd "infstrip migdb_per.inf ___APPCOMPAT_MIG_ENTRIES___"
  133. call ExecuteCmd.cmd "copy /y /b migdb_pro.inf+migapp.txt+migapp.inx %_NTPostBld%\winnt32\win9xupg\migdb.inf"
  134. call ExecuteCmd.cmd "copy /y /b migdb_per.inf+migapp.txt+migapp.inx %_NTPostBld%\perinf\winnt32\win9xupg\migdb.inf"
  135. @echo Appending to NTCOMPAT...
  136. call ExecuteCmd.cmd "copy %_NTPostBld%\winnt32\compdata\ntcompat.inf .\ntcompat_pro.inf"
  137. call ExecuteCmd.cmd "copy %_NTPostBld%\perinf\winnt32\compdata\ntcompat.inf .\ntcompat_per.inf"
  138. call ExecuteCmd.cmd "copy %_NTPostBld%\srvinf\winnt32\compdata\ntcompat.inf .\ntcompat_srv.inf"
  139. call ExecuteCmd.cmd "copy %_NTPostBld%\blainf\winnt32\compdata\ntcompat.inf .\ntcompat_bla.inf"
  140. call ExecuteCmd.cmd "copy %_NTPostBld%\entinf\winnt32\compdata\ntcompat.inf .\ntcompat_ent.inf"
  141. call ExecuteCmd.cmd "copy %_NTPostBld%\dtcinf\winnt32\compdata\ntcompat.inf .\ntcompat_dtc.inf"
  142. call ExecuteCmd.cmd "copy %_NTPostBld%\sbsinf\winnt32\compdata\ntcompat.inf .\ntcompat_sbs.inf"
  143. call ExecuteCmd.cmd "infstrip ntcompat_pro.inf ___APPCOMPAT_NTCOMPAT_ENTRIES___"
  144. call ExecuteCmd.cmd "infstrip ntcompat_per.inf ___APPCOMPAT_NTCOMPAT_ENTRIES___"
  145. call ExecuteCmd.cmd "infstrip ntcompat_srv.inf ___APPCOMPAT_NTCOMPAT_ENTRIES___"
  146. call ExecuteCmd.cmd "infstrip ntcompat_bla.inf ___APPCOMPAT_NTCOMPAT_ENTRIES___"
  147. call ExecuteCmd.cmd "infstrip ntcompat_ent.inf ___APPCOMPAT_NTCOMPAT_ENTRIES___"
  148. call ExecuteCmd.cmd "infstrip ntcompat_dtc.inf ___APPCOMPAT_NTCOMPAT_ENTRIES___"
  149. call ExecuteCmd.cmd "infstrip ntcompat_sbs.inf ___APPCOMPAT_NTCOMPAT_ENTRIES___"
  150. call ExecuteCmd.cmd "copy /y /b ntcompat_pro.inf+drvmain\ntcompat_drv.inf %_NTPostBld%\winnt32\compdata\ntcompat.inf"
  151. call ExecuteCmd.cmd "copy /y /b ntcompat_per.inf+drvmain\ntcompat_drv.inf %_NTPostBld%\perinf\winnt32\compdata\ntcompat.inf"
  152. call ExecuteCmd.cmd "copy /y /b ntcompat_srv.inf+drvmain\ntcompat_drv.inf %_NTPostBld%\srvinf\winnt32\compdata\ntcompat.inf"
  153. call ExecuteCmd.cmd "copy /y /b ntcompat_bla.inf+drvmain\ntcompat_drv.inf %_NTPostBld%\blainf\winnt32\compdata\ntcompat.inf"
  154. call ExecuteCmd.cmd "copy /y /b ntcompat_ent.inf+drvmain\ntcompat_drv.inf %_NTPostBld%\entinf\winnt32\compdata\ntcompat.inf"
  155. call ExecuteCmd.cmd "copy /y /b ntcompat_dtc.inf+drvmain\ntcompat_drv.inf %_NTPostBld%\dtcinf\winnt32\compdata\ntcompat.inf"
  156. call ExecuteCmd.cmd "copy /y /b ntcompat_sbs.inf+drvmain\ntcompat_drv.inf %_NTPostBld%\sbsinf\winnt32\compdata\ntcompat.inf"
  157. @echo Copying SafeDisc driver to retail directory...
  158. call ExecuteCmd.cmd "copy /y /b %_NTPostBld%\shimdll\secdrv.sys %_NTPostBld%\secdrv.sys"
  159. :SkipAppendAppCompat
  160. popd
  161. :IncrementalSkip