- UID
 - 65325
 
 注册时间2010-2-1
阅读权限20
最后登录1970-1-1
以武会友 
   
 
 
 
TA的每日心情  | 郁闷 2017-1-19 11:18 | 
|---|
 
  签到天数: 6 天 [LV.2]偶尔看看I  
 | 
 
 
 
 
 
- DWORD  OnBreakPoint::DebugDealRoutine(DEBUG_EVENT *pdebugevent, CONTEXT *pContext)
 
 - {
 
 -     DWORD dwContinueStatus = DBG_EXCEPTION_NOT_HANDLED;
 
 -     EXCEPTION_DEBUG_INFO* lpExceptionInfo = &pdebugevent->u.Exception;    
 
 -     HANDLE hProcess = NULL;
 
  
-     if((DWORD)lpExceptionInfo->ExceptionRecord.ExceptionAddress == MyDbg::m_BreakPointInfo.dwAddr)
 
 -     {
 
 -         HANDLE hProcess = ::OpenProcess(PROCESS_ALL_ACCESS, FALSE, pdebugevent->dwProcessId);
 
  
-         if (hProcess != NULL)
 
 -         {
 
 -             DWORD dwReadBytes = 0;  
 
 -  //恢复原数据         
 
 -             BOOL Nr = WriteProcessMemory(hProcess, (PVOID) MyDbg::m_BreakPointInfo.dwAddr, &MyDbg::m_BreakPointInfo.chOrdCode, 1, &dwReadBytes);
 
 - //假设注册码在EDX中。。。。。。。。
 
 -             CHAR SZBUF[1024] = {0};
 
 -             CString STR;
 
 -             DWORD dwRead = 0;
 
 -             ReadProcessMemory(hProcess, (char*)pContext->Edx, SZBUF, 1024, &dwRead);
 
 -             AfxMessageBox(SZBUF);
 
 -             hProcess = NULL;
 
 -             CloseHandle(hProcess);
 
 -             return DBG_CONTINUE;
 
 -         }
 
 -     }
 
  
-     CloseHandle(hProcess);
 
 -             hProcess = NULL;
 
 -     return DBG_EXCEPTION_NOT_HANDLED;
 
 - }
 
  
  复制代码 
 
写的时候,有点测试代码,假设注册码在目标地址下断点后的EDX寄存器中,结果目标程序退出,自己死循环。。。。。。。。。。。。。。。。。。 
 |   
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?加入我们 
 
 
 
x
 
 
 
 
 |