KernelBasePathCchAddBackslashEx Method
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.
This function differs from
PathCchAddBackslash(StringBuilder, UInt32) in that
it can return a pointer to the new end of the string and report the number of unused characters remaining in the buffer.
This function differs from
PathAddBackslash(StringBuilder) in that it accepts paths with "\", "\?" and "\?\UNC" prefixes.
Note: This function, or
PathCchAddBackslashEx(StringBuilder, UInt32, IntPtr, UInt32),
should be used in place of
PathAddBackslash(StringBuilder) to prevent the possibility of a buffer overrun.
Namespace: DevCase.Win32.NativeMethodsAssembly: 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 PathCchAddBackslashEx(
StringBuilder buffer,
uint bufferSize,
out IntPtr refEnd,
out uint refRemaining
)
<DllImportAttribute("KernelBase.dll", CharSet := CharSet.Auto, BestFitMapping := false,
ThrowOnUnmappableChar := true>]
Public Shared Function PathCchAddBackslashEx (
buffer As StringBuilder,
bufferSize As UInteger,
<OutAttribute> ByRef refEnd As IntPtr,
<OutAttribute> ByRef refRemaining As UInteger
) As HResult
Dim buffer As StringBuilder
Dim bufferSize As UInteger
Dim refEnd As IntPtr
Dim refRemaining As UInteger
Dim returnValue As HResult
returnValue = KernelBase.PathCchAddBackslashEx(buffer,
bufferSize, refEnd, refRemaining)
public:
[DllImportAttribute(L"KernelBase.dll", CharSet = CharSet::Auto, BestFitMapping = false,
ThrowOnUnmappableChar = true)]
static HResult PathCchAddBackslashEx(
StringBuilder^ buffer,
unsigned int bufferSize,
[OutAttribute] IntPtr% refEnd,
[OutAttribute] unsigned int% refRemaining
)
[<DllImportAttribute("KernelBase.dll", CharSet = CharSet.Auto, BestFitMapping = false,
ThrowOnUnmappableChar = true)>]
static member PathCchAddBackslashEx :
buffer : StringBuilder *
bufferSize : uint32 *
refEnd : IntPtr byref *
refRemaining : uint32 byref -> HResult
No code example is currently available or this language may not be supported.
- buffer StringBuilder
-
A pointer to the path string.
When this function returns successfully, the buffer contains the string with the appended backslash.
This value should not be NULL.
- bufferSize UInt32
-
The size of the buffer pointed to by buffer, in characters.
- refEnd IntPtr
-
A value that, when this function returns successfully,
receives the address of a pointer to the terminating null character at the end of the string.
- refRemaining UInt32
-
A pointer to a value that, when this function returns successfully,
is set to the number of unused characters in the destination buffer,
including the terminating null character.
HResult
This function returns
S_OK if the function was successful,
S_FALSE if the path string already ends in a backslash,
or an error code otherwise.