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.

193 lines
3.2 KiB

  1. @echo off
  2. rem %1 = makepsf.map file
  3. rem %2 = stage
  4. rem %3 = patches.out directory
  5. set failed=0
  6. set passed=0
  7. set missing=0
  8. set mapfile=%1
  9. set stage=%2
  10. set patches=%3
  11. set apatch=%~dp0\apatch.exe
  12. set apatchdll=%~dp0\mspatcha_197.dll
  13. set comp1=%~dp0\comp1.exe
  14. if exist "%mapfile%" goto gotmap
  15. echo %~n0: Unable to find patch map file "%mapfile%"
  16. set failed=1
  17. :gotmap
  18. if exist "%stage%" goto gotstage
  19. echo %~n0: Unable to find stage directory "%stage%"
  20. set failed=1
  21. :gotstage
  22. if exist "%patches%" goto gotpatches
  23. echo %~n0: Unable to find patches directory "%patches%"
  24. set failed=1
  25. :gotpatches
  26. if %failed% == 0 goto start
  27. echo %~n0: usage: %~n0 {mapfile} {stagedir} {patchdir}
  28. goto :EOF
  29. :Start
  30. if exist %apatch% goto :gotapatch
  31. echo %~n0: unable to find %apatch% in %~dp0
  32. set failed=1
  33. goto :EOF
  34. :gotapatch
  35. if exist %apatchdll% goto :gotapatchdll
  36. echo %~n0: unable to find %apatchdll% in %~dp0
  37. set failed=1
  38. goto :EOF
  39. :gotapatchdll
  40. if exist %comp1% goto :gotcomp1
  41. echo %~n0: unable to find %comp1% in %~dp0
  42. set failed=1
  43. goto :EOF
  44. :gotcomp1
  45. for /f "tokens=1,2,3 delims=," %%f in (%mapfile%) do call :TestPatch %%f %%g %%h
  46. echo %~n0: Failed: %failed% Passed: %passed% Missing: %missing%
  47. goto :EOF
  48. :TestPatch
  49. rem enable to stop on first error:
  50. rem if %failed% neq 0 goto :EOF
  51. rem %1 = patch file name (in %patches%)
  52. rem %2 = new file name (in %stage%)
  53. rem %3 = old file name (full path)
  54. echo %1
  55. if exist "%patches%\%1" goto gotpatch
  56. echo Patch not found: %patches%\%1
  57. set /a missing=%missing% + 1
  58. goto :EOF
  59. :gotpatch
  60. if exist "%stage%\%2" goto gotnewfile
  61. echo New file not found: %stage%\%2
  62. set /a failed=%failed% + 1
  63. goto :EOF
  64. :gotnewfile
  65. if "%~x1" == "._p0" goto TestPatch0
  66. if "%~nx1" == "%~nx2" goto TestUncompressed
  67. if exist "%3" goto gotoldfile
  68. echo Old file not found: %3
  69. set /a failed=%failed% + 1
  70. goto :EOF
  71. :gotoldfile
  72. if exist test del test
  73. %apatch% /dll:%apatchdll% %patches%\%1 %3 test >nul 2>nul
  74. if errorlevel 1 goto ApplyFailed
  75. if not exist test goto ApplyFailed
  76. %comp1% test %stage%\%2 >nul
  77. if errorlevel 1 goto ApplyMiscompare
  78. set /a passed=%passed% + 1
  79. del test
  80. goto :EOF
  81. :ApplyFailed
  82. if exist test del test
  83. echo %apatch% /dll:%apatchdll% %patches%\%1 %3 test
  84. %apatch% /dll:%apatchdll% %patches%\%1 %3 test 2>nul
  85. if exist test del test
  86. echo Patch apply failed: %patches%\%1 on %3
  87. set /a failed=%failed% + 1
  88. goto :EOF
  89. :ApplyMiscompare
  90. if exist test del test
  91. echo Patch apply miscompare: %patches%\%1 on %3
  92. set /a failed=%failed% + 1
  93. goto :EOF
  94. :TestPatch0
  95. if exist test del test
  96. %apatch% /dll:%apatchdll% %patches%\%1 NUL test >nul 2>nul
  97. if errorlevel 1 goto ApplyFailed
  98. if not exist test goto ApplyFailed
  99. %comp1% test %stage%\%2 >nul
  100. if errorlevel 1 goto Apply0Miscompare
  101. set /a passed=%passed% + 1
  102. del test
  103. goto :EOF
  104. :Apply0Failed
  105. if exist test del test
  106. echo Patch apply failed: %patches%\%1
  107. set /a failed=%failed% + 1
  108. goto :EOF
  109. :Apply0Miscompare
  110. if exist test del test
  111. echo Patch apply miscompare: %patches%\%1
  112. set /a failed=%failed% + 1
  113. goto :EOF
  114. :TestUncompressed
  115. %comp1% %stage%\%2 %patches%\%1 >nul
  116. if errorlevel 1 goto Miscompare
  117. set /a passed=%passed% + 1
  118. goto :EOF
  119. :Miscompare
  120. echo Uncompressed miscompare: %patches%\%1
  121. set /a failed=%failed% + 1
  122. goto :EOF