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.

97 lines
2.3 KiB

  1. @echo off
  2. REM ------------------------------------------------------------------
  3. REM
  4. REM delayload.cmd
  5. REM Verify that delayloaded imports all have failure handlers
  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. 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. # *** NEXT FEW LINES ARE TEMPLATE ***
  25. $ENV{"_CPCMAGIC"}++;exit(system($0)>>8);
  26. __END__
  27. :CPCBegin
  28. set _CPCMAGIC=
  29. setlocal ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
  30. REM *** BEGIN YOUR CMD SCRIPT BELOW ***
  31. if /i "%PROCESSOR_ARCHITECTURE%" NEQ "%_BuildArch%" (
  32. call logmsg.cmd "Not running, as not building binaries that run on this machine"
  33. goto :EOF
  34. )
  35. set dlcheck=%_NTPostBld%\idw\dlcheck.exe
  36. set bindiff=%_NTPostBld%\build_logs\bindiff.txt
  37. if not exist %dlcheck% (
  38. call logmsg.cmd "Could not find %dlcheck%, exiting ..."
  39. goto :EOF
  40. )
  41. if not exist %_NTPostBld%\delayload (
  42. call logmsg.cmd "delayload subdir of nttree does not exist ..."
  43. goto :EOF
  44. )
  45. pushd %_NTPostBld%\delayload
  46. REM verify that the tables are correct
  47. call :CheckDelayLoad -t
  48. REM Now do the files
  49. if exist %bindiff% (
  50. call logmsg.cmd "Running incremental delayload check"
  51. for /f %%a in (%bindiff%) do (
  52. set modulename=%%~nxa
  53. if exist %_NTPOSTBLD%\delayload\!modulename!.ini call :CheckDelayLoad -i !ModuleName!.ini
  54. )
  55. ) else (
  56. call logmsg.cmd "Running full delayload check"
  57. for /f %%a in ('dir /b *.ini') do (
  58. set modulename=%%a
  59. call :CheckDelayLoad -i !ModuleName!
  60. )
  61. )
  62. popd
  63. goto :EOF
  64. :CheckDelayLoad
  65. REM
  66. REM Checks the given file for delayload problems
  67. REM
  68. set DLFailed=
  69. set DLTmpLog=%tmp%\dlcheck_log.tmp
  70. set DLTmpErr=%tmp%\dlcheck_err.tmp
  71. if exist %DLTmpLog% del %DLTmpLog%
  72. if exist %DLTmpErr% del %DLTmpErr%
  73. %dlcheck% %* 1>%DLTmpLog% 2>%DLTmpErr%
  74. if %ErrorLevel% NEQ 0 set DLFailed=TRUE
  75. if defined DLFailed (
  76. REM errors in DLCheck
  77. for /f "delims=" %%a in (%DLTmpErr%) do (
  78. call errmsg.cmd "%%a"
  79. )
  80. ) else (
  81. call logmsg.cmd @%DLTmpLog%
  82. )
  83. goto :EOF