From 093e6f6d3c0519815c0141c7e2f37328b5687100 Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Fri, 23 Jan 2009 09:41:30 +0000 Subject: [PATCH] Alex Vlasov - Implement FatRead as a wrapper around internal helper FatiRead. - Stubplement FatiRead. svn path=/trunk/; revision=39029 --- reactos/drivers/filesystems/fastfat_new/rw.c | 59 +++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/reactos/drivers/filesystems/fastfat_new/rw.c b/reactos/drivers/filesystems/fastfat_new/rw.c index 948d780a226..a2223fb7498 100644 --- a/reactos/drivers/filesystems/fastfat_new/rw.c +++ b/reactos/drivers/filesystems/fastfat_new/rw.c @@ -4,6 +4,7 @@ * FILE: drivers/filesystems/fastfat/rw.c * PURPOSE: Read/write support * PROGRAMMERS: Aleksey Bragin (aleksey@reactos.org) + * Alexey Vlasov */ /* INCLUDES *****************************************************************/ @@ -13,12 +14,68 @@ /* FUNCTIONS *****************************************************************/ +NTSTATUS +NTAPI +FatiRead(PFAT_IRP_CONTEXT IrpContext) +{ + CSHORT FcbType; + ULONG NumberOfBytes; + + FcbType = *((PCSHORT) IrpContext->FileObject->FsContext); + NumberOfBytes = IrpContext->Stack->Parameters.Read.Length; + if (NumberOfBytes == 0) + { + FatCompleteRequest(IrpContext, IrpContext->Irp, STATUS_SUCCESS); + return STATUS_SUCCESS; + } + //if (FcbType == FAT_NTC_VCB) + + DPRINT1("FatiRead()\n"); + return STATUS_NOT_IMPLEMENTED; +} + NTSTATUS NTAPI FatRead(PDEVICE_OBJECT DeviceObject, PIRP Irp) { + NTSTATUS Status; + BOOLEAN TopLevel, CanWait; + PFAT_IRP_CONTEXT IrpContext; + + CanWait = TRUE; + TopLevel = FALSE; + Status = STATUS_INVALID_DEVICE_REQUEST; + /* Get CanWait flag */ + if (IoGetCurrentIrpStackLocation(Irp)->FileObject != NULL) + CanWait = IoIsOperationSynchronous(Irp); + + /* Enter FsRtl critical region */ + FsRtlEnterFileSystem(); + + if (DeviceObject != FatGlobalData.DiskDeviceObject) + { + /* Set Top Level IRP if not set */ + if (IoGetTopLevelIrp() == NULL) + { + IoSetTopLevelIrp(Irp); + TopLevel = TRUE; + } + + /* Build an irp context */ + IrpContext = FatBuildIrpContext(Irp, CanWait); + + /* Perform the actual read */ + Status = FatiRead(IrpContext); + + /* Restore top level Irp */ + if (TopLevel) + IoSetTopLevelIrp(NULL); + } + /* Leave FsRtl critical region */ + FsRtlExitFileSystem(); + DPRINT1("FatRead()\n"); - return STATUS_NOT_IMPLEMENTED; + return Status; } NTSTATUS