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,