NTSTATUS __fastcall DbgkpSendApiMessage(PEPROCESS DebugedProcess, ULONG Flags, PDBGKM_APIMSG apiMsg)
{
NTSTATUS Status;
//不记录etw
do
{
BOOLEAN SuspendProcess = FALSE;
if ((DebugedProcess == PsGetCurrentProcess()) && ((Flags & 0x1) != 0))
{
//挂起目标进程,成功返回1,失败返回0
SuspendProcess = DbgkpSuspendProcess(DebugedProcess);
}
apiMsg->ReturnedStatus = STATUS_PENDING;
Status = DbgkpQueueMessage(DebugedProcess,
PsGetCurrentThread(),
apiMsg,
(Flags & 2) << 5,
NULL);
if (SuspendProcess)
{
//如果挂起成功,恢复目标进程
PsThawProcess(DebugedProcess, FALSE);//这里将KernelApcDisable-1
KeLeaveCriticalRegion();//这里会+1
}
//如果消息队列失败就跳出循环
//如果消息成功,但是返回值是DBG_REPLY_LATER,继续循环
} while (NT_SUCCESS(Status) && apiMsg->ReturnedStatus == DBG_REPLY_LATER);
return Status;
}
欢迎指教
win10 -->DbgkpSendApiMessage
最新推荐文章于 2025-05-31 19:41:15 发布