Skip to content

Commit 2164b35

Browse files
committed
[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.
1 parent 47b9297 commit 2164b35

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

ntoskrnl/ps/query.c

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3112,6 +3112,41 @@ NtQueryInformationThread(IN HANDLE ThreadHandle,
31123112
ObDereferenceObject(Thread);
31133113
break;
31143114

3115+
case ThreadBreakOnTermination:
3116+
3117+
/* Set the return length */
3118+
Length = sizeof(ULONG);
3119+
3120+
if (ThreadInformationLength != Length)
3121+
{
3122+
Status = STATUS_INFO_LENGTH_MISMATCH;
3123+
break;
3124+
}
3125+
3126+
/* Reference the thread */
3127+
Status = ObReferenceObjectByHandle(ThreadHandle,
3128+
Access,
3129+
PsThreadType,
3130+
PreviousMode,
3131+
(PVOID*)&Thread,
3132+
NULL);
3133+
if (!NT_SUCCESS(Status))
3134+
break;
3135+
3136+
_SEH2_TRY
3137+
{
3138+
*(PULONG)ThreadInformation = Thread->BreakOnTermination;
3139+
}
3140+
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
3141+
{
3142+
Status = _SEH2_GetExceptionCode();
3143+
}
3144+
_SEH2_END;
3145+
3146+
/* Dereference the thread */
3147+
ObDereferenceObject(Thread);
3148+
break;
3149+
31153150
case ThreadIsTerminated:
31163151

31173152
/* Set the return length*/

0 commit comments

Comments
 (0)