From 2b6504d6a9434ec384598b23eb1c99c1692ee286 Mon Sep 17 00:00:00 2001 From: Phillip Susi Date: Sat, 20 Apr 2002 03:46:40 +0000 Subject: [PATCH] Some more fixes to the IO manager routines to use the KEVENT in the FILE_OBJECT correctly svn path=/trunk/; revision=2862 --- reactos/ntoskrnl/io/flush.c | 8 +++----- reactos/ntoskrnl/io/rw.c | 7 +++++-- reactos/ntoskrnl/io/vpb.c | 32 ++++++++++---------------------- 3 files changed, 18 insertions(+), 29 deletions(-) diff --git a/reactos/ntoskrnl/io/flush.c b/reactos/ntoskrnl/io/flush.c index d3cd5606f0b..078f5ea767e 100644 --- a/reactos/ntoskrnl/io/flush.c +++ b/reactos/ntoskrnl/io/flush.c @@ -47,7 +47,6 @@ NtFlushBuffersFile ( PFILE_OBJECT FileObject = NULL; PIRP Irp; PIO_STACK_LOCATION StackPtr; - KEVENT Event; NTSTATUS Status; IO_STATUS_BLOCK IoSB; @@ -61,14 +60,13 @@ NtFlushBuffersFile ( { return(Status); } - - KeInitializeEvent(&Event,NotificationEvent,FALSE); + KeResetEvent( &FileObject->Event ); Irp = IoBuildSynchronousFsdRequest(IRP_MJ_FLUSH_BUFFERS, FileObject->DeviceObject, NULL, 0, NULL, - &Event, + &FileObject->Event, &IoSB); StackPtr = IoGetNextIrpStackLocation(Irp); @@ -77,7 +75,7 @@ NtFlushBuffersFile ( Status = IoCallDriver(FileObject->DeviceObject,Irp); if (Status==STATUS_PENDING) { - KeWaitForSingleObject(&Event,Executive,KernelMode,FALSE,NULL); + KeWaitForSingleObject(&FileObject->Event,Executive,KernelMode,FALSE,NULL); Status = IoSB.Status; } if (IoStatusBlock) diff --git a/reactos/ntoskrnl/io/rw.c b/reactos/ntoskrnl/io/rw.c index a0bffd8d8d5..6c21d9f27d1 100644 --- a/reactos/ntoskrnl/io/rw.c +++ b/reactos/ntoskrnl/io/rw.c @@ -1,4 +1,4 @@ -/* $Id: rw.c,v 1.35 2002/04/07 18:36:13 phreak Exp $ +/* $Id: rw.c,v 1.36 2002/04/20 03:46:40 phreak Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -65,6 +65,9 @@ NTSTATUS STDCALL NtReadFile(HANDLE FileHandle, UserMode, (PVOID*)&FileObject, NULL); + if( !NT_SUCCESS( Status ) ) + return Status; + if (ByteOffset == NULL) { ByteOffset = &FileObject->CurrentByteOffset; @@ -246,7 +249,7 @@ NTSTATUS STDCALL NtWriteFile(HANDLE FileHandle, KeWaitForSingleObject(ptrEvent, Executive, KernelMode, - FALSE, + FileObject->Flags & FO_ALERTABLE_IO ? TRUE : FALSE, NULL); Status = IoSB.Status; } diff --git a/reactos/ntoskrnl/io/vpb.c b/reactos/ntoskrnl/io/vpb.c index a1c9ae20179..82a306f5999 100644 --- a/reactos/ntoskrnl/io/vpb.c +++ b/reactos/ntoskrnl/io/vpb.c @@ -1,4 +1,4 @@ -/* $Id: vpb.c,v 1.15 2002/04/10 09:57:31 ekohl Exp $ +/* $Id: vpb.c,v 1.16 2002/04/20 03:46:40 phreak Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -98,7 +98,6 @@ NtQueryVolumeInformationFile(IN HANDLE FileHandle, PFILE_OBJECT FileObject; PDEVICE_OBJECT DeviceObject; PIRP Irp; - KEVENT Event; NTSTATUS Status; PIO_STACK_LOCATION StackPtr; PVOID SystemBuffer; @@ -122,10 +121,6 @@ NtQueryVolumeInformationFile(IN HANDLE FileHandle, DeviceObject = FileObject->DeviceObject; - KeInitializeEvent(&Event, - NotificationEvent, - FALSE); - Irp = IoAllocateIrp(DeviceObject->StackSize, TRUE); if (Irp == NULL) @@ -145,7 +140,8 @@ NtQueryVolumeInformationFile(IN HANDLE FileHandle, } Irp->AssociatedIrp.SystemBuffer = SystemBuffer; - Irp->UserEvent = &Event; + KeResetEvent( &FileObject->Event ); + Irp->UserEvent = &FileObject->Event; Irp->UserIosb = &IoSB; Irp->Tail.Overlay.Thread = PsGetCurrentThread(); @@ -164,7 +160,7 @@ NtQueryVolumeInformationFile(IN HANDLE FileHandle, Irp); if (Status == STATUS_PENDING) { - KeWaitForSingleObject(&Event, + KeWaitForSingleObject(&FileObject->Event, UserRequest, KernelMode, FALSE, @@ -202,7 +198,6 @@ IoQueryVolumeInformation(IN PFILE_OBJECT FileObject, PIO_STACK_LOCATION StackPtr; PDEVICE_OBJECT DeviceObject; PIRP Irp; - KEVENT Event; NTSTATUS Status; assert(FsInformation != NULL); @@ -220,10 +215,6 @@ IoQueryVolumeInformation(IN PFILE_OBJECT FileObject, DeviceObject = FileObject->DeviceObject; - KeInitializeEvent(&Event, - NotificationEvent, - FALSE); - Irp = IoAllocateIrp(DeviceObject->StackSize, TRUE); if (Irp == NULL) @@ -233,7 +224,8 @@ IoQueryVolumeInformation(IN PFILE_OBJECT FileObject, } Irp->AssociatedIrp.SystemBuffer = FsInformation; - Irp->UserEvent = &Event; + KeResetEvent( &FileObject->Event ); + Irp->UserEvent = &FileObject->Event; Irp->UserIosb = &IoStatusBlock; Irp->Tail.Overlay.Thread = PsGetCurrentThread(); @@ -252,7 +244,7 @@ IoQueryVolumeInformation(IN PFILE_OBJECT FileObject, Irp); if (Status == STATUS_PENDING) { - KeWaitForSingleObject(&Event, + KeWaitForSingleObject(&FileObject->Event, UserRequest, KernelMode, FALSE, @@ -281,7 +273,6 @@ NtSetVolumeInformationFile(IN HANDLE FileHandle, PFILE_OBJECT FileObject; PDEVICE_OBJECT DeviceObject; PIRP Irp; - KEVENT Event; NTSTATUS Status; PIO_STACK_LOCATION StackPtr; PVOID SystemBuffer; @@ -300,10 +291,6 @@ NtSetVolumeInformationFile(IN HANDLE FileHandle, DeviceObject = FileObject->DeviceObject; - KeInitializeEvent(&Event, - NotificationEvent, - FALSE); - Irp = IoAllocateIrp(DeviceObject->StackSize,TRUE); if (Irp == NULL) { @@ -326,7 +313,8 @@ NtSetVolumeInformationFile(IN HANDLE FileHandle, Length); Irp->AssociatedIrp.SystemBuffer = SystemBuffer; - Irp->UserEvent = &Event; + KeResetEvent( &FileObject->Event ); + Irp->UserEvent = &FileObject->Event; Irp->UserIosb = &IoSB; Irp->Tail.Overlay.Thread = PsGetCurrentThread(); @@ -344,7 +332,7 @@ NtSetVolumeInformationFile(IN HANDLE FileHandle, Status = IoCallDriver(DeviceObject,Irp); if (Status == STATUS_PENDING) { - KeWaitForSingleObject(&Event, + KeWaitForSingleObject(&FileObject->Event, UserRequest, KernelMode, FALSE,