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.

65 lines
1.8 KiB

  1. @echo off
  2. REM ------------------------------------------------------------------
  3. REM
  4. REM ntsign.cmd
  5. REM Signs a given catalog file.
  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. ntsign -f <filename> [-t]
  22. Signs a given catalog file.
  23. -f File to be signed
  24. -t Use a timestamp.
  25. USAGE
  26. delete $ENV{CATALOGFILE}; # undef seems to give warnings when used on %ENV
  27. parseargs('?' => \&Usage,
  28. 'n' => sub { infomsg "No timestamp is now the default, ignoring -n" },
  29. 't' => \$ENV{TIMESTAMP},
  30. 'f:' => \$ENV{CATALOGFILE}, # for backwards compatibility
  31. \$ENV{CATALOGFILE}
  32. );
  33. # *** NEXT FEW LINES ARE TEMPLATE ***
  34. $ENV{"_CPCMAGIC"}++;exit(system($0)>>8);
  35. __END__
  36. :CPCBegin
  37. set _CPCMAGIC=
  38. setlocal ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
  39. REM *** BEGIN YOUR CMD SCRIPT BELOW ***
  40. REM ------------------------------------------------
  41. REM Sign the given file with the NT TEST certificate.
  42. REM ------------------------------------------------
  43. if "%TIMESTAMP%" == "1" (
  44. set SIGNTOOL_TS=/t http://timestamp.verisign.com/scripts/timestamp.dll
  45. )
  46. if exist "%CATALOGFILE%" (
  47. call logmsg.cmd "Signing %CATALOGFILE%..."
  48. ) else (
  49. call errmsg.cmd "Cannot sign catalog file %CATALOGFILE%, file does not exist"
  50. goto :EOF
  51. )
  52. signtool sign /q %SIGNTOOL_SIGN% %SIGNTOOL_TS% "%CATALOGFILE%"
  53. if not "%errorlevel%" == "0" (
  54. call errmsg.cmd "signtool.exe failed on %CATALOGFILE%"
  55. )