KernelBasePathCchRemoveFileSpec Method
Removes the last element in a path string, whether that element is a file name or a directory name.
The element's leading backslash is also removed.
This function differs from
PathRemoveFileSpec(StringBuilder) in that it accepts paths with "\", "\?" and "\?\UNC" prefixes.
Note: This function should be used in place of
PathRemoveFileSpec(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 PathCchRemoveFileSpec(
StringBuilder buffer,
uint bufferSize
)
<DllImportAttribute("KernelBase.dll", CharSet := CharSet.Auto, BestFitMapping := false,
ThrowOnUnmappableChar := true>]
Public Shared Function PathCchRemoveFileSpec (
buffer As StringBuilder,
bufferSize As UInteger
) As HResult
Dim buffer As StringBuilder
Dim bufferSize As UInteger
Dim returnValue As HResult
returnValue = KernelBase.PathCchRemoveFileSpec(buffer,
bufferSize)
public:
[DllImportAttribute(L"KernelBase.dll", CharSet = CharSet::Auto, BestFitMapping = false,
ThrowOnUnmappableChar = true)]
static HResult PathCchRemoveFileSpec(
StringBuilder^ buffer,
unsigned int bufferSize
)
[<DllImportAttribute("KernelBase.dll", CharSet = CharSet.Auto, BestFitMapping = false,
ThrowOnUnmappableChar = true)>]
static member PathCchRemoveFileSpec :
buffer : StringBuilder *
bufferSize : uint32 -> HResult
No code example is currently available or this language may not be supported.
- buffer StringBuilder
-
A pointer to the fully-qualified path string.
When this function returns successfully, the string will have had its last element and its leading backslash removed.
This function does not affect root paths such as "C:".
In the case of a root path, the path string is returned unaltered.
If a path string ends with a trailing backslash, only that backslash is removed.
- bufferSize UInt32
-
The size of the buffer pointed to by buffer, in characters.
HResult
This function returns
S_OK if the function was successful,
S_FALSE if there was nothing to remove, or an error code otherwise.