[FASTFAT] Don't add an extra \, when renaming a file at root.

This fixes failures to rename a file where destination is
the root of a FAT volume.

CORE-10503
This commit is contained in:
Pierre Schweitzer 2018-06-09 22:17:17 +02:00
parent 6aa4beeefb
commit 52f0f80a83
No known key found for this signature in database
GPG key ID: 7545556C3D585B0B

View file

@ -787,8 +787,12 @@ VfatSetRenameInformation(
} }
RtlCopyUnicodeString(&NewName, &((PVFATFCB)TargetFileObject->FsContext)->PathNameU); RtlCopyUnicodeString(&NewName, &((PVFATFCB)TargetFileObject->FsContext)->PathNameU);
NewName.Buffer[NewName.Length / sizeof(WCHAR)] = L'\\'; /* If \, it's already backslash terminated, don't add it */
NewName.Length += sizeof(WCHAR); if (!vfatFCBIsRoot(TargetFileObject->FsContext))
{
NewName.Buffer[NewName.Length / sizeof(WCHAR)] = L'\\';
NewName.Length += sizeof(WCHAR);
}
RtlAppendUnicodeStringToString(&NewName, &TargetFileObject->FileName); RtlAppendUnicodeStringToString(&NewName, &TargetFileObject->FileName);
} }