Do not signal event twice. Thanks to Gunnar for finding the bug

svn path=/trunk/; revision=14933
This commit is contained in:
Alex Ionescu 2005-05-01 21:51:57 +00:00
parent 8441c8115e
commit 13c655b516

View file

@ -1280,6 +1280,25 @@ IoSecondStageCompletion(PKAPC Apc,
/* Signal the Event */ /* Signal the Event */
KeSetEvent(Irp->UserEvent, 0, FALSE); KeSetEvent(Irp->UserEvent, 0, FALSE);
/* Check if we should signal the File Object Event as well */
if (FileObject)
{
/* Dereference the Event if this is an ASYNC IRP */
if (!Irp->Flags & IRP_SYNCHRONOUS_API)
{
ObDereferenceObject(Irp->UserEvent);
}
/* If the File Object is SYNC, then we need to signal its event too */
if (FileObject->Flags & FO_SYNCHRONOUS_IO)
{
/* Signal Event */
KeSetEvent(&FileObject->Event, 0, FALSE);
/* Set the Status */
FileObject->FinalStatus = Irp->IoStatus.Status;
}
}
} }
else if (FileObject) else if (FileObject)
{ {
@ -1290,30 +1309,6 @@ IoSecondStageCompletion(PKAPC Apc,
FileObject->FinalStatus = Irp->IoStatus.Status; FileObject->FinalStatus = Irp->IoStatus.Status;
} }
/* Check if there's a File Object */
if (FileObject)
{
/* Dereference the Event if this is an ASYNC IRP */
if (!Irp->Flags & IRP_SYNCHRONOUS_API)
{
if (Irp->UserEvent != &FileObject->Event)
{
ObDereferenceObject(Irp->UserEvent);
}
}
/* If the File Object is SYNC, then we need to signal its event too */
if (FileObject->Flags & FO_SYNCHRONOUS_IO)
{
/* Signal Event */
KeSetEvent(&FileObject->Event, 0, FALSE);
/* Set the Status */
FileObject->FinalStatus = Irp->IoStatus.Status;
}
}
/* Remove the IRP from the list of Thread Pending IRPs */ /* Remove the IRP from the list of Thread Pending IRPs */
RemoveEntryList(&Irp->ThreadListEntry); RemoveEntryList(&Irp->ThreadListEntry);
InitializeListHead(&Irp->ThreadListEntry); InitializeListHead(&Irp->ThreadListEntry);