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;
}
浙公网安备 33010602011771号