VOID ThreadStart(_In_ PVOID StartContext)
{
PWCHAR str = (PWCHAR)StartContext;
MySleep(10);//延时10ms
KdPrint(("%ws\n", str));
ExFreePool(str);
PsTerminateSystemThread(STATUS_SUCCESS);
}
void MyThread()
{
HANDLE hThread = NULL;
UNICODE_STRING str = {0};
wchar_t strInfo[] = {L"我爱你, 一生一世"};
str.Buffer = (PWCHAR)ExAllocatePoolWithTag(NonPagedPool, ArrayLength, 'MY');
str.Length = str.MaximumLength = (USHORT)wcslen(strInfo);
RtlStringCbPrintfW(str.Buffer, ArrayLength, L"%ws", strInfo);
PsCreateSystemThread(&hThread, 0, NULL, NULL, NULL, ThreadStart, str.Buffer);
ZwClose(hThread);
}
windows driver 创建线程
最新推荐文章于 2023-11-17 16:32:32 发布