ShlwApiPathAddBackslash Method

Note: This API is now obsolete.
Adds a backslash to the end of a string to create the correct syntax for a path.

If the source path already has a trailing backslash, no backslash will be added.

Note: Misuse of this function can lead to a buffer overrun. We recommend the use of the safer PathCchAddBackslash(StringBuilder, UInt32) or PathCchAddBackslashEx(StringBuilder, UInt32, IntPtr, UInt32) 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.PathCchAddBackslash or NativeMethods.PathCchAddBackslashEx function in its place.", 
	false)]
public static IntPtr PathAddBackslash(
	StringBuilder path
)

Parameters

path  StringBuilder
A pointer to a buffer with a string that represents a path.

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

Return Value

IntPtr
A pointer that, when this function returns successfully, points to the new string's terminating null character.

If the backslash could not be appended due to inadequate buffer size, this value is NULL.

Remarks

See Also