reworked the code in drivers/fs/vfat/volume.c: FsdGetFsAttributeInformation no longer copies null terminator. Verified GetVolumeInformation still works correctly.

svn path=/trunk/; revision=5190
This commit is contained in:
Royce Mitchell III 2003-07-20 18:36:53 +00:00
parent a084794f67
commit e475cbc5d8

View file

@ -1,4 +1,4 @@
/* $Id: volume.c,v 1.18 2003/07/20 01:48:46 royce Exp $ /* $Id: volume.c,v 1.19 2003/07/20 18:36:53 royce Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -66,8 +66,7 @@ FsdGetFsAttributeInformation(PDEVICE_EXTENSION DeviceExt,
PFILE_FS_ATTRIBUTE_INFORMATION FsAttributeInfo, PFILE_FS_ATTRIBUTE_INFORMATION FsAttributeInfo,
PULONG BufferLength) PULONG BufferLength)
{ {
ULONG Length = DeviceExt->FatInfo.FatType == FAT32 ? 10 : 6; WCHAR* pName; ULONG Length;
DPRINT("FsdGetFsAttributeInformation()\n"); DPRINT("FsdGetFsAttributeInformation()\n");
DPRINT("FsAttributeInfo = %p\n", FsAttributeInfo); DPRINT("FsAttributeInfo = %p\n", FsAttributeInfo);
DPRINT("BufferLength %lu\n", *BufferLength); DPRINT("BufferLength %lu\n", *BufferLength);
@ -76,21 +75,28 @@ FsdGetFsAttributeInformation(PDEVICE_EXTENSION DeviceExt,
if (*BufferLength < sizeof (FILE_FS_ATTRIBUTE_INFORMATION)) if (*BufferLength < sizeof (FILE_FS_ATTRIBUTE_INFORMATION))
return STATUS_INFO_LENGTH_MISMATCH; return STATUS_INFO_LENGTH_MISMATCH;
if (DeviceExt->FatInfo.FatType == FAT32)
{
Length = 10;
pName = L"FAT32";
}
else
{
Length = 6;
pName = L"FAT";
}
if (*BufferLength < (sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + Length)) if (*BufferLength < (sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + Length))
return STATUS_BUFFER_OVERFLOW; return STATUS_BUFFER_OVERFLOW;
FsAttributeInfo->FileSystemAttributes = FsAttributeInfo->FileSystemAttributes =
FILE_CASE_PRESERVED_NAMES | FILE_UNICODE_ON_DISK; FILE_CASE_PRESERVED_NAMES | FILE_UNICODE_ON_DISK;
FsAttributeInfo->MaximumComponentNameLength = 255; FsAttributeInfo->MaximumComponentNameLength = 255;
FsAttributeInfo->FileSystemNameLength = Length; FsAttributeInfo->FileSystemNameLength = Length;
if (DeviceExt->FatInfo.FatType == FAT32)
{ memcpy(FsAttributeInfo->FileSystemName, pName, Length );
memcpy(FsAttributeInfo->FileSystemName, L"FAT32\0", 12);
}
else
{
memcpy(FsAttributeInfo->FileSystemName, L"FAT\0", 8);
}
DPRINT("Finished FsdGetFsAttributeInformation()\n"); DPRINT("Finished FsdGetFsAttributeInformation()\n");