[NTOS:PS] Implement NtQueryInformationThread(ThreadBreakOnTermination)

Invoked by `RtlSetThreadIsCritical()` for returning the previous flag value,
and fixes the following error:
```
(ntoskrnl/ps/query.c:3155) Not implemented: 18
```

The implementation is "identical" to that of NtQueryInformationProcess()
`ProcessBreakOnTermination`, with the necessary adaptations, of course.
This commit is contained in:
Hermès Bélusca-Maïto
2025-08-19 14:04:27 +02:00
parent 47b92973a9
commit 2164b35683

View File

@@ -3112,6 +3112,41 @@ NtQueryInformationThread(IN HANDLE ThreadHandle,
ObDereferenceObject(Thread);
break;
case ThreadBreakOnTermination:
/* Set the return length */
Length = sizeof(ULONG);
if (ThreadInformationLength != Length)
{
Status = STATUS_INFO_LENGTH_MISMATCH;
break;
}
/* Reference the thread */
Status = ObReferenceObjectByHandle(ThreadHandle,
Access,
PsThreadType,
PreviousMode,
(PVOID*)&Thread,
NULL);
if (!NT_SUCCESS(Status))
break;
_SEH2_TRY
{
*(PULONG)ThreadInformation = Thread->BreakOnTermination;
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
Status = _SEH2_GetExceptionCode();
}
_SEH2_END;
/* Dereference the thread */
ObDereferenceObject(Thread);
break;
case ThreadIsTerminated:
/* Set the return length*/