Changed to event object from file object.

svn path=/trunk/; revision=2885
This commit is contained in:
Hartmut Birr 2002-04-27 19:22:55 +00:00
parent 474ffaeded
commit 10e98570f5
2 changed files with 29 additions and 19 deletions

View file

@ -1,4 +1,4 @@
/* $Id: fs.c,v 1.24 2002/04/19 20:27:20 ekohl Exp $
/* $Id: fs.c,v 1.25 2002/04/27 19:22:55 hbirr Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -74,7 +74,7 @@ NtFsControlFile (
PDEVICE_OBJECT DeviceObject;
PIRP Irp;
PIO_STACK_LOCATION StackPtr;
KEVENT KEvent;
PKEVENT ptrEvent;
IO_STATUS_BLOCK IoSB;
DPRINT("NtFsControlFile(DeviceHandle %x EventHandle %x ApcRoutine %x "
@ -96,11 +96,30 @@ NtFsControlFile (
{
return(Status);
}
if (EventHandle != NULL)
{
Status = ObReferenceObjectByHandle (EventHandle,
SYNCHRONIZE,
ExEventObjectType,
UserMode,
(PVOID*)&ptrEvent,
NULL);
if (!NT_SUCCESS(Status))
{
ObDereferenceObject(FileObject);
return Status;
}
}
else
{
KeResetEvent (&FileObject->Event);
ptrEvent = &FileObject->Event;
}
DeviceObject = FileObject->DeviceObject;
KeInitializeEvent(&KEvent,NotificationEvent,TRUE);
Irp = IoBuildDeviceIoControlRequest(IoControlCode,
DeviceObject,
InputBuffer,
@ -108,7 +127,7 @@ NtFsControlFile (
OutputBuffer,
OutputBufferSize,
FALSE,
&KEvent,
ptrEvent,
&IoSB);
Irp->Overlay.AsynchronousParameters.UserApcRoutine = ApcRoutine;
@ -125,7 +144,7 @@ NtFsControlFile (
Status = IoCallDriver(DeviceObject,Irp);
if (Status == STATUS_PENDING && !(FileObject->Flags & FO_SYNCHRONOUS_IO))
{
KeWaitForSingleObject(&KEvent,Executive,KernelMode,FALSE,NULL);
KeWaitForSingleObject(ptrEvent,Executive,KernelMode,FALSE,NULL);
Status = IoSB.Status;
}
if (IoStatusBlock)

View file

@ -1,4 +1,4 @@
/* $Id: ioctrl.c,v 1.13 2001/11/02 22:22:33 hbirr Exp $
/* $Id: ioctrl.c,v 1.14 2002/04/27 19:22:55 hbirr Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -38,7 +38,6 @@ NTSTATUS STDCALL NtDeviceIoControlFile (IN HANDLE DeviceHandle,
PDEVICE_OBJECT DeviceObject;
PIRP Irp;
PIO_STACK_LOCATION StackPtr;
KEVENT KEvent;
PKEVENT ptrEvent;
IO_STATUS_BLOCK IoSB;
@ -75,22 +74,14 @@ NTSTATUS STDCALL NtDeviceIoControlFile (IN HANDLE DeviceHandle,
return Status;
}
}
else if (FileObject->Flags & FO_SYNCHRONOUS_IO)
{
ptrEvent = NULL;
}
else
{
KeInitializeEvent (&KEvent,
NotificationEvent,
FALSE);
ptrEvent = &KEvent;
KeResetEvent (&FileObject->Event);
ptrEvent = &FileObject->Event;
}
DeviceObject = FileObject->DeviceObject;
KeInitializeEvent(&KEvent,NotificationEvent,TRUE);
Irp = IoBuildDeviceIoControlRequest(IoControlCode,
DeviceObject,
InputBuffer,
@ -113,7 +104,7 @@ NTSTATUS STDCALL NtDeviceIoControlFile (IN HANDLE DeviceHandle,
Status = IoCallDriver(DeviceObject,Irp);
if (Event == NULL && Status == STATUS_PENDING && !(FileObject->Flags & FO_SYNCHRONOUS_IO))
{
KeWaitForSingleObject(&KEvent,Executive,KernelMode,FALSE,NULL);
KeWaitForSingleObject(ptrEvent,Executive,KernelMode,FALSE,NULL);
Status = IoSB.Status;
}
if (IoStatusBlock)