RtlUnicodeStringToUTF8String 函式 (wdm.h)

RtlUnicodeStringToUTF8String 函式會將指定的 Unicode 來源字串轉換成 UTF8 字串串。

語法

NTSYSAPI NTSTATUS RtlUnicodeStringToUTF8String(
  PUTF8_STRING     DestinationString,
  PCUNICODE_STRING SourceString,
  BOOLEAN          AllocateDestinationString
);

參數

DestinationString

要保存已轉換 UTF8 字串 之UTF8_STRING 結構的指標。 如果 AllocateDestinationStringTRUE,則例程會配置新的緩衝區來保存字串數據,並更新 DestinationStringBuffer 成員以指向新的緩衝區。 否則,例程會使用目前指定的緩衝區來保存字串。 只有在 AllocateDestinationString 為 TRUE 時,才會設定最大長度字段。

SourceString

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

AllocateDestinationString

如果 這個例程是配置 DestinationString 的緩衝區空間,則為 TRUE。 如果這樣做,則必須藉由呼叫 RtlFreeUTF8String 來解除分配緩衝區。

傳回值

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

規格需求

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

另請參閱

RtlFreeUTF8String