Some more fixes to the IO manager routines to use the KEVENT in the FILE_OBJECT correctly

svn path=/trunk/; revision=2862
This commit is contained in:
Phillip Susi 2002-04-20 03:46:40 +00:00
parent 951c94bc9a
commit 2b6504d6a9
3 changed files with 18 additions and 29 deletions

View file

@ -47,7 +47,6 @@ NtFlushBuffersFile (
PFILE_OBJECT FileObject = NULL; PFILE_OBJECT FileObject = NULL;
PIRP Irp; PIRP Irp;
PIO_STACK_LOCATION StackPtr; PIO_STACK_LOCATION StackPtr;
KEVENT Event;
NTSTATUS Status; NTSTATUS Status;
IO_STATUS_BLOCK IoSB; IO_STATUS_BLOCK IoSB;
@ -61,14 +60,13 @@ NtFlushBuffersFile (
{ {
return(Status); return(Status);
} }
KeResetEvent( &FileObject->Event );
KeInitializeEvent(&Event,NotificationEvent,FALSE);
Irp = IoBuildSynchronousFsdRequest(IRP_MJ_FLUSH_BUFFERS, Irp = IoBuildSynchronousFsdRequest(IRP_MJ_FLUSH_BUFFERS,
FileObject->DeviceObject, FileObject->DeviceObject,
NULL, NULL,
0, 0,
NULL, NULL,
&Event, &FileObject->Event,
&IoSB); &IoSB);
StackPtr = IoGetNextIrpStackLocation(Irp); StackPtr = IoGetNextIrpStackLocation(Irp);
@ -77,7 +75,7 @@ NtFlushBuffersFile (
Status = IoCallDriver(FileObject->DeviceObject,Irp); Status = IoCallDriver(FileObject->DeviceObject,Irp);
if (Status==STATUS_PENDING) if (Status==STATUS_PENDING)
{ {
KeWaitForSingleObject(&Event,Executive,KernelMode,FALSE,NULL); KeWaitForSingleObject(&FileObject->Event,Executive,KernelMode,FALSE,NULL);
Status = IoSB.Status; Status = IoSB.Status;
} }
if (IoStatusBlock) if (IoStatusBlock)

View file

@ -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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -65,6 +65,9 @@ NTSTATUS STDCALL NtReadFile(HANDLE FileHandle,
UserMode, UserMode,
(PVOID*)&FileObject, (PVOID*)&FileObject,
NULL); NULL);
if( !NT_SUCCESS( Status ) )
return Status;
if (ByteOffset == NULL) if (ByteOffset == NULL)
{ {
ByteOffset = &FileObject->CurrentByteOffset; ByteOffset = &FileObject->CurrentByteOffset;
@ -246,7 +249,7 @@ NTSTATUS STDCALL NtWriteFile(HANDLE FileHandle,
KeWaitForSingleObject(ptrEvent, KeWaitForSingleObject(ptrEvent,
Executive, Executive,
KernelMode, KernelMode,
FALSE, FileObject->Flags & FO_ALERTABLE_IO ? TRUE : FALSE,
NULL); NULL);
Status = IoSB.Status; Status = IoSB.Status;
} }

View file

@ -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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -98,7 +98,6 @@ NtQueryVolumeInformationFile(IN HANDLE FileHandle,
PFILE_OBJECT FileObject; PFILE_OBJECT FileObject;
PDEVICE_OBJECT DeviceObject; PDEVICE_OBJECT DeviceObject;
PIRP Irp; PIRP Irp;
KEVENT Event;
NTSTATUS Status; NTSTATUS Status;
PIO_STACK_LOCATION StackPtr; PIO_STACK_LOCATION StackPtr;
PVOID SystemBuffer; PVOID SystemBuffer;
@ -122,10 +121,6 @@ NtQueryVolumeInformationFile(IN HANDLE FileHandle,
DeviceObject = FileObject->DeviceObject; DeviceObject = FileObject->DeviceObject;
KeInitializeEvent(&Event,
NotificationEvent,
FALSE);
Irp = IoAllocateIrp(DeviceObject->StackSize, Irp = IoAllocateIrp(DeviceObject->StackSize,
TRUE); TRUE);
if (Irp == NULL) if (Irp == NULL)
@ -145,7 +140,8 @@ NtQueryVolumeInformationFile(IN HANDLE FileHandle,
} }
Irp->AssociatedIrp.SystemBuffer = SystemBuffer; Irp->AssociatedIrp.SystemBuffer = SystemBuffer;
Irp->UserEvent = &Event; KeResetEvent( &FileObject->Event );
Irp->UserEvent = &FileObject->Event;
Irp->UserIosb = &IoSB; Irp->UserIosb = &IoSB;
Irp->Tail.Overlay.Thread = PsGetCurrentThread(); Irp->Tail.Overlay.Thread = PsGetCurrentThread();
@ -164,7 +160,7 @@ NtQueryVolumeInformationFile(IN HANDLE FileHandle,
Irp); Irp);
if (Status == STATUS_PENDING) if (Status == STATUS_PENDING)
{ {
KeWaitForSingleObject(&Event, KeWaitForSingleObject(&FileObject->Event,
UserRequest, UserRequest,
KernelMode, KernelMode,
FALSE, FALSE,
@ -202,7 +198,6 @@ IoQueryVolumeInformation(IN PFILE_OBJECT FileObject,
PIO_STACK_LOCATION StackPtr; PIO_STACK_LOCATION StackPtr;
PDEVICE_OBJECT DeviceObject; PDEVICE_OBJECT DeviceObject;
PIRP Irp; PIRP Irp;
KEVENT Event;
NTSTATUS Status; NTSTATUS Status;
assert(FsInformation != NULL); assert(FsInformation != NULL);
@ -220,10 +215,6 @@ IoQueryVolumeInformation(IN PFILE_OBJECT FileObject,
DeviceObject = FileObject->DeviceObject; DeviceObject = FileObject->DeviceObject;
KeInitializeEvent(&Event,
NotificationEvent,
FALSE);
Irp = IoAllocateIrp(DeviceObject->StackSize, Irp = IoAllocateIrp(DeviceObject->StackSize,
TRUE); TRUE);
if (Irp == NULL) if (Irp == NULL)
@ -233,7 +224,8 @@ IoQueryVolumeInformation(IN PFILE_OBJECT FileObject,
} }
Irp->AssociatedIrp.SystemBuffer = FsInformation; Irp->AssociatedIrp.SystemBuffer = FsInformation;
Irp->UserEvent = &Event; KeResetEvent( &FileObject->Event );
Irp->UserEvent = &FileObject->Event;
Irp->UserIosb = &IoStatusBlock; Irp->UserIosb = &IoStatusBlock;
Irp->Tail.Overlay.Thread = PsGetCurrentThread(); Irp->Tail.Overlay.Thread = PsGetCurrentThread();
@ -252,7 +244,7 @@ IoQueryVolumeInformation(IN PFILE_OBJECT FileObject,
Irp); Irp);
if (Status == STATUS_PENDING) if (Status == STATUS_PENDING)
{ {
KeWaitForSingleObject(&Event, KeWaitForSingleObject(&FileObject->Event,
UserRequest, UserRequest,
KernelMode, KernelMode,
FALSE, FALSE,
@ -281,7 +273,6 @@ NtSetVolumeInformationFile(IN HANDLE FileHandle,
PFILE_OBJECT FileObject; PFILE_OBJECT FileObject;
PDEVICE_OBJECT DeviceObject; PDEVICE_OBJECT DeviceObject;
PIRP Irp; PIRP Irp;
KEVENT Event;
NTSTATUS Status; NTSTATUS Status;
PIO_STACK_LOCATION StackPtr; PIO_STACK_LOCATION StackPtr;
PVOID SystemBuffer; PVOID SystemBuffer;
@ -300,10 +291,6 @@ NtSetVolumeInformationFile(IN HANDLE FileHandle,
DeviceObject = FileObject->DeviceObject; DeviceObject = FileObject->DeviceObject;
KeInitializeEvent(&Event,
NotificationEvent,
FALSE);
Irp = IoAllocateIrp(DeviceObject->StackSize,TRUE); Irp = IoAllocateIrp(DeviceObject->StackSize,TRUE);
if (Irp == NULL) if (Irp == NULL)
{ {
@ -326,7 +313,8 @@ NtSetVolumeInformationFile(IN HANDLE FileHandle,
Length); Length);
Irp->AssociatedIrp.SystemBuffer = SystemBuffer; Irp->AssociatedIrp.SystemBuffer = SystemBuffer;
Irp->UserEvent = &Event; KeResetEvent( &FileObject->Event );
Irp->UserEvent = &FileObject->Event;
Irp->UserIosb = &IoSB; Irp->UserIosb = &IoSB;
Irp->Tail.Overlay.Thread = PsGetCurrentThread(); Irp->Tail.Overlay.Thread = PsGetCurrentThread();
@ -344,7 +332,7 @@ NtSetVolumeInformationFile(IN HANDLE FileHandle,
Status = IoCallDriver(DeviceObject,Irp); Status = IoCallDriver(DeviceObject,Irp);
if (Status == STATUS_PENDING) if (Status == STATUS_PENDING)
{ {
KeWaitForSingleObject(&Event, KeWaitForSingleObject(&FileObject->Event,
UserRequest, UserRequest,
KernelMode, KernelMode,
FALSE, FALSE,