RtlUTF8StringToUnicodeString 函式 (wdm.h)

RtlUTF8StringToUnicodeString 函式會根據目前的系統地區設定資訊,將指定的 UTF8 來源字串轉換成 Unicode 字串。

語法

NTSYSAPI NTSTATUS RtlUTF8StringToUnicodeString(
  PUNICODE_STRING DestinationString,
  PUTF8_STRING    SourceString,
  BOOLEAN         AllocateDestinationString
);

參數

DestinationString

要保存已轉換 Unicode 字串 之UNICODE_STRING 結構的指標。

如果 AllocateDestinationStringTRUE,則例程會配置新的緩衝區來保存字串數據、更新 DestinationStringBuffer 成員以指向新的緩衝區,並設定最大長度字段。 否則,例程會使用目前指定的緩衝區來保存字串。

SourceString

要轉換成 Unicode 的 UTF8 字串指標。

AllocateDestinationString

指定這個例程是否應該配置目的地字串的緩衝區空間。 如果這樣做,呼叫端必須呼叫 RtlFreeUnicodeString 來解除分配緩衝區。

傳回值

如果轉換成功, RtlUTF8StringToUnicodeString 會傳回STATUS_SUCCESS。 失敗時,例程不會配置記憶體或執行轉換。

規格需求

需求
最低支援的用戶端 Windows 10 (版本 2004)
標頭 wdm.h
IRQL PASSIVE_LEVEL

另請參閱

RtlFreeUnicodeString