Retain reference to file objects so cached data isn't automatically loss

when the last handle is closed

svn path=/trunk/; revision=1683
This commit is contained in:
David Welch 2001-03-13 17:47:47 +00:00
parent 47ea39add9
commit 33702a0775
2 changed files with 14 additions and 3 deletions

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: view.c,v 1.19 2001/03/13 16:25:52 dwelch Exp $ /* $Id: view.c,v 1.20 2001/03/13 17:47:47 dwelch Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -259,6 +259,10 @@ CcInitializeFileCache(PFILE_OBJECT FileObject,
return(STATUS_UNSUCCESSFUL); return(STATUS_UNSUCCESSFUL);
} }
ObReferenceObjectByPointer(FileObject,
FILE_ALL_ACCESS,
NULL,
KernelMode);
(*Bcb)->FileObject = FileObject; (*Bcb)->FileObject = FileObject;
InitializeListHead(&(*Bcb)->CacheSegmentListHead); InitializeListHead(&(*Bcb)->CacheSegmentListHead);
KeInitializeSpinLock(&(*Bcb)->BcbLock); KeInitializeSpinLock(&(*Bcb)->BcbLock);

View file

@ -1,4 +1,4 @@
/* $Id: npool.c,v 1.37 2001/03/09 14:40:28 dwelch Exp $ /* $Id: npool.c,v 1.38 2001/03/13 17:47:47 dwelch Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -744,7 +744,14 @@ VOID STDCALL ExFreePool (PVOID block)
if (blk->magic != BLOCK_HDR_USED_MAGIC) if (blk->magic != BLOCK_HDR_USED_MAGIC)
{ {
DbgPrint("ExFreePool of non-allocated address %x\n",block); if (blk->magic == BLOCK_HDR_FREE_MAGIC)
{
DbgPrint("ExFreePool of already freed address %x\n", block);
}
else
{
DbgPrint("ExFreePool of non-allocated address %x\n", block);
}
KeBugCheck(0); KeBugCheck(0);
return; return;
} }