From 818f6c4bfc1140e5a0e33e489a31f35f36266e5a Mon Sep 17 00:00:00 2001 From: Hartmut Birr Date: Sat, 28 Jul 2001 10:12:36 +0000 Subject: [PATCH] Fixed a bug FsdGetFsVolumeInformation(). The returned length was wrong. svn path=/trunk/; revision=2113 --- reactos/drivers/fs/vfat/volume.c | 42 +++++++++++++++++--------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/reactos/drivers/fs/vfat/volume.c b/reactos/drivers/fs/vfat/volume.c index 907b9c27828..234f26392d7 100644 --- a/reactos/drivers/fs/vfat/volume.c +++ b/reactos/drivers/fs/vfat/volume.c @@ -1,4 +1,4 @@ -/* $Id: volume.c,v 1.11 2001/07/20 08:00:21 ekohl Exp $ +/* $Id: volume.c,v 1.12 2001/07/28 10:12:36 hbirr Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -27,15 +27,17 @@ FsdGetFsVolumeInformation(PFILE_OBJECT FileObject, PULONG BufferLength) { ULONG LabelLength; - + DPRINT("FsdGetFsVolumeInformation()\n"); DPRINT("FsVolumeInfo = %p\n", FsVolumeInfo); DPRINT("BufferLength %lu\n", *BufferLength); - DPRINT("Required length %lu\n", (sizeof(FILE_FS_VOLUME_INFORMATION) + LabelLength)); - + LabelLength = DeviceObject->Vpb->VolumeLabelLength; + + DPRINT("Required length %lu\n", (sizeof(FILE_FS_VOLUME_INFORMATION) + LabelLength*sizeof(WCHAR))); DPRINT("LabelLength %lu\n", LabelLength); - + DPRINT("Label %S\n", DeviceObject->Vpb->VolumeLabel); + /* FIXME: This does not work correctly! Why?? */ // if (*BufferLength < (sizeof(FILE_FS_VOLUME_INFORMATION) + LabelLength)); // return(STATUS_BUFFER_OVERFLOW); @@ -44,17 +46,17 @@ FsdGetFsVolumeInformation(PFILE_OBJECT FileObject, FsVolumeInfo->VolumeSerialNumber = DeviceObject->Vpb->SerialNumber; FsVolumeInfo->VolumeLabelLength = LabelLength; wcscpy(FsVolumeInfo->VolumeLabel, DeviceObject->Vpb->VolumeLabel); - + /* dummy entries */ FsVolumeInfo->VolumeCreationTime.QuadPart = 0; FsVolumeInfo->SupportsObjects = FALSE; - + DPRINT("Finished FsdGetFsVolumeInformation()\n"); - - *BufferLength -= (sizeof(FILE_FS_VOLUME_INFORMATION) + LabelLength); - + + *BufferLength -= (sizeof(FILE_FS_VOLUME_INFORMATION) + LabelLength * sizeof(WCHAR)); + DPRINT("BufferLength %lu\n", *BufferLength); - + return(STATUS_SUCCESS); } @@ -67,22 +69,22 @@ FsdGetFsAttributeInformation(PFILE_FS_ATTRIBUTE_INFORMATION FsAttributeInfo, DPRINT("FsAttributeInfo = %p\n", FsAttributeInfo); DPRINT("BufferLength %lu\n", *BufferLength); DPRINT("Required length %lu\n", (sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + 6)); - + /* FIXME: This does not work correctly! Why?? */ // if (*BufferLength < (sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + 6)); // return(STATUS_BUFFER_OVERFLOW); - + FsAttributeInfo->FileSystemAttributes = FILE_CASE_PRESERVED_NAMES | FILE_UNICODE_ON_DISK; FsAttributeInfo->MaximumComponentNameLength = 255; FsAttributeInfo->FileSystemNameLength = 6; wcscpy(FsAttributeInfo->FileSystemName, L"FAT"); - + DPRINT("Finished FsdGetFsAttributeInformation()\n"); - + *BufferLength -= (sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + 6); DPRINT("BufferLength %lu\n", *BufferLength); - + return(STATUS_SUCCESS); } @@ -94,16 +96,16 @@ FsdGetFsSizeInformation(PDEVICE_OBJECT DeviceObject, { PDEVICE_EXTENSION DeviceExt; NTSTATUS Status; - + DPRINT("FsdGetFsSizeInformation()\n"); DPRINT("FsSizeInfo = %p\n", FsSizeInfo); - + /* FIXME: This does not work correctly! Why?? */ // if (*BufferLength < sizeof(FILE_FS_SIZE_INFORMATION)); // return(STATUS_BUFFER_OVERFLOW); - + DeviceExt = DeviceObject->DeviceExtension; - + if (DeviceExt->FatType == FAT32) { struct _BootSector32 *BootSect =