Oops, thanks for the correction! I must've seen this with other characters (most likely double quotes) and not realized slashes and backslashes are an exception.
Though ironically that still doesn't help you strip the last component, since it could still be a volume mount point. Like you don't want C:\mnt\..\foo to suddenly become C:\foo, just like how you don't want \\.\Server\Share1\..\Share2 to become \\.\Server\Share2, or for \\.\C:\..\HarddiskVolume1 to become \\.\HarddiskVolume1, etc.
> All Unicode characters are legal in a streamname component except the following:
> * The characters \ / :
> * Control character 0x00.
> * A streamname MUST be no more than 255 characters in length.
>
> A zero-length streamname denotes the default stream.
https://learn.microsoft.com/en-us/openspecs/windows_protocol...