KernelBasePathCchCombine Method

Combines two path fragments into a single path. This function also canonicalizes any relative path elements, removing "." and ".." elements to simplify the final path.

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

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

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

Note: This function, PathCchCombineEx(StringBuilder, UInt32, String, String, PathOptions), or PathAllocCombine should be used in place of PathCombine(StringBuilder, String, 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 PathCchCombine(
	StringBuilder pathOut,
	uint pathOutSize,
	string pathIn,
	string more
)

Parameters

pathOut  StringBuilder
A pointer to a buffer that, when this function returns successfully, receives the combined path string.

This parameter can point to the same buffer as pathIn or more.

pathOutSize  UInt32
The size of the buffer pointed to by pathOut, in characters.
pathIn  String
A pointer to the first path string.

This value can be NULL.

more  String
A pointer to the second path string.

If this path begins with a single backslash, it is combined with only the root of the path pointed to by pathIn.

If this path is fully qualfied, it is copied directly to the output buffer without being combined with the other path.

This value can be NULL.

Return Value

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

Remarks

See Also