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);
}
版权声明:本文为博主原创文章,未经博主允许不得转载。
本文详细介绍了如何使用VOIDThreadStart函数创建自定义线程,并通过实例展示了如何在代码中实现这一过程。重点在于理解VOIDThreadStart函数的作用、参数及其在实际开发中的应用。
2499

被折叠的 条评论
为什么被折叠?



