KernelBasePathCchStripToRoot Method

Removes all file and directory elements in a path except for the root information.

This function differs from PathStripToRoot(StringBuilder) in that it accepts paths with "\", "\?" and "\?\UNC" prefixes.

Note: This function should be used in place of PathStripToRoot(StringBuilder) to prevent the possibility of a buffer overrun.

Definition

Namespace: DevCase.Win32.NativeMethods
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("KernelBase.dll", CharSet = CharSet.Auto, BestFitMapping = false, 
	ThrowOnUnmappableChar = true)]
public static HResult PathCchStripToRoot(
	StringBuilder buffer,
	uint bufferSize
)

Parameters

buffer  StringBuilder
A pointer to the path string.

When this function returns successfully, this string contains only the root information taken from that path.

bufferSize  UInt32
The size of the buffer pointed to by buffer, in characters.

Return Value

HResult
This function returns S_OK if the path was truncated, S_FALSE if the path was already just a root, or an HResult failure code.

Remarks

See Also