diff --git a/ntoskrnl/ex/work.c b/ntoskrnl/ex/work.c index a10a4878b42..9dec3405b76 100644 --- a/ntoskrnl/ex/work.c +++ b/ntoskrnl/ex/work.c @@ -254,6 +254,7 @@ ExpCreateWorkerThread(WORK_QUEUE_TYPE WorkQueueType, HANDLE hThread; ULONG Context; KPRIORITY Priority; + NTSTATUS Status; /* Check if this is going to be a dynamic thread */ Context = WorkQueueType; @@ -262,13 +263,19 @@ ExpCreateWorkerThread(WORK_QUEUE_TYPE WorkQueueType, if (Dynamic) Context |= EX_DYNAMIC_WORK_THREAD; /* Create the System Thread */ - PsCreateSystemThread(&hThread, - THREAD_ALL_ACCESS, - NULL, - NULL, - NULL, - ExpWorkerThreadEntryPoint, - UlongToPtr(Context)); + Status = PsCreateSystemThread(&hThread, + THREAD_ALL_ACCESS, + NULL, + NULL, + NULL, + ExpWorkerThreadEntryPoint, + UlongToPtr(Context)); + if (!NT_SUCCESS(Status)) + { + /* Well... */ + DPRINT1("Failed to create worker thread: 0x%08x\n", Status); + return; + } /* If the thread is dynamic */ if (Dynamic) @@ -519,6 +526,7 @@ ExpInitializeWorkerThreads(VOID) HANDLE ThreadHandle; PETHREAD Thread; ULONG i; + NTSTATUS Status; /* Setup the stack swap support */ ExInitializeFastMutex(&ExpWorkerSwapinMutex); @@ -576,13 +584,17 @@ ExpInitializeWorkerThreads(VOID) ExpCreateWorkerThread(HyperCriticalWorkQueue, FALSE); /* Create the balance set manager thread */ - PsCreateSystemThread(&ThreadHandle, - THREAD_ALL_ACCESS, - NULL, - 0, - NULL, - ExpWorkerThreadBalanceManager, - NULL); + Status = PsCreateSystemThread(&ThreadHandle, + THREAD_ALL_ACCESS, + NULL, + 0, + NULL, + ExpWorkerThreadBalanceManager, + NULL); + if (!NT_SUCCESS(Status)) + { + KeBugCheckEx(PHASE1_INITIALIZATION_FAILED, Status, 0, 0, 0); + } /* Get a pointer to it for the shutdown process */ ObReferenceObjectByHandle(ThreadHandle,