Source code of Windows XP (NT5)
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.

175 lines
5.3 KiB

  1. REM
  2. REM tscwebgen.cmd
  3. REM
  4. REM -Generate msrdp.cab (TS ActiveX web CAB)
  5. REM -Update HTML pages (Tsweb1.htm) with version specific build number for
  6. REM object tag.
  7. REM -Update INF file with build #
  8. REM -Build CAT file for CAB contents
  9. REM -Build CAB file (msrdp.cab)
  10. REM
  11. REM Contact: nadima
  12. REM
  13. REM (need this switch for the BuildNum stuff below to work)
  14. setlocal ENABLEDELAYEDEXPANSION
  15. set GENERATED_WEB_DIR=.\genweb
  16. set TEMP_WEB_DIR=.\tmpweb
  17. if defined ia64 set PLATFORM_STRING=ia64
  18. if defined amd64 set PLATFORM_STRING=amd64
  19. if defined 386 set PLATFORM_STRING=i386
  20. REM deltacat needs a full absolute path!
  21. set DELTA_CAT_DIR=%_NTPOSTBLD%\tsclient\win32\%PLATFORM_STRING%\%TEMP_WEB_DIR%\catfile
  22. REM *****************************************************
  23. REM * Clean out and create temporary and output dirs
  24. REM *****************************************************
  25. REM make tempdirs
  26. if exist %TEMP_WEB_DIR% (
  27. rmdir /q /s %TEMP_WEB_DIR%
  28. if errorlevel 1 call errmsg.cmd "Error deleting tmpweb dir"& goto errend
  29. )
  30. mkdir %TEMP_WEB_DIR%
  31. if errorlevel 1 call errmsg.cmd "err creating %TEMP_WEB_DIR% dir"& goto errend
  32. REM make output dir
  33. if exist %GENERATED_WEB_DIR% (
  34. rmdir /q /s %GENERATED_WEB_DIR%
  35. if errorlevel 1 call errmsg.cmd "Error deleting %GENERATED_WEB_DIR% dir"& goto errend
  36. )
  37. mkdir %GENERATED_WEB_DIR%
  38. if errorlevel 1 call errmsg.cmd "err creating %TEMP_WEB_DIR% dir"& goto errend
  39. REM *****************************************************
  40. REM * Verify source files exist
  41. REM *****************************************************
  42. REM verify source files
  43. if not exist .\tsweb1.htm (
  44. call errmsg.cmd "tsweb1.htm is missing for tscwebgen.cmd"
  45. goto errend
  46. )
  47. if not exist .\msrdp.inf (
  48. call errmsg.cmd "msrdp.inf is missing for tscwebgen.cmd"
  49. goto errend
  50. )
  51. if not exist %_NTPOSTBLD%\msrdp.ocx (
  52. call errmsg.cmd "%_NTPOSTBLD%\msrdp.ocx is missing for tscwebgen.cmd"
  53. goto errend
  54. )
  55. REM rename files
  56. copy .\msrdp.inf %TEMP_WEB_DIR%\msrdp.inf
  57. if errorlevel 1 call errmsg.cmd "err copying files to %TEMP_WEB_DIR%"& goto errend
  58. copy .\tsweb1.htm %TEMP_WEB_DIR%\tsweb1.htm
  59. if errorlevel 1 call errmsg.cmd "err copying files to %TEMP_WEB_DIR%"& goto errend
  60. REM *****************************************************
  61. REM * Update the version in the INF and HTM files
  62. REM *****************************************************
  63. call :SetVersion %TEMP_WEB_DIR%\msrdp.inf
  64. call :SetVersion %TEMP_WEB_DIR%\tsweb1.htm
  65. REM *****************************************************
  66. REM * Create the CAT file
  67. REM *****************************************************
  68. call logmsg.cmd "Building the mstsweb.cat file"
  69. rmdir /q/s %DELTA_CAT_DIR%
  70. mkdir %DELTA_CAT_DIR%
  71. if errorlevel 1 call errmsg.cmd "err creating %DELTA_CAT_DIR% dir"& goto errend
  72. copy %_NTPOSTBLD%\msrdp.ocx %DELTA_CAT_DIR%
  73. copy %TEMP_WEB_DIR%\msrdp.inf %DELTA_CAT_DIR%
  74. call deltacat %DELTA_CAT_DIR%
  75. if not "%errorlevel%" == "0" (
  76. call errmsg.cmd "err creating CAT file"& goto errend
  77. )
  78. copy %DELTA_CAT_DIR%\delta.cat %GENERATED_WEB_DIR%\mstsweb.cat
  79. if errorlevel 1 call errmsg.cmd "err copying delta.cat to mstsweb.cat"& goto errend
  80. REM *****************************************************
  81. REM * Now build the CAB file
  82. REM * Cab contains - generated msrdp.inf
  83. REM * msrdp.ocx
  84. REM *****************************************************
  85. call logmsg.cmd "Building the msrdp.ocx CAB file"
  86. cabarc -s 6144 n %GENERATED_WEB_DIR%\msrdp.cab %_NTPOSTBLD%\msrdp.ocx %TEMP_WEB_DIR%\msrdp.inf
  87. if errorlevel 1 call errmsg.cmd "err building msrdp.cab"& goto errend
  88. REM *****************************************************
  89. REM * Copy up the generated HTM file
  90. REM *****************************************************
  91. copy %TEMP_WEB_DIR%\tsweb1.htm %GENERATED_WEB_DIR%\tsweb1.htm
  92. if errorlevel 1 call errmsg.cmd "err copying tsweb1.htm to generated dir"& goto errend
  93. call logmsg.cmd "tscwebgen.cmd COMPLETED OK!"
  94. REM we're done
  95. endlocal
  96. goto end
  97. REM ******************SUBS START HERE********************
  98. REM *****************************************************
  99. REM * Update version sub *
  100. REM * (updates build version in a file *
  101. REM *****************************************************
  102. :SetVersion
  103. REM
  104. REM Update the build number by replacing '%NTVERSIONSTRING%'
  105. REM with the build number
  106. REM
  107. REM %1 is the file to update
  108. set ntverp=%_NTBINDIR%\public\sdk\inc\ntverp.h
  109. if NOT EXIST %ntverp% (echo Can't find ntverp.h.&goto :ErrEnd)
  110. for /f "tokens=3 delims=, " %%i in ('findstr /c:"#define VER_PRODUCTMAJORVERSION " %ntverp%') do (
  111. set /a ProductMajor="%%i"
  112. set BuildNum=%%i
  113. )
  114. for /f "tokens=3 delims=, " %%i in ('findstr /c:"#define VER_PRODUCTMINORVERSION " %ntverp%') do (
  115. set /a ProductMinor="%%i"
  116. set BuildNum=!BuildNum!,%%i
  117. )
  118. for /f "tokens=6" %%i in ('findstr /c:"#define VER_PRODUCTBUILD " %ntverp%') do (
  119. set /a ProductBuild="%%i"
  120. set BuildNum=!BuildNum!,%%i
  121. )
  122. for /f "tokens=3" %%i in ('findstr /c:"#define VER_PRODUCTBUILD_QFE " %ntverp%') do (
  123. set /a ProductQfe="%%i"
  124. set BuildNum=!BuildNum!,%%i
  125. )
  126. call logmsg.cmd "Updating the %1 ProductVersion to !BuildNum!"
  127. perl -n -p -e "s/\%%NTVERSIONSTRING\%%/$ENV{BuildNum}/i;" %1>%1.tmp
  128. if exist %1.tmp (
  129. copy %1.tmp %1
  130. del %1.tmp
  131. )
  132. if errorlevel 1 call errmsg.cmd "Error calling rep on %1 - !BuildNum!"& goto errend
  133. goto :EOF
  134. :errend
  135. goto :EOF
  136. :end
  137. seterror.exe 0
  138. goto :EOF