Guest User

ANALYZE_CRASH_MINIDUMPS_LATEST.BAT

a guest
Oct 11th, 2014
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. :: Analyze crash minidumps by aveyo v1.0
  2. :: You need to install Debugging Tools for Windows x86 first
  3. :: and override the default install path to C:\Debuggers instead
  4. :: http://msdn.microsoft.com/library/windows/hardware/ff551063%28v=vs.85%29.aspx
  5. :: No more wasting internet bandwidth with 30MB+ dumps (like in dota2). Send just the text summary
  6. @ECHO off
  7.  
  8. CALL :CHECK_OS
  9.  
  10. :: Check for Debugging Tools for Windows installation
  11. :: If script can't find them it means MS changed paths again
  12.  
  13. SET "TOOLS_FOUND="
  14. SET "DEBUG_TOOLS=%PFVAR%\Debugging Tools for Windows (x86)"
  15. IF EXIST "%DEBUG_TOOLS%\kd.exe" SET /A TOOLS_FOUND=1
  16. IF NOT DEFINED TOOLS_FOUND SET "DEBUG_TOOLS=C:\Program Files\Debugging Tools for Windows (x64)"
  17. IF EXIST "%DEBUG_TOOLS%\kd.exe" SET /A TOOLS_FOUND=1
  18. SET "DEBUG_TOOLS=%PFVAR%\Windows Kits\8.1\Debuggers\x86"
  19. IF EXIST "%DEBUG_TOOLS%\kd.exe" SET /A TOOLS_FOUND=1
  20. SET "DEBUG_TOOLS=%PFVAR%\Windows Kits\8.1\Debuggers\x64"
  21. IF EXIST "%DEBUG_TOOLS%\kd.exe" SET /A TOOLS_FOUND=1
  22. SET "DEBUG_TOOLS=C:\Debuggers"
  23. IF EXIST "%DEBUG_TOOLS%\kd.exe" SET /A TOOLS_FOUND=1
  24.  
  25. IF NOT DEFINED TOOLS_FOUND CALL :ERR You need to install Debugging Tools for Windows before using this script!
  26. IF NOT DEFINED TOOLS_FOUND CALL :ERR http://msdn.microsoft.com/library/windows/hardware/ff551063%28v=vs.85%29.aspx
  27. IF NOT DEFINED TOOLS_FOUND CALL :ERR and override the default install path to C:\Debuggers instead
  28. rem CALL :XECHO Debugging Tools for Windows="%DEBUG_TOOLS%"
  29.  
  30. :: Choose minidump file by filepicker window
  31. CALL :XECHO Choose the .dmp/.mdmp file you want to analyze:
  32. IF NOT EXIST "%~1" CALL :VBCHOOSEFILE
  33. :: Choose minidump file by 1st parameter, skipping filepicker
  34. IF EXIST "%~1" SET "ChosenFile=%~1"
  35. IF EXIST "%~1" CALL :__VBCHOOSEFILE_VERIFY
  36. FOR /F "tokens=*" %%I IN ("%ChosenFile%") DO ( SET "DUMPDIR=%%~dpI" &SET "DUMPFILE=%%~nI%%~xI")
  37. CALL :XECHO Dump file = %ChosenFile%
  38.  
  39. PUSHD "%DUMPDIR%"
  40. "%DEBUG_TOOLS%\kd.exe" -y "srv*c:\symbols*http://msdl.microsoft.com/download/symbols" -logo "%ChosenFile%.txt" -c ".reload;!analyze -v;r;kv;lmnt;.logclose;q" -z "%ChosenFile%"
  41. START " " /WAIT dxdiag /dontskip /whql:on /t dxdiag.txt
  42. COPY /Y "%ChosenFile%.txt" + "%DUMPDIR%\dxdiag.txt" "%ChosenFile%.txt" >nul 2>&1
  43. START " " notepad "%ChosenFile%.txt"
  44. POPD
  45. ECHO  DONE!  &PING localhost >nul 2>&1 &EXIT /B
  46.  
  47. GOTO :eof
  48.  
  49. :CHECK_OS
  50. :: This must run first
  51. :: Usage: CALL :CHECK_OS
  52. IF "%PROCESSOR_ARCHITECTURE%"=="x86" (
  53. SET "MACHINE="
  54. IF DEFINED PROCESSOR_ARCHITEW6432 SET "MACHINE=_x64"
  55. ) ELSE (
  56. SET "MACHINE=_x64"
  57. )
  58. SET "REGNODE="
  59. FOR %%I IN ("%PROGRAMFILES%") DO SET "PFVAR=%%~sI"
  60. FOR %%I IN ("%WINDIR%\SYSTEM32") DO SET "SSVAR=%%~sI"
  61. :: MS put ZERO thinking in naming x64 Program Files - brackets are deadly in batch files
  62. IF "%MACHINE%"=="_64" (
  63. FOR %%I IN ("%PROGRAMFILES(X86)%") DO SET "PFVAR=%%~sI"
  64. FOR %%I IN ("%WINDIR%\SysWOW64") DO SET "SSVAR=%%~sI"
  65. SET "REGNODE=Wow6432Node\"
  66. IF DEFINED PROCESSOR_ARCHITEW6432 FOR %%I IN ("%WINDIR%\Sysnative") DO SET "SSVAR=%%~sI"
  67. )
  68. SET _MYVER=%~n0 by a^v^ey^o^ v1.0 &TITLE %_MYVER%
  69. rem FOR /F "tokens=4-5 delims=. " %%i IN ('ver') DO SET WINVERSION=%%i%%j
  70. rem IF %WINVERSION% LEQ 60 CALL :ERR ONLY FOR WINDOWS 7 OR ABOVE
  71. rem CALL :XECHO PROGRAMFILES=%PFVAR% SYSTEM=%SSVAR%
  72. GOTO :eof
  73. ::END.CHECK_OS
  74.  
  75. :ERR
  76. :: Usage: Call :ERR string
  77. echo/
  78. echo #ERROR! %*
  79. PAUSE &EXIT
  80. GOTO :eof
  81. ::END.ERR
  82.  
  83. :XECHO
  84. :: Extended echo
  85. :: Usage: Call :XECHO string/var
  86. :: Output: onscreen
  87. rem CLS
  88. echo/
  89. IF NOT "%1_"=="_" echo #INFO: %*
  90. IF DEFINED _TRACE echo/ & PAUSE
  91. GOTO :eof
  92. ::END.XECHO
  93.  
  94. :VBCHOOSEFILE
  95. :: Show a vbs prompt to pick a file
  96. :: Usage: CALL :VBCHOOSEFILE
  97. :: Output: %SOURCEDIR% %SOURCEFILE%
  98. FINDSTR "'~1337v%skip%bc%skip%f" "%~f0">"%temp%\~1337cf.vbs"
  99. CSCRIPT //nologo "%temp%\~1337cf.vbs" >"%temp%\~1337cf.cmd"
  100. CALL "%temp%\~1337cf.cmd"
  101. CALL :__VBCHOOSEFILE_VERIFY
  102. GOTO :eof
  103. :__VBCHOOSEFILE_VERIFY
  104. :: file type filtering
  105. DEL /F /Q "%temp%\~1337cf.vbs" >NUL 2>&1
  106. DEL /F /Q "%temp%\~1337cf.cmd" >NUL 2>&1
  107. IF [%ChosenFile%]==[] CALL :ERR No file was chosen, please select a .dmp/.mdmp file next run
  108. IF /I NOT [%ChosenFile:~-3%]==[dmp] CALL :ERR Please select a .dmp/.mdmp file next run  
  109. IF NOT EXIST "%ChosenFile%" CALL :ERR File cannot be accessed, try moving it to the current dir
  110. GOTO :eof
  111. ::END.VBCHOOSEFILE
  112.  
  113.  
  114. GOTO :eof
  115. Set wShell=CreateObject("WScript.Shell") '~1337vbcf
  116. Set oExec=wShell.Exec("mshta.exe ""about:<input type=file id=FILE><script>FILE.click();new ActiveXObject('Scripting.FileSystemObject').GetStandardStream(1).WriteLine(FILE.value);close();resizeTo(0,0);</script>""") '~1337vbcf
  117. WScript.echo "set ChosenFile=" & oExec.StdOut.ReadLine '~1337vbcf
Add Comment
Please, Sign In to add comment