WinDbg explorer integration

You can execute any .exe file (and link to .exe file, with arguments) running under WinDbg by right clicking it and selecting “WinDbg” by adding the following to your registry:

Create the key “HKEY_CLASSES_ROOT\exefile\shell\WinDbg\command” and set the default value to a REG_EXPAND_SZ with this value:

“%ProgramFiles%\Debugging Tools for Windows (x64)\windbg.exe” -o -W [Your workspace] “%1″ %*
 

-or-

“%ProgramFiles%\Debugging Tools for Windows (x86)\windbg.exe” -o -W[Your workspace] ”%1″ %*
 

(Choose the  x64 or x86 version depending on your OS).
The option “-W [Your workspace]” tells Windbg to use a specific workspace and “-o” option tells WinDbg to also debug child processes started by the .exe. You can omit both options if you prefer.

Here’s an example .reg file for x64 that uses the “SkyLined” workspace, you can use it to get started and modify the key using regedit to fit your needs. It can be downloaded here:

Windows Registry Editor Version 5.00
 
[HKEY_CLASSES_ROOT\exefile\shell\WinDbg]
 
[HKEY_CLASSES_ROOT\exefile\shell\WinDbg\command]
@=hex(2):22,00,25,00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,46,00,69,00,\
6c,00,65,00,73,00,25,00,5c,00,44,00,65,00,62,00,75,00,67,00,67,00,69,00,6e,\
00,67,00,20,00,54,00,6f,00,6f,00,6c,00,73,00,20,00,66,00,6f,00,72,00,20,00,\
57,00,69,00,6e,00,64,00,6f,00,77,00,73,00,20,00,28,00,78,00,36,00,34,00,29,\
00,5c,00,77,00,69,00,6e,00,64,00,62,00,67,00,2e,00,65,00,78,00,65,00,22,00,\
20,00,2d,00,6f,00,20,00,2d,00,57,00,20,00,53,00,6b,00,79,00,4c,00,69,00,6e,\
00,65,00,64,00,20,00,22,00,25,00,31,00,22,00,20,00,25,00,2a,00,00,00
 

2 Comments to “WinDbg explorer integration”

  1. SkyLined
    2009/08/27

    Unfortunately, I posted an incorrect solution here that used REG_EXPAND_SZ: The “Debugger” string only accepts REG_SZ. Originally, I used REG_SZ but because not everybody has Windows installed on the same drive as me and in the same language, I figured using environment variables might be a wise thing to do to prevent errors caused by the Debugging Tools being installed in another path. I created the sample but forgot to test if it actually worked; it turns out it does not. I’ve now put the original sample back up; if you do not have Debugging Tools installed in the path specified in the sample, you should change the path in the .reg file before merging it with your registry or modify your registry after you merge it using regedit.exe.

Trackbacks & Pingbacks

  1. Skypher · JIT Debugging 32-bit applications on 64-bit Windows

Leave a Comment

*

*