Hello I am trying to terminate the current thread using NtTerminateThread. I know that the function for the syscall takes 2 arguments which are the thread handle and the exit status but whenever I try to exit the current thread it gives me STATUS_INVALID_HANDLE. Im getting the handle from the function GetCurrentThread which returns 0xfffffffffffffffe.
Im trying to exit with a status of STATUS_SUCCESS which is 0x00000000.
RAX return value showing STATUS_INVALID_HANDLE

ASM:
mov rcx, 0xfffffffffffffffe
mov rdx, 0x0
mov eax, 0x53
syscall
r10init ?0x53must not be hardcoded but resolved in run time. and Im trying to exit with a status ofSTATUS_SUCCESS- you can not do this in any case - impossible