I'm trying to log all calls to ntdll!NtAllocateVirtualMemory of a third party process, to produce a log file with all parameters (also OUT parameters) and call stack.
I've tried using WinDbg with this breakpoint:
bp ntdll!ntallocatevirtualmemory "r $t1 = poi(poi(@esp+8)); r $t2 = poi(poi(@esp+10h)); r $t3 = poi(@esp+14h); r $t4 = poi(@esp+18h); r $t7 = poi(esp); g @$t7; r $t5 = @eax; r $t6 = poi(poi(@esp-14h)); .printf /D \"Asked: 0x%.8X Size: 0x%.8X AllocType: 0x%.8X Protect: 0x%.8X Result: 0x%.8X Got: 0x%.8X\n\", @$t1, @$t2, @$t3, @$t4, @$t5, @$t6; kcL10; gc"
Which is nice, but causes WinDbg to hang and stop responding.
Is there a proper way to make this work with WinDbg? Is there another tool that could provide reliable stack unwinding and log API calls?
Thanks