vip007
vip007

Reputation: 93

How to load user written extension automatically in windbg

I am having windbg kernel debugger attached to a virtual machine. I have loaded a user written extension dll (.load DLL). Whenever virtual machine reboots (.reboot), it unloads all extensions and after VM reboot, it never load them back. I have to load it every time.

Is there any way, I can tell windbg to load my extension even after reboot (or don't unload it at all?) Not sure if later is possible. Is there any workaround?

Thank you.

Upvotes: 1

Views: 2109

Answers (1)

blabb
blabb

Reputation: 9007

well typing or selecting from history .load foo.dll is not such a big annoyance
or typing foo!myblah loads your extension and executes the command and as such it shouldn't be a big deal

when you reboot it starts a new session so all user modifications do not persist

but if you think you need some automation for such you can employ sxe command prior to reboot like

sxe -c ".load mysuperduperext.dll;gc" ibp ; .reboot

this assumes that you have put your extsnion dll in default search paths viz winext/%PATH%

if it is in some directory that is not in default search path

use one of the various options like setting the _NT_DEBUGGER_EXTESNION_PATH prior to executing windbg / kd

:\>cat runwindkd.bat
set  _NT_DEBUGGER_EXTENSION_PATH=.\myexts
.\windbg -k com:pipe,port=\\.\pipe\debugpipe,resets=0,reconnect -c ".load myext.dll"

this will add the directory to default search path

kd> .extpath
Extension search path is: .\myexts;E:\wind

Upvotes: 3

Related Questions