Launch pykd from outside of Windbg

Jun 21, 2013 at 1:29 PM

I'd like to have a Python script that uses pykd, but outside of Windbg (in my case, i want to automate a dump analysis and be able to debug the script with Visual Studio Python Tools).
However, it loads dbghelp and dbgeng from the windows system32 directory and not from my WinDbg installation.
Is there a way to load the same DLLs as if the script were running in WinDbg in order to get the same functionnalities (WinDbg extensions loaded, same engine, ...) ?
Jun 29, 2013 at 6:43 AM
I have two ideas:
  1. Launch Python with modified environment variables, i mean PATH.
  2. You can make custom build of pykd which loads required dlls specifing full path.
Jul 8, 2013 at 8:41 AM
Edited Jul 8, 2013 at 8:41 AM
You can simply copy dbgeng, dbghelp, symsrv, srcsrv to system32 directory.

WinDBG extensions you should load manualy anyway.
Apr 22, 2014 at 9:49 PM
It is possible to actually use SxS to convince the dynamic linker to link with the binaries that come with the Debugging Engine instead of the system versions. This way if you write a python module, it will use the latest dbghelp.dll to fetch symbols.

The only issue is that you essentially have to sign dbgeng.dll and dbghelp.dll with your own cert to get them registered into the SxS registry. I've scripted this into an installer but have since left it unmaintained. Once you have the libraries registered in SxS, you can update the manifest in PyKd (or whatever module) so that windows will use the SxS versions of the libraries instead of the system ones.

This is the only way that I've been able to get a python module to link with the newer dbgeng dll's since python.exe will use the system ones by default. If only Microsoft would just sign the binaries and register them in SxS during install so we can link with them properly...

Apr 23, 2014 at 6:21 AM
I'm afraid I can not distribute all these modules.

From redist.txt from WinDDK 7600:

You may redistribute version

There is no dbgeng.dll in redist list.

Windows Kits 8.0 has no redist agreement for these modules.
So it is no correct way to distribute them with installer.