如何在 WinDBG 附加操作之前获取 EIP 值?

逆向工程 风袋
2021-06-28 13:37:09

当 WinDBG 附加到进程时,EIP 将指向ntdll!DbgBreakPoint与主进程线程不同的专用线程。

是否可以在附加操作之前获取 EIP 值?如果可能,如何在附件发生之前获取 EIP 值?

1个回答

arbitrary number of threads在任何给定的时间都可以在进程中运行,
您需要哪个线程的 eip 或者您能否解释一下您所追求的内容,因为正如发布的那样,您的查询似乎不合逻辑。

如果您想知道连接断开时每个线程的位置

查找进程中运行的线程数

 ~*

就是这样,tilde and asterisk它会列出在windbg 崩溃时正在运行的所有线程

现在使用number as a variablein a.for loop打印出eip and ebp+4(堆栈上的返回地址)

脚本

0:019> .for (r $t0 = 0; @$t0 < 19; r $t0 = @$t0+1 ) { ~[@$t0]s; .printf "%p\t%y\t%y\n",@eip,@eip,poi(@ebp+4);   }

结果(附加到一个空白的 ieexplorer)

7c90e514    ntdll!KiFastSystemCallRet (7c90e514)    USER32!RealMsgWaitForMultipleObjectsEx+0x13e (7e4195f9)
7c90e514    ntdll!KiFastSystemCallRet (7c90e514)    ADVAPI32!WmipEventPump+0x230 (77df8631)
7c90e514    ntdll!KiFastSystemCallRet (7c90e514)    KERNEL32!BaseThreadStart+0x37 (7c80b729)
7c90e514    ntdll!KiFastSystemCallRet (7c90e514)    KERNEL32!BaseThreadStart+0x37 (7c80b729)
7c90e514    ntdll!KiFastSystemCallRet (7c90e514)    KERNEL32!BaseThreadStart+0x37 (7c80b729)
7c90e514    ntdll!KiFastSystemCallRet (7c90e514)    RPCRT4!RecvLotsaCallsWrapper+0xd (77e76caf)
7c90e514    ntdll!KiFastSystemCallRet (7c90e514)    KERNEL32!WaitForMultipleObjects+0x18 (7c80a115)
7c90e514    ntdll!KiFastSystemCallRet (7c90e514)    USER32!RealMsgWaitForMultipleObjectsEx+0x13e (7e4195f9)
7c90e514    ntdll!KiFastSystemCallRet (7c90e514)    KERNEL32!WaitForMultipleObjects+0x18 (7c80a115)
7c90e514    ntdll!KiFastSystemCallRet (7c90e514)    USER32!RealMsgWaitForMultipleObjectsEx+0x13e (7e4195f9)
7c90e514    ntdll!KiFastSystemCallRet (7c90e514)    RPCRT4!RecvLotsaCallsWrapper+0xd (77e76caf)
7c90e514    ntdll!KiFastSystemCallRet (7c90e514)    KERNEL32!Sleep+0xf (7c802455)
7c90e514    ntdll!KiFastSystemCallRet (7c90e514)    ole32!CRpcThread::WorkerLoop+0x5c (774fe419)
7c90e514    ntdll!KiFastSystemCallRet (7c90e514)    ole32!CRpcThread::WorkerLoop+0x5c (774fe419)
7c90e514    ntdll!KiFastSystemCallRet (7c90e514)    KERNEL32!BaseThreadStart+0x37 (7c80b729)
7c90e514    ntdll!KiFastSystemCallRet (7c90e514)    KERNEL32!BaseThreadStart+0x37 (7c80b729)
7c90e514    ntdll!KiFastSystemCallRet (7c90e514)    RPCRT4!RecvLotsaCallsWrapper+0xd (77e76caf)
7c90e514    ntdll!KiFastSystemCallRet (7c90e514)    RPCRT4!RecvLotsaCallsWrapper+0xd (77e76caf)
7c90e514    ntdll!KiFastSystemCallRet (7c90e514)    KERNEL32!BaseThreadStart+0x37 (7c80b729)
7c90120e    ntdll!DbgBreakPoint (7c90120e)  00000000