mirror of
https://github.com/reactos/reactos.git
synced 2025-04-22 13:10:39 +00:00
[MSFS]
- Use a NULL timeout for infinite waits instead of waiting for 100 ns. CORE-10188 #resolve - Wait for available read data in user mode to handle thread termination - Return STATUS_IO_TIMEOUT also for a zero-length timeout. Fixes Wine tests - Avoid MmGetSystemAddressForMdl - Acquiring a mutex is not a UserRequest svn path=/trunk/; revision=69236
This commit is contained in:
parent
6f03428919
commit
eb834cf62f
2 changed files with 13 additions and 7 deletions
|
@ -54,7 +54,7 @@ typedef struct _MSFS_MESSAGE
|
|||
|
||||
|
||||
#define KeLockMutex(x) KeWaitForSingleObject(x, \
|
||||
UserRequest, \
|
||||
Executive, \
|
||||
KernelMode, \
|
||||
FALSE, \
|
||||
NULL);
|
||||
|
|
|
@ -29,6 +29,7 @@ MsfsRead(PDEVICE_OBJECT DeviceObject,
|
|||
ULONG LengthRead = 0;
|
||||
PVOID Buffer;
|
||||
NTSTATUS Status;
|
||||
PLARGE_INTEGER Timeout;
|
||||
|
||||
DPRINT("MsfsRead(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
|
||||
|
||||
|
@ -52,16 +53,21 @@ MsfsRead(PDEVICE_OBJECT DeviceObject,
|
|||
|
||||
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)
|
||||
{
|
||||
|
@ -84,7 +90,7 @@ MsfsRead(PDEVICE_OBJECT DeviceObject,
|
|||
KeClearEvent(&Fcb->MessageEvent);
|
||||
}
|
||||
}
|
||||
else if (Fcb->TimeOut.QuadPart != 0LL)
|
||||
else
|
||||
{
|
||||
/* No message found after waiting */
|
||||
Status = STATUS_IO_TIMEOUT;
|
||||
|
@ -135,7 +141,7 @@ MsfsWrite(PDEVICE_OBJECT DeviceObject,
|
|||
|
||||
Length = IoStack->Parameters.Write.Length;
|
||||
if (Irp->MdlAddress)
|
||||
Buffer = MmGetSystemAddressForMdl (Irp->MdlAddress);
|
||||
Buffer = MmGetSystemAddressForMdlSafe(Irp->MdlAddress, NormalPagePriority);
|
||||
else
|
||||
Buffer = Irp->UserBuffer;
|
||||
|
||||
|
|
Loading…
Reference in a new issue