Starting from Excel (VBA): Launch an external interactive program, and in there launch commands and read their output : is this possible?

泄露秘密 提交于 2019-12-02 07:28:07

If you want to use pykd for fully automatic tasks, why you need to run it inside windbg? You can make a standalone python script.

I've found following solution to my problem:

  • I'll adapt my heap_stat script, at the end it'll create an empty (flag) file.
  • I'll windbg from Excel VBA as follows:

    Shell "windbg -z ""C:\Directory\Dumpfile.dmp"" -c "".load pykd.pyd;.logopen C:\Directory\output.txt;!py heap_stat.py -stat""", vbMaximizedFocus
    
    • The meaning of the Windbg commands is the following:

      .load pykd.pyd         // load PYKD library
      .logopen ...           // open a logfile, for all Windbg output (thanks, Zac and Tate, for the idea)
      !py heap_stat.py -stat // launch the heap_stat script
      
  • I'll write a while-loop, verifying for the presence of the flag file.
  • The output file's content will be copied to the Excel file, which will do the analysis.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!