status = _PsSuspendThread((PETHREAD)dwEThread, &PreviousSuspendCount);
if (!NT_SUCCESS(status))
{
KdPrint(("Handling_BreakPointer : PsSuspendThread is Failure.\r\n"));
return;
}
ThreadContext.ContextFlags = CONTEXT_FULL | CONTEXT_DEBUG_REGISTERS;
status = PsGetContextThread((PETHREAD)dwEThread, &ThreadContext, KernelMode);
if (!NT_SUCCESS(status))
{
KdPrint(("Handling_BreakPointer : PsGetContextThread is Failure.\r\n"));
return;
}
ThreadContext.ContextFlags = CONTEXT_FULL | CONTEXT_DEBUG_REGISTERS;
ThreadContext.Dr0 = Par_BreakPointerPtr->dwDebugRegister0;
ThreadContext.Dr1 = Par_BreakPointerPtr->dwDebugRegister1;
ThreadContext.Dr2 = Par_BreakPointerPtr->dwDebugRegister2;
ThreadContext.Dr3 = Par_BreakPointerPtr->dwDebugRegister3;
ThreadContext.Dr7 = dwAmountValue;
ThreadContext.ContextFlags = CONTEXT_FULL | CONTEXT_DEBUG_REGISTERS;
status = PsSetContextThread((PETHREAD)dwEThread, &ThreadContext, KernelMode);
if (!NT_SUCCESS(status))
{
KdPrint(("Handling_BreakPointer : PsGetContextThread is Failure.\r\n"));
return;
}
status = _PsResumeThread((PETHREAD)dwEThread, &PreviousSuspendCount);
if (!NT_SUCCESS(status))
{
KdPrint(("Handling_BreakPointer : PsResumeThread is Failure.\r\n"));
return;
}
注 : EThread非当前线程...为什么我能调用PsSuspendThread但是PsGetContextThread调用会失败呢?难道是Mode的问题...但是我用PreviousMode = *(char *)(dwEThread + 0x140);Ethread里面的这个参数也还是不行...观WRK源码是这样实现的...可是为什么不成功呢?望高手指点迷津.PsSuspendThread 和 PsResumeThread是在NtSuspendThread 和 NtResumeThread用特征码定位到的.
[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)