MCPcopy Create free account
hub / github.com/BeneficialCode/WinArk / DbgkpPostFakeThreadMessages

Function DbgkpPostFakeThreadMessages

KernelLibrary/kDbgSys.cpp:553–748  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

551}
552
553NTSTATUS DbgkpPostFakeThreadMessages(
554 PEPROCESS Process,
555 PDEBUG_OBJECT DebugObject,
556 PETHREAD StartThread,
557 PETHREAD* pFirstThread,
558 PETHREAD* pLastThread
559)
560/*++
561Routine Description:
562 This routine posts the faked initial process create, thread create messages
563Arguments:
564 Process - Process to be debugged
565 DebugObject - Debug object to queue messages to
566 StartThread - Thread to start search from
567 pFirstThread - First thread found in the list
568 pLastThread - Last thread found in the list
569Return Value:
570 None.
571--*/
572{
573 NTSTATUS status;
574 PETHREAD Thread, FirstThread, LastThread, CurrentThread;
575 DBGKM_APIMSG ApiMsg;
576 BOOLEAN First = TRUE;
577 BOOLEAN IsFirstThread;
578 PIMAGE_NT_HEADERS NtHeaders;
579 ULONG Flags;
580 KAPC_STATE ApcState;
581 auto process = Process;
582
583 status = STATUS_UNSUCCESSFUL;
584
585 LastThread = FirstThread = nullptr;
586
587 CurrentThread = PsGetCurrentThread();
588
589 if (StartThread != nullptr) {
590 First = FALSE;
591 FirstThread = StartThread;
592 ObfReferenceObject(StartThread);
593
594 }
595 else {
596 StartThread = kDbgUtil::g_pPsGetNextProcessThread(Process,nullptr);
597 First = TRUE;
598 }
599
600 // �������Խ��̵������߳�
601 for (Thread = StartThread;
602 Thread != nullptr;
603 Thread = kDbgUtil::g_pPsGetNextProcessThread(Process, Thread)) {
604
605 Flags = DEBUG_EVENT_NOWAIT;
606
607 //
608 // Keep a track on the last thread we have seen.
609 // We use this as a starting point for new threads after we
610 // really attach so we can pick up any new threads.

Callers

nothing calls this directly

Calls 4

PsSuspendThreadFunction · 0.85
DbgkpQueueMessageFunction · 0.85
PsResumeThreadFunction · 0.85

Tested by

no test coverage detected