ULONG LengthRead = 0;
PVOID Buffer;
NTSTATUS Status;
+ PLARGE_INTEGER Timeout;
DPRINT("MsfsRead(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
Length = IoStack->Parameters.Read.Length;
if (Irp->MdlAddress)
- Buffer = MmGetSystemAddressForMdl (Irp->MdlAddress);
+ Buffer = MmGetSystemAddressForMdlSafe(Irp->MdlAddress, NormalPagePriority);
else
Buffer = Irp->UserBuffer;
+ if (Fcb->TimeOut.QuadPart == -1LL)
+ Timeout = NULL;
+ else
+ Timeout = &Fcb->TimeOut;
+
Status = KeWaitForSingleObject(&Fcb->MessageEvent,
UserRequest,
- KernelMode,
+ UserMode,
FALSE,
- &Fcb->TimeOut);
- if (NT_SUCCESS(Status))
+ Timeout);
+ if (Status != STATUS_USER_APC)
{
if (Fcb->MessageCount > 0)
{
KeClearEvent(&Fcb->MessageEvent);
}
}
- else if (Fcb->TimeOut.QuadPart != 0LL)
+ else
{
/* No message found after waiting */
Status = STATUS_IO_TIMEOUT;
Length = IoStack->Parameters.Write.Length;
if (Irp->MdlAddress)
- Buffer = MmGetSystemAddressForMdl (Irp->MdlAddress);
+ Buffer = MmGetSystemAddressForMdlSafe(Irp->MdlAddress, NormalPagePriority);
else
Buffer = Irp->UserBuffer;