Good day. Sorry for my English 🙁
I create thread by PsCreateSystemThread:
HANDLE hThread;
void Func(PVOID a)
{
LARGE_INTEGER delay;
delay.QuadPart = SEC(1);
while(!KeDelayExecutionThread(KernelMode,0,&delay))
DbgPrint(">> thread message");
}
NTSTATUS DriverEntry(IN PDRIVER_OBJECT pDriverObject, IN PUNICODE_STRING pRegistryPath)
{
pDriverObject->DriverUnload = DriverUnload;
return PsCreateSystemThread(&hThread,THREAD_ALL_ACCESS,0,NtCurrentProcess(),0,Func,0);
}
After there I want to run ZwUnloadDriver. Function DriverUnload must terminate thread… function PsTerminateSystemThread terminationg only current thread. function ZwTerminateThread is in ntdll, but not in ntoskrnl.