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.

95 lines
2.5 KiB

  1. @REM -----------------------------------------------------------------
  2. @REM
  3. @REM delayload.cmd - ReinerF
  4. @REM Verify that delayloaded imports all have failure handlers
  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. delayload [-l <language>]
  21. Verify that delayloaded imports all have failure handlers
  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. if /i "%HOST_PROCESSOR_ARCHITECTURE%" NEQ "%_BuildArch%" (
  33. call logmsg.cmd "Not running, as not building binaries that run on this machine"
  34. goto :EOF
  35. )
  36. set dlcheck=%_NTPostBld%\idw\dlcheck.exe
  37. set bindiff=%_NTPostBld%\build_logs\bindiff.txt
  38. if not exist %dlcheck% (
  39. call logmsg.cmd "Could not find %dlcheck%, exiting ..."
  40. goto :EOF
  41. )
  42. if not exist %_NTPostBld%\delayload (
  43. call logmsg.cmd "delayload subdir of nttree does not exist ..."
  44. goto :EOF
  45. )
  46. pushd %_NTPostBld%\delayload
  47. REM verify that the tables are correct
  48. call :CheckDelayLoad -t
  49. REM Now do the files
  50. if exist %bindiff% (
  51. call logmsg.cmd "Running incremental delayload check"
  52. for /f %%a in (%bindiff%) do (
  53. set modulename=%%~nxa
  54. if exist %_NTPOSTBLD%\delayload\!modulename!.ini call :CheckDelayLoad -i !ModuleName!.ini
  55. )
  56. ) else (
  57. call logmsg.cmd "Running full delayload check"
  58. call :CheckDelayLoad -i *.ini
  59. )
  60. popd
  61. goto :EOF
  62. :CheckDelayLoad
  63. REM
  64. REM Checks the given file for delayload problems
  65. REM
  66. set DLFailed=
  67. set DLTmpLog=%tmp%\dlcheck_log.tmp
  68. set DLTmpErr=%tmp%\dlcheck_err.tmp
  69. if exist %DLTmpLog% del %DLTmpLog%
  70. if exist %DLTmpErr% del %DLTmpErr%
  71. %dlcheck% %* 1>%DLTmpLog% 2>%DLTmpErr%
  72. if %ErrorLevel% NEQ 0 set DLFailed=TRUE
  73. if defined DLFailed (
  74. REM errors in DLCheck
  75. for /f "delims=" %%a in (%DLTmpErr%) do (
  76. call errmsg.cmd "%%a"
  77. )
  78. ) else (
  79. call logmsg.cmd @%DLTmpLog%
  80. )
  81. goto :EOF