pipi大侠请进(200分)

  • 主题发起人 主题发起人 QYLR
  • 开始时间 开始时间
Q

QYLR

Unregistered / Unconfirmed
GUEST, unregistred user!
我按照你上次提供的方法进行断点设置,但createprocess用DEBUG_PROCEES参数后,调用的程序<br>被中断了,但怎样才能把控制权交给被调程序啊?(也就是怎样让被调试的程序继续运行)<br>可以给个简单的例子吗?谢谢!
 
while ( 1 )<br>&nbsp; {<br>&nbsp; WaitForDebugEvent(&amp;dbgEvent, INFINITE);<br>&nbsp; dwContinueStatus = HandleDebugEvent( dbgEvent );<br>&nbsp; if ( dbgEvent.dwDebugEventCode == EXIT_PROCESS_DEBUG_EVENT )<br>&nbsp; &nbsp; &nbsp; break; //如果你用的是DEBUG_ONLY_THIS_PROCESS,那么可以直接退出<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//如果你用的是DEBUG_PROCESS,那么因为你还debug了子进程之子进程,要判断确实是全部退出了才能退出<br>&nbsp; ContinueDebugEvent( dbgEvent.dwProcessId,dbgEvent.dwThreadId,dwContinueStatus );<br>&nbsp; }<br>}<br>
 
DWORD TDebugThr::HandleDebugEvent(DEBUG_EVENT &amp;dbgEvent)<br>{<br>DWORD dwContinueStatus = DBG_CONTINUE;<br>int n;<br>switch ( dbgEvent.dwDebugEventCode )<br>&nbsp; {<br>&nbsp; case CREATE_PROCESS_DEBUG_EVENT:<br>&nbsp; &nbsp; ......................<br>&nbsp; &nbsp; break;<br><br>&nbsp; case EXIT_PROCESS_DEBUG_EVENT:<br>&nbsp; &nbsp; ..................<br>&nbsp; &nbsp; break;<br><br>&nbsp; case EXCEPTION_DEBUG_EVENT:<br>&nbsp; &nbsp; dwContinueStatus = HandleException( dbgEvent ); //HandleException是自己写的处理断点的<br>&nbsp; &nbsp; break;<br><br>&nbsp; case CREATE_THREAD_DEBUG_EVENT:<br>&nbsp; &nbsp; &nbsp;。。。。。。。。。。。。。。。<br>&nbsp; &nbsp; &nbsp;break;<br><br>&nbsp; case EXIT_THREAD_DEBUG_EVENT:<br>&nbsp; &nbsp;。。。。。。。。。<br>&nbsp; &nbsp; break;<br><br>&nbsp; case LOAD_DLL_DEBUG_EVENT:<br>&nbsp; &nbsp;。。。。。。。。。。。。。。。<br>&nbsp; &nbsp; CloseHandle( dbgEvent.u.LoadDll.hFile );<br>&nbsp; &nbsp; break;<br>&nbsp; }<br><br>return dwContinueStatus;<br>}<br>
 
非常感谢您!
 

Similar threads

回复
0
查看
848
不得闲
S
回复
0
查看
701
swish
S
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
后退
顶部