KernelBasePathCchCanonicalize Method

Converts a path string into a canonical form.

This function differs from PathCchCanonicalizeEx(StringBuilder, UInt32, String, PathOptions) in that you are restricted to a final path of length MAX_PATH.

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, PathCchCanonicalizeEx(StringBuilder, UInt32, String, PathOptions), 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 PathCchCanonicalize(
	StringBuilder pathOut,
	uint pathOutSize,
	string pathIn
)

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.

Return Value

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

Remarks

See Also