KernelBasePathCchAddExtension Method

Adds a file name extension to a path string.

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

Note: This function should be used in place of PathAddExtension(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 PathCchAddExtension(
	StringBuilder buffer,
	uint bufferSize,
	string ext
)

Parameters

buffer  StringBuilder
A pointer to the path string.

When this function returns successfully, the buffer contains the string with the appended extension.

This value should not be NULL.

bufferSize  UInt32
The size of the buffer pointed to by buffer, in characters.
ext  String
A pointer to the file name extension string. This string can be given either with or without a preceding period (".ext" or "ext").

Return Value

HResult
If this function succeeds, it returns S_OK. Otherwise, it returns an HResult code.

Remarks

See Also