return Status;
}
-PVOID
-FatMapUserBuffer(
- IN OUT PIRP Irp)
-/*
- * FUNCTION:
- *
- *
- * ARGUMENTS:
- * IrpContext = Pointer to FCB structure for the file.
- * Irp = Pointer to the IRP structure
- * RETURNS: Status Value.
- * NOTES:
- */
-{
- PVOID Address;
-
- if (Irp->MdlAddress == NULL)
- return Irp->UserBuffer;
- Address = MmGetSystemAddressForMdlSafe(Irp->MdlAddress, NormalPagePriority);
- if (Address == NULL)
- ExRaiseStatus( STATUS_INVALID_USER_BUFFER );
- return Address;
-}
-
NTSTATUS
FatLockUserBuffer (
IN PFAT_IRP_CONTEXT IrpContext,
ExReleaseResourceLite(&Vcb->Resource);
}
+PVOID
+FASTCALL
+FatMapUserBuffer(PIRP Irp)
+{
+ if (!Irp->MdlAddress)
+ return Irp->UserBuffer;
+ else
+ return MmGetSystemAddressForMdlSafe(Irp->MdlAddress, NormalPagePriority);
+}
/* EOF */
IN PLARGE_INTEGER Offset,
IN SIZE_T Length);
-PVOID
-FatMapUserBuffer(
- IN OUT PIRP Irp);
-
/* ----------------------------------------------------------- dir.c */
NTSTATUS NTAPI
PVOID Fcb,
PCCB Ccb);
+PVOID FASTCALL
+FatMapUserBuffer(PIRP Irp);
+
/* --------------------------------------------------------- fullfat.c */
FF_T_SINT32
PBCB Bcb;
ULONG SectorSize = 512; // FIXME: hardcoding 512 is bad
- DPRINT1("FatReadBlocks %p %d %d %p\n", DestBuffer, SectorAddress, Count, pParam);
+ DPRINT("FatReadBlocks %p %d %d %p\n", DestBuffer, SectorAddress, Count, pParam);
/* Calculate the offset */
Offset.QuadPart = Int32x32To64(SectorAddress, SectorSize);
PFCB Fcb;
PVCB Vcb;
PCCB Ccb;
+ PVOID Buffer;
+ LONG BytesRead;
FileObject = IrpSp->FileObject;
NumberOfBytes = IrpSp->Parameters.Read.Length;
DPRINT1("FatiRead() Fcb %p, Name %wZ, Offset %d, Length %d, Handle %p\n",
Fcb, &FileObject->FileName, ByteOffset.LowPart, NumberOfBytes, Fcb->FatHandle);
- return STATUS_NOT_IMPLEMENTED;
+
+ /* Perform actual read */
+
+ if (IrpContext->MinorFunction & IRP_MN_MDL)
+ {
+ DPRINT1("MDL read\n");
+ }
+ else
+ {
+ Buffer = FatMapUserBuffer(IrpContext->Irp);
+ DPRINT1("Normal cached read, buffer %p\n");
+
+ BytesRead = FF_Read(Fcb->FatHandle, NumberOfBytes, 1, Buffer);
+ DPRINT1("Read %d bytes\n", BytesRead);
+
+ /* Indicate we read requested amount of bytes */
+ IrpContext->Irp->IoStatus.Information = BytesRead;
+ IrpContext->Irp->IoStatus.Status = STATUS_SUCCESS;
+ }
+
+ /* Complete the request */
+ FatCompleteRequest(IrpContext, IrpContext->Irp, STATUS_SUCCESS);
+ return STATUS_SUCCESS;
}
NTSTATUS