first PID is 0, separate idle to system

This commit is contained in:
maksw committed 2026-05-20 22:42:52 +02:00
1 parent 0d7f71b693
commit db175ab20a
7 files changed
+84 -25

No files matched your search

+21 -18
View File
@@ -370,24 +370,6 @@ static PROCESS* KiLaunchUserProcess(const char* filePath, const char* args) {
// Caller owns the reference returned by KeCreateProcess.
return proc;
}
static void KiPrintProcessList() {
LIST_ENTRY* listHead = KeGetProcessList();
LIST_ENTRY* current;
DbgPrint("\nPID | Name | Threads | ExitCode\n");
DbgPrint("---------------------------------------------\n");
for (current = listHead->Fwd; current != listHead; current = current->Fwd) {
// Translate the list entry back to the PROCESS structure
PROCESS* proc = CONTAINING_RECORD(current, PROCESS, GlobalLink);
DbgPrint("%-5u | %-16s | %-7u | %d\n",
proc->ProcessId,
proc->Name,
proc->ThreadCount,
proc->ExitCode);
}
}
void SystemInitThread(void* arg) {
SYSTEM_INIT_ARGS* args = (SYSTEM_INIT_ARGS*)arg;
@@ -487,6 +469,27 @@ uint64_t KeCatchAllDebugBucket(uint64_t a0, uint64_t a1, uint64_t a2, uint64_t a
return status;
}
if (a0 == 2) {
LIST_ENTRY* listHead = KeGetProcessList();
LIST_ENTRY* current;
DbgPrint("\nPID | Name | Threads | ExitCode\n");
DbgPrint("---------------------------------------------\n");
for (current = listHead->Fwd; current != listHead; current = current->Fwd) {
// Translate the list entry back to the PROCESS structure
PROCESS* proc = CONTAINING_RECORD(current, PROCESS, GlobalLink);
DbgPrint("%-5u | %-16s | %-7u | %d\n",
proc->ProcessId,
proc->Name,
proc->ThreadCount,
proc->ExitCode);
}
return STATUS_SUCCESS;
}
DbgPrint("DebugBucket: unknown command %llu\n", a0);
return STATUS_INVALID_PARAMETER;
}