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.

108 lines
2.7 KiB

  1. @echo off
  2. REM ------------------------------------------------------------------
  3. REM
  4. REM CheckTestSig.cmd
  5. REM Verifys that all files in fullprslist.txt are signed.
  6. REM
  7. REM Copyright (c) Microsoft Corporation. All rights reserved.
  8. REM
  9. REM ------------------------------------------------------------------
  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. use Logmsg;
  20. sub Usage { print<<USAGE; exit(1) }
  21. CheckTestSig [-l <language>]
  22. Verify that all files listed in fullprslist.txt are signed. CheckTestSign
  23. will try once to sign any unsigned files. Returns an error if any files
  24. are still unsigned after attempting to resign.
  25. USAGE
  26. sub Dependencies {
  27. if ( !open DEPEND, ">>$ENV{_NTPOSTBLD}\\..\\build_logs\\dependencies.txt" ) {
  28. errmsg("Unable to open dependency list file.");
  29. die;
  30. }
  31. print DEPEND<<DEPENDENCIES;
  32. \[$0\]
  33. IF {
  34. DEPENDENCIES
  35. if ( !open LIST, "$ENV{RAZZLETOOLPATH}\\sp\\prs\\fullprslist.txt" ) {
  36. errmsg("Unable to open fullprslist.txt.");
  37. die;
  38. }
  39. while (<LIST>) {
  40. next if /^\;/;
  41. s/^perinf\\//i;
  42. /^(\S*)/;
  43. print DEPEND "$1\n";
  44. }
  45. close LIST;
  46. print DEPEND "} ADD {}\n\n";
  47. close DEPEND;
  48. exit;
  49. }
  50. my $qfe;
  51. parseargs('?' => \&Usage,
  52. 'plan' => \&Dependencies,
  53. 'qfe:' => \$qfe);
  54. if ( -f "$ENV{_NTPOSTBLD}\\..\\build_logs\\skip.txt" ) {
  55. if ( !open SKIP, "$ENV{_NTPOSTBLD}\\..\\build_logs\\skip.txt" ) {
  56. errmsg("Unable to open skip list file.");
  57. die;
  58. }
  59. while (<SKIP>) {
  60. chomp;
  61. exit if lc$_ eq lc$0;
  62. }
  63. close SKIP;
  64. }
  65. # *** NEXT FEW LINES ARE TEMPLATE ***
  66. $ENV{"_CPCMAGIC"}++;exit(system($0)>>8);
  67. __END__
  68. :CPCBegin
  69. set _CPCMAGIC=
  70. setlocal ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
  71. REM *** BEGIN YOUR CMD SCRIPT BELOW ***
  72. REM Loop over everything listed in newprs\fullprslist.txt
  73. REM Chktrust first. If it is not signed, sign it and log
  74. REM a warning
  75. set CatList=%RazzleToolPath%\sp\prs\fullprslist.txt
  76. for /f %%a in (%CatList%) do (
  77. if exist %_NTPostBld%\%%a (
  78. chktrust -q %_NTPostBld%\%%a
  79. if !ErrorLevel! EQU 0 (
  80. call logmsg.cmd "%_NTPostBld%\%%a successfully signed."
  81. ) else (
  82. call logmsg.cmd "WARNING: %_NTPostBld%\%%a not signed. Attempting to resign."
  83. call ntsign.cmd -n -f %_NTPostBld%\%%a
  84. chktrust -q %_NTPostBld%\%%a
  85. if !ErrorLevel! EQU 0 (
  86. call logmsg.cmd "%_NTPostBld%\%%a signed on retry."
  87. ) else (
  88. call errmsg.cmd "%_NTPostBld%\%%a not signed on retry."
  89. )
  90. )
  91. )
  92. )
  93. goto end
  94. :end
  95. seterror.exe "%errors%"& goto :EOF