https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0979fb29e2647a607c404…
commit 0979fb29e2647a607c40497f743cd6958931517c
Author: Hervé Poussineau <hpoussin(a)reactos.org>
AuthorDate: Tue Sep 13 23:24:39 2022 +0200
Commit: hpoussin <32227662+hpoussin(a)users.noreply.github.com>
CommitDate: Sat Sep 24 12:12:33 2022 +0200
[VFATFS] Always provide a short name for FATX files (equal to long name)
If no short name is provided, driver will think that the partition is corrupted.
CORE-16373
---
drivers/filesystems/vfatfs/direntry.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/filesystems/vfatfs/direntry.c
b/drivers/filesystems/vfatfs/direntry.c
index 2247637c8b3..8b5f8757319 100644
--- a/drivers/filesystems/vfatfs/direntry.c
+++ b/drivers/filesystems/vfatfs/direntry.c
@@ -497,10 +497,9 @@ FATXGetNextDirEntry(
switch (DirContext->DirIndex)
{
case 0: /* entry . */
- DirContext->ShortNameU.Buffer[0] = 0;
- DirContext->ShortNameU.Length = 0;
wcscpy(DirContext->LongNameU.Buffer, L".");
DirContext->LongNameU.Length = sizeof(WCHAR);
+ DirContext->ShortNameU = DirContext->LongNameU;
RtlCopyMemory(&DirContext->DirEntry.FatX,
&pDirFcb->entry.FatX, sizeof(FATX_DIR_ENTRY));
DirContext->DirEntry.FatX.Filename[0] = '.';
DirContext->DirEntry.FatX.FilenameLength = 1;
@@ -508,10 +507,9 @@ FATXGetNextDirEntry(
return STATUS_SUCCESS;
case 1: /* entry .. */
- DirContext->ShortNameU.Buffer[0] = 0;
- DirContext->ShortNameU.Length = 0;
wcscpy(DirContext->LongNameU.Buffer, L"..");
DirContext->LongNameU.Length = 2 * sizeof(WCHAR);
+ DirContext->ShortNameU = DirContext->LongNameU;
RtlCopyMemory(&DirContext->DirEntry.FatX,
&pDirFcb->entry.FatX, sizeof(FATX_DIR_ENTRY));
DirContext->DirEntry.FatX.Filename[0] =
DirContext->DirEntry.FatX.Filename[1] = '.';
DirContext->DirEntry.FatX.FilenameLength = 2;
@@ -603,10 +601,9 @@ FATXGetNextDirEntry(
fatxDirEntry++;
}
}
- DirContext->ShortNameU.Buffer[0] = 0;
- DirContext->ShortNameU.Length = 0;
StringO.Buffer = (PCHAR)fatxDirEntry->Filename;
StringO.Length = StringO.MaximumLength = fatxDirEntry->FilenameLength;
RtlOemStringToUnicodeString(&DirContext->LongNameU, &StringO, FALSE);
+ DirContext->ShortNameU = DirContext->LongNameU;
return STATUS_SUCCESS;
}