RtlInitUnicodeString 用于将一个宽字符(Unicode)字符串初始化为 UNICODE_STRING 结构

NTSTATUS DriverEntry (PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
{
  
	UNICODE_STRING myUnicodeString;
	WCHAR myString[] = L"Hello, Kernel!";

	// 初始化 Unicode 字符串
	RtlInitUnicodeString(&myUnicodeString, myString);

	// 输出字符串的长度
	DbgPrint("Length: %d\n", myUnicodeString.Length);
	DbgPrint("Maximum Length: %d\n", myUnicodeString.MaximumLength);
	DbgPrint("Buffer: %ws\n", myUnicodeString.Buffer);
	return 0;
}

 

posted on 2025-03-16 12:53  lydstory  阅读(40)  评论(0)    收藏  举报

导航