ShlwApiPathAddExtension Method

Note: This API is now obsolete.
Adds a file name extension to a path string.

Note: Misuse of this function can lead to a buffer overrun. We recommend the use of the safer PathCchAddExtension(StringBuilder, UInt32, String) function in its place.

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("ShlwApi.dll", CharSet = CharSet.Auto, BestFitMapping = false, 
	ThrowOnUnmappableChar = true, SetLastError = true)]
[ObsoleteAttribute("Misuse of this function can lead to a buffer overrun. We recommend the use of the safer NativeMethods.PathCchAddExtension function in its place.", 
	false)]
public static bool PathAddExtension(
	StringBuilder path,
	string ext
)

Parameters

path  StringBuilder
A pointer to a buffer with the null-terminated string to which the file name extension will be appended.

You must set the size of this buffer to MAX_PATH to ensure that it is large enough to hold the returned string.

ext  String
A pointer to a null-terminated string that contains the file name extension. This value can be NULL.

Return Value

Boolean
Returns if an extension was added, or otherwise.

Remarks

See Also