/* * Copyright (c) 2026, Chloe M. * Provided under the BSD-3 clause. * * Description: Thread management * Author: Chloe M. */ #include #include #include #include /* Globals */ static UQUAD NextThreadTid = 0; PT_STATUS PsCreateThread(struct _PROCESS *Parent, ULONG Flags, THREAD **Result) { THREAD *Thread; if (Parent == NULL || Result == NULL) { return STATUS_INVALID_PARAM; } Thread = ExAllocatePoolWithTag( POOL_NON_PAGED, sizeof(*Thread), THREAD_POOL_TAG ); if (Thread == NULL) { return STATUS_NO_MEMORY; } Thread->Tid = AtomicIncQuad(&NextThreadTid); Thread->Parent = Parent; *Result = Thread; return STATUS_SUCCESS; }