首页
社区
课程
招聘
[求助]win32 调试API
发表于: 2012-8-29 16:29 3561

[求助]win32 调试API

2012-8-29 16:29
3561
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
_debugThread_proc   proc    uses esi edi ebx lpParam
    LOCAL   @nReaderNumber
    invoke  RtlZeroMemory,addr @nReaderNumber,sizeof @nReaderNumber
    invoke  GetStartupInfo,offset stStartUp                        
    invoke  CreateProcess,offset szFilePath,NULL,NULL,NULL,NULL,DEBUG_PROCESS or DEBUG_ONLY_THIS_PROCESS,NULL,\
            NULL,offset stStartUp,offset stPF  
    .while  TRUE           
        invoke  WaitForDebugEvent,offset stDebugEvent,INFINITE     
        invoke  _showerror_proc,stPF.hProcess
        invoke  _showerror_proc,stPF.hThread
        .break  .if stDebugEvent.dwDebugEventCode == EXIT_PROCESS_DEBUG_EVENT      
        .if stDebugEvent.dwDebugEventCode == CREATE_PROCESS_DEBUG_EVENT                                
            invoke  ReadProcessMemory,stPF.hProcess,lpEntryPointer,offset Oldcommand,1,@nReaderNumber                          
            invoke  WriteProcessMemory,stPF.hProcess,lpEntryPointer,offset dbINT3,1,@nReaderNumber 
        .endif
        invoke  ContinueDebugEvent,stPF.hProcess,stPF.hThread,DBG_CONTINUE         
    .endw
    invoke  ExitThread,12
    ret
 
_debugThread_proc endp

这是一个线程函数
为什么第二次循环的时候卡在WaitForDebugEvent 不执行了呢???

[招生]科锐逆向工程师培训(2025年3月11日实地,远程教学同时开班, 第52期)!

收藏
免费
支持
分享
最新回复 (2)
雪    币: 240
活跃值: (190)
能力值: ( LV8,RANK:130 )
在线值:
发帖
回帖
粉丝
2
原因很简单,WaitForDebugEvent,INFINITE    ,INFINITE    为永久等待,没有事件到来,所以永久等待下去,肯定会卡起了,楼主不会不知道"阻塞函数"这个词吧?
2012-8-29 17:09
0
雪    币: 8
活跃值: (12)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
3
invoke  ContinueDebugEvent,stPF.hProcess,stPF.hThread,DBG_CONTINUE
反了个很低级的错误..应该使用dwProcessId和dwThreadId= =我记错了..应该是ID,不是句柄= = 妹的...
2012-8-29 18:00
0
游客
登录 | 注册 方可回帖
返回

账号登录
验证码登录

忘记密码?
没有账号?立即免费注册