#ifndef _NTPSAPI_H
// Threads
#if (PHNT_MODE != PHNT_MODE_KERNEL)
NTSYSCALLAPI
NTSTATUS
NTAPI
NtTerminateThread(
_In_opt_ HANDLE ThreadHandle,
_In_ NTSTATUS ExitStatus
);
View code on GitHub
#ifndef _NTZWAPI_H
NTSYSCALLAPI
NTSTATUS
NTAPI
ZwTerminateThread(
_In_opt_ HANDLE ThreadHandle,
_In_ NTSTATUS ExitStatus
);
View code on GitHub
Forcefully terminates a thread.
ThreadHandle
- an optional handle to a thread granting THREAD_TERMINATE
access or the NtCurrentThread
pseudo-handle. If this value is NULL
, the calling thread is terminated.ExitStatus
- the value to set as the exit status of the thread.STATUS_CANT_TERMINATE_SELF
- indicates that a thread attempted to terminate itself by default (called NtTerminateThread
with NULL
) and it was the last thread in the current process.To exit the current thread gracefully, use RtlExitUserThread
.
The thread object becomes signalled after termination.