Moved dereferencing of file objects to IoSecondStageCompletion.

svn path=/trunk/; revision=2883
This commit is contained in:
Hartmut Birr 2002-04-27 19:21:32 +00:00
parent a253312fcf
commit ce8cda7cc1
2 changed files with 6 additions and 12 deletions

View file

@ -39,6 +39,7 @@ IopCompleteRequest1(struct _KAPC* Apc,
PriorityBoost = (CCHAR)(LONG)(*SystemArgument2);
IoStack = &Irp->Stack[(ULONG)Irp->CurrentLocation];
FileObject = IoStack->FileObject;
(*SystemArgument1) = (PVOID)Irp->UserIosb;
(*SystemArgument2) = (PVOID)Irp->IoStatus.Information;
@ -50,11 +51,11 @@ IopCompleteRequest1(struct _KAPC* Apc,
if (Irp->UserEvent!=NULL)
{
KeSetEvent(Irp->UserEvent,PriorityBoost,FALSE);
ObDereferenceObject( Irp->UserEvent );
// if the event is not the one in the file object, it needs dereferenced
if( FileObject && Irp->UserEvent != &FileObject->Event )
ObDereferenceObject( Irp->UserEvent );
}
FileObject = IoStack->FileObject;
if (FileObject != NULL && IoStack->MajorFunction != IRP_MJ_CLOSE)
{
ObDereferenceObject(FileObject);
@ -249,10 +250,6 @@ VOID IoSecondStageCompletion(PIRP Irp, CCHAR PriorityBoost)
}
if (FileObject != NULL && IoStack->MajorFunction != IRP_MJ_CLOSE)
{
//ObDereferenceObject(FileObject);
}
if (FileObject != NULL && (IoStack->MajorFunction == IRP_MJ_READ || IoStack->MajorFunction == IRP_MJ_WRITE || IoStack->MajorFunction ==IRP_MJ_CLEANUP || IoStack->MajorFunction ==IRP_MJ_CREATE || IoStack->MajorFunction==IRP_MJ_DIRECTORY_CONTROL))
{
ObDereferenceObject(FileObject);
}

View file

@ -1,4 +1,4 @@
/* $Id: file.c,v 1.16 2002/04/07 18:36:13 phreak Exp $
/* $Id: file.c,v 1.17 2002/04/27 19:21:32 hbirr Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -125,7 +125,6 @@ NtQueryInformationFile(HANDLE FileHandle,
}
ExFreePool(SystemBuffer);
ObDereferenceObject(FileObject);
return(Status);
}
@ -201,7 +200,6 @@ IoQueryFileInformation(IN PFILE_OBJECT FileObject,
*ReturnedLength = IoStatusBlock.Information;
}
ObDereferenceObject(FileObject);
return Status;
}
@ -308,8 +306,7 @@ NtSetInformationFile(HANDLE FileHandle,
*IoStatusBlock = IoSB;
}
ExFreePool(SystemBuffer);
ObDereferenceObject(FileObject);
return Status;
}