FsRtlDissectName 函式 (ntifs.h)

假設有 Unicode 路徑名稱字串, FsRtlDissectName 例程會傳回兩個字串,一個字元串包含字串中找到的第一個檔名,另一個字符串則包含 pathname 字串串的其餘未剖析部分。

語法

void FsRtlDissectName(
  [in]  UNICODE_STRING  Path,
  [out] PUNICODE_STRING FirstName,
  [out] PUNICODE_STRING RemainingName
);

參數

[in] Path

要剖析的路徑名稱字串。

[out] FirstName

pathname 字串中第一個檔名的指標。

[out] RemainingName

pathname 字串其餘未剖析部分的指標。

傳回值

備註

在輸入字串中,反斜杠會讀取為名稱分隔符。 字串中的名字假設包含字串開頭到第一個反斜杠前面的字元的所有字元。 此規則只有一個例外:如果輸入字串中的第一個字元是反斜杠,則會忽略此字元,而且不會出現在輸出字串中。 字串的其餘部分包含所有字元,後面接著字串中找到的名字反斜杠。

FsRtlDissectName 不會檢查輸入字串中是否有不合法的字元。

下表顯示 FsRtlDissectName 的範例輸入和輸出值。

路徑 FirstName RemainingName
empty empty empty
A A empty
A\B\C\D\E A B\C\D\E
*A? *A? empty
\A A empty
A[,] A[,] empty
A\\B+;\C A \B+;\C
 

請注意,傳回時,輸出參數的 Buffer 成員會指向 PathBuffer 成員。 因此,呼叫端不應該為兩個輸出參數的 Buffer 成員配置記憶體,如下列範例所示:

.
.
.
/*
The FsRtlDissectName routine will set the members
of the following two structures appropriately:
*/
UNICODE_STRING CurrentComponent;
UNICODE_STRING RemainingComponent;

/*
Do not allocate storage for the Buffer members of CurrentComponent
and RemainingComponent in that they will point into the previously
allocated storage of FullPathName's Buffer member:
*/
FsRtlDissectName (FullPathName, &CurrentComponent, &RemainingComponent);
.
.
.

如需其他字串處理例程的資訊,請參閱 Run-Time Library (RTL) 例程

規格需求

需求
目標平台 Universal
標頭 ntifs.h (包含 Ntifs.h)
程式庫 NtosKrnl.lib
Dll NtosKrnl.exe
IRQL PASSIVE_LEVEL
DDI 合規性規則 HwStorPortProhibitedDDIs (storport) PowerIrpDDis (wdm)

另請參閱

UNICODE_STRING