最近发现一个内核anti调试器的东东现象是在R3调用DebugActiveProcess无法正常返回,长时间卡死如果以CreateProcess加载则会在WaitForDebugEvent卡住因为anti双机内核调试,只能自己写代码拦截流程发现以CreateProcess方式启动后在内核已经执行到DbgkpSendApiMessage,再往下已通知调试子系统调试子系统一节好像也只介绍到这一步想问下什么情况下会导致上面的情况没有响应呢?
另外写代码的时候发现个有趣的东东书201页DbgkpSendApiMessage的函数声明参数是3个在我的XP sp2的系统里却只有2个很是花了大半天的时间....
lkd> u DbgkpSendApiMessagent!DbgkpSendApiMessage:8063919a 8bff mov edi,edi8063919c 55 push ebp8063919d 8bec mov ebp,esp8063919f 53 push ebx806391a0 33db xor ebx,ebx806391a2 385d0c cmp byte ptr [ebp+0Ch],bl806391a5 56 push esi806391a6 7408 je nt!DbgkpSendApiMessage+0x16 (806391b0)lkd> uf DbgkpSendApiMessagent!DbgkpSendApiMessage:8063919a 8bff mov edi,edi8063919c 55 push ebp8063919d 8bec mov ebp,esp8063919f 53 push ebx806391a0 33db xor ebx,ebx806391a2 385d0c cmp byte ptr [ebp+0Ch],bl806391a5 56 push esi806391a6 7408 je nt!DbgkpSendApiMessage+0x16 (806391b0)
nt!DbgkpSendApiMessage+0xe:806391a8 e88b010000 call nt!DbgkpSuspendProcess (80639338)806391ad 88450c mov byte ptr [ebp+0Ch],al
nt!DbgkpSendApiMessage+0x16:806391b0 8b5508 mov edx,dword ptr [ebp+8]806391b3 c7421c03010000 mov dword ptr [edx+1Ch],103h806391ba 64a124010000 mov eax,dword ptr fs:[00000124h]806391c0 8b4844 mov ecx,dword ptr [eax+44h]806391c3 33c0 xor eax,eax806391c5 40 inc eax806391c6 8db148020000 lea esi,[ecx+248h]806391cc f00906 lock or dword ptr [esi],eax806391cf 64a124010000 mov eax,dword ptr fs:[00000124h]806391d5 53 push ebx806391d6 53 push ebx806391d7 52 push edx806391d8 50 push eax806391d9 51 push ecx806391da e8afedffff call nt!DbgkpQueueMessage (80637f8e)806391df 53 push ebx806391e0 53 push ebx806391e1 6aff push 0FFFFFFFFh806391e3 8bf0 mov esi,eax806391e5 e89651ecff call nt!ZwFlushInstructionCache (804fe380)806391ea 385d0c cmp byte ptr [ebp+0Ch],bl806391ed 7405 je nt!DbgkpSendApiMessage+0x5a (806391f4)
nt!DbgkpSendApiMessage+0x55:806391ef e866010000 call nt!DbgkpResumeProcess (8063935a)
nt!DbgkpSendApiMessage+0x5a:806391f4 8bc6 mov eax,esi806391f6 5e pop esi806391f7 5b pop ebx806391f8 5d pop ebp806391f9 c20800 ret 8