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.

129 lines
3.1 KiB

  1. @echo off
  2. setlocal EnableDelayedExpansion
  3. REM
  4. REM moveqfe.cmd
  5. REM
  6. REM moveqfe.cmd [-n:BugID] [-b:binary name]
  7. REM
  8. REM first, parse command line
  9. set BugID=
  10. set BinaryName=
  11. set PickupShare=\\2kbldx2\QFEPickup
  12. :SwitchLoop
  13. for %%a in (./ .- .) do if ".%1." == "%%a?." goto :Usage
  14. if "%1" == "" goto :EndSwitchLoop
  15. for /f "tokens=1* delims=:" %%a in ('echo %1') do (
  16. set Switch=%%a
  17. set Arg=%%b
  18. for %%c in (./ .-) do (
  19. if ".!Switch!." == "%%cn." (set BugID=!Arg!&&goto :ShiftArg)
  20. if ".!Switch!." == "%%cb." (set BinaryName=!Arg!&&goto :ShiftArg)
  21. )
  22. REM if we're here, we didn't encounter any switches and thus we have
  23. REM an unrecognized argument
  24. goto :Usage
  25. )
  26. :ShiftArg
  27. shift
  28. goto :SwitchLoop
  29. :EndSwitchLoop
  30. REM validate args
  31. if not defined BugID (
  32. echo Must supply a Bug number for this fix
  33. goto :Usage
  34. )
  35. if not defined BinaryName (
  36. echo Must supply a binary name to copy
  37. goto :Usage
  38. )
  39. if not exist %PickupShare% (
  40. echo Pickup share %PickupShare% does not exist, exiting.
  41. goto :Usage
  42. )
  43. REM make sure we can find the binaries
  44. set BinLoc=%_NTPOSTBLD%\%BinaryName%
  45. if not exist %BinLoc% (
  46. echo Could not find %BinLoc% ... not copying
  47. goto :End
  48. )
  49. REM find the extension to look for the symbols under, and rip off the dot
  50. for %%a in (%BinLoc%) do (
  51. set BinExtension=%%~xa
  52. set BinNameOnly=%%~na
  53. )
  54. set BinExtension=%BinExtension:~1%
  55. set SymLoc=%_NTPOSTBLD%\symbols\retail\%BinExtension%\%BinNameOnly%.pdb
  56. if not exist %SymLoc% (
  57. echo Could not find %SymLoc% ... not copying
  58. goto :End
  59. )
  60. set PriLoc=%_NTPOSTBLD%\symbols.pri\retail\%BinExtension%\%BinNameOnly%.pdb
  61. if not exist %PriLoc% (
  62. echo Could not find %PriLoc% ... not copying
  63. goto :End
  64. )
  65. REM make our directory on the pickup share
  66. set BinDropPoint=%PickupShare%\%BugID%\%_BuildArch%%_BuildType%\bin
  67. set SymDropPoint=%PickupShare%\%BugID%\%_BuildArch%%_BuildType%\sym
  68. set PriDropPoint=%PickupShare%\%BugID%\%_BuildArch%%_BuildType%\pri
  69. for %%a in (%BinDropPoint% %SymDropPoint% %PriDropPoint%) do (
  70. if not exist %%a (
  71. echo Creating binary drop point ...
  72. md %%a
  73. if !ErrorLevel! NEQ 0 (
  74. echo Failed to create %%a ... not copying
  75. goto :End
  76. )
  77. )
  78. )
  79. REM copy the requested bin and sym
  80. copy %BinLoc% %BinDropPoint% >nul 2>nul
  81. if %ErrorLevel% NEQ 0 (
  82. echo copy of binary failed, not copying symbol ...
  83. goto :End
  84. )
  85. copy %SymLoc% %SymDropPoint% >nul 2>nul
  86. if %ErrorLevel% NEQ 0 (
  87. echo copy of symbol failed, advise a retry ...
  88. goto :End
  89. )
  90. copy %PriLoc% %PriDropPoint% >nul 2>nul
  91. if %ErrorLevel% NEQ 0 (
  92. echo copy of private symbol failed, advise a retry ...
  93. goto :End
  94. )
  95. echo Binary copied to %BinDropPoint%
  96. echo Symbol copied to %SymDropPoint%
  97. echo Private symbol copied to %PriDropPoint%
  98. goto :End
  99. :Usage
  100. echo.
  101. echo moveqfe.cmd [-n:BugID] [-b:binary name]
  102. echo.
  103. echo this script will copy a binary and it's symbol to %PickupShare%
  104. echo under a path with the bug number and archtype in the path.
  105. echo.
  106. goto :End
  107. :End
  108. endlocal