KernelBasePathCchCanonicalizeEx Method

Simplifies a path by removing navigation elements such as "." and ".." to produce a direct, well-formed path.

This function differs from PathCchCanonicalize(StringBuilder, UInt32, String) in that it allows for a longer final path to be constructed.

This function differs from PathAllocCanonicalize in that the caller must declare the size of the returned string, which is stored on the stack.

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

Note: This function, PathCchCanonicalize(StringBuilder, UInt32, String), or PathAllocCanonicalize should be used in place of PathCanonicalize(StringBuilder, String) 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 PathCchCanonicalizeEx(
	StringBuilder pathOut,
	uint pathOutSize,
	string pathIn,
	PathOptions flags
)

Parameters

pathOut  StringBuilder
A pointer to a buffer that, when this function returns successfully, receives the edited path string.
pathOutSize  UInt32
The size of the buffer pointed to by pathOut, in characters.
pathIn  String
A pointer to the original path string.

If this value is NULL, points to an empty string, or results in an empty string once the "." and ".." elements are removed, a single backslash is copied to the buffer pointed to by pathOut.

flags  PathOptions
Flags that determine how to canonicalize the path.

Return Value

HResult
This function returns S_OK if succeed, or an HResult failure code.

Remarks

See Also