diff --git a/reactos/drivers/filesystems/fastfat/fastio.c b/reactos/drivers/filesystems/fastfat/fastio.c index 074defc6bc0..8b4d2b1bf78 100644 --- a/reactos/drivers/filesystems/fastfat/fastio.c +++ b/reactos/drivers/filesystems/fastfat/fastio.c @@ -1,9 +1,10 @@ /* - * FILE: drivers/fs/vfat/fastio.c + * FILE: drivers/filesystems/fastfat/fastio.c * PURPOSE: Fast IO routines. * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel * PROGRAMMER: Herve Poussineau (hpoussin@reactos.org) + * Pierre Schweitzer (pierre@reactos.org) */ #include "vfat.h" @@ -111,15 +112,51 @@ VfatFastIoQueryBasicInfo( OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject) { + NTSTATUS Status; + PVFATFCB FCB = NULL; + BOOLEAN Success = FALSE; + ULONG BufferLength = sizeof(FILE_BASIC_INFORMATION); + DPRINT("VfatFastIoQueryBasicInfo()\n"); - UNREFERENCED_PARAMETER(FileObject); - UNREFERENCED_PARAMETER(Wait); - UNREFERENCED_PARAMETER(Buffer); - UNREFERENCED_PARAMETER(IoStatus); - UNREFERENCED_PARAMETER(DeviceObject); + FCB = (PVFATFCB)FileObject->FsContext; + if (FCB == NULL) + { + return FALSE; + } - return FALSE; + FsRtlEnterFileSystem(); + + if (!(FCB->Flags & FCB_IS_PAGE_FILE)) + { + if (!ExAcquireResourceSharedLite(&FCB->MainResource, Wait)) + { + FsRtlExitFileSystem(); + return FALSE; + } + } + + Status = VfatGetBasicInformation(FileObject, + FCB, + DeviceObject, + Buffer, + &BufferLength); + + if (!(FCB->Flags & FCB_IS_PAGE_FILE)) + { + ExReleaseResourceLite(&FCB->MainResource); + } + + if (NT_SUCCESS(Status)) + { + IoStatus->Status = STATUS_SUCCESS; + IoStatus->Information = sizeof(FILE_BASIC_INFORMATION) - BufferLength; + Success = TRUE; + } + + FsRtlExitFileSystem(); + + return Success; } static FAST_IO_QUERY_STANDARD_INFO VfatFastIoQueryStandardInfo; @@ -134,15 +171,51 @@ VfatFastIoQueryStandardInfo( OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject) { - DPRINT("VfatFastIoQueryStandardInfo\n"); + NTSTATUS Status; + PVFATFCB FCB = NULL; + BOOLEAN Success = FALSE; + ULONG BufferLength = sizeof(FILE_STANDARD_INFORMATION); + + DPRINT("VfatFastIoQueryStandardInfo()\n"); - UNREFERENCED_PARAMETER(FileObject); - UNREFERENCED_PARAMETER(Wait); - UNREFERENCED_PARAMETER(Buffer); - UNREFERENCED_PARAMETER(IoStatus); UNREFERENCED_PARAMETER(DeviceObject); - return FALSE; + FCB = (PVFATFCB)FileObject->FsContext; + if (FCB == NULL) + { + return FALSE; + } + + FsRtlEnterFileSystem(); + + if (!(FCB->Flags & FCB_IS_PAGE_FILE)) + { + if (!ExAcquireResourceSharedLite(&FCB->MainResource, Wait)) + { + FsRtlExitFileSystem(); + return FALSE; + } + } + + Status = VfatGetStandardInformation(FCB, + Buffer, + &BufferLength); + + if (!(FCB->Flags & FCB_IS_PAGE_FILE)) + { + ExReleaseResourceLite(&FCB->MainResource); + } + + if (NT_SUCCESS(Status)) + { + IoStatus->Status = STATUS_SUCCESS; + IoStatus->Information = sizeof(FILE_STANDARD_INFORMATION) - BufferLength; + Success = TRUE; + } + + FsRtlExitFileSystem(); + + return Success; } static FAST_IO_LOCK VfatFastIoLock; diff --git a/reactos/drivers/filesystems/fastfat/finfo.c b/reactos/drivers/filesystems/fastfat/finfo.c index 6efe264cf8f..9a359913a30 100644 --- a/reactos/drivers/filesystems/fastfat/finfo.c +++ b/reactos/drivers/filesystems/fastfat/finfo.c @@ -71,7 +71,6 @@ const char* FileInformationClassNames[] = /* * FUNCTION: Retrieve the standard file information */ -static NTSTATUS VfatGetStandardInformation( PVFATFCB FCB, @@ -236,7 +235,6 @@ VfatSetBasicInformation( return STATUS_SUCCESS; } -static NTSTATUS VfatGetBasicInformation( PFILE_OBJECT FileObject, diff --git a/reactos/drivers/filesystems/fastfat/vfat.h b/reactos/drivers/filesystems/fastfat/vfat.h index bc6ac515b6d..2c4a6afb519 100644 --- a/reactos/drivers/filesystems/fastfat/vfat.h +++ b/reactos/drivers/filesystems/fastfat/vfat.h @@ -874,6 +874,20 @@ vfatMakeFCBFromDirEntry( /* finfo.c */ +NTSTATUS +VfatGetStandardInformation( + PVFATFCB FCB, + PFILE_STANDARD_INFORMATION StandardInfo, + PULONG BufferLength); + +NTSTATUS +VfatGetBasicInformation( + PFILE_OBJECT FileObject, + PVFATFCB FCB, + PDEVICE_OBJECT DeviceObject, + PFILE_BASIC_INFORMATION BasicInfo, + PULONG BufferLength); + NTSTATUS VfatQueryInformation( PVFAT_IRP_CONTEXT IrpContext);