Guest User

ANALYZE_CRASH_MINIDUMPS_LATEST_FINAL.BAT

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