PFCB Fcb;
PVCB Vcb;
PCCB Ccb;
+ PVOID Buffer;
+ LONG BytesRead;
FileObject = IrpSp->FileObject;
NumberOfBytes = IrpSp->Parameters.Read.Length;
OpenType = FatDecodeFileObject(FileObject, &Vcb, &Fcb, &Ccb);
- DPRINT1("FatiRead() Fcb %p, Name %wZ, Offset %d, Length %d\n",
- Fcb, &FileObject->FileName, ByteOffset.LowPart, NumberOfBytes);
- return STATUS_NOT_IMPLEMENTED;
+ DPRINT1("FatiRead() Fcb %p, Name %wZ, Offset %d, Length %d, Handle %p\n",
+ Fcb, &FileObject->FileName, ByteOffset.LowPart, NumberOfBytes, Fcb->FatHandle);
+
+ /* 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");
+
+ /* Set offset */
+ FF_Seek(Fcb->FatHandle, ByteOffset.LowPart, FF_SEEK_SET);
+
+ /* Read */
+ 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