Added CloseInProcess to the structure OBJECT_HEADER.

Check for close operation in ObReferenceObjectByPointer,
ObpPerformRetentionChecks, ObfReferenceObject.

svn path=/trunk/; revision=3402
This commit is contained in:
Hartmut Birr 2002-08-27 06:34:22 +00:00
parent 9e3bef3b3c
commit 06226b583c
2 changed files with 19 additions and 3 deletions

View file

@ -1,6 +1,6 @@
#ifndef _INCLUDE_DDK_OBTYPES_H
#define _INCLUDE_DDK_OBTYPES_H
/* $Id: obtypes.h,v 1.15 2002/06/20 21:28:55 ekohl Exp $ */
/* $Id: obtypes.h,v 1.16 2002/08/27 06:34:22 hbirr Exp $ */
struct _DIRECTORY_OBJECT;
struct _OBJECT_ATTRIBUTES;
@ -131,6 +131,7 @@ typedef struct _OBJECT_HEADER
LIST_ENTRY Entry;
LONG RefCount;
LONG HandleCount;
BOOLEAN CloseInProcess;
BOOLEAN Permanent;
struct _DIRECTORY_OBJECT* Parent;
POBJECT_TYPE ObjectType;

View file

@ -1,4 +1,4 @@
/* $Id: object.c,v 1.53 2002/08/14 20:58:38 dwelch Exp $
/* $Id: object.c,v 1.54 2002/08/27 06:34:22 hbirr Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -378,7 +378,12 @@ ObReferenceObjectByPointer(IN PVOID Object,
Object, Header->RefCount, PsThreadType);
DPRINT("eip %x\n", ((PULONG)&Object)[-1]);
}
if (Header->CloseInProcess)
{
return(STATUS_UNSUCCESSFUL);
}
InterlockedIncrement(&Header->RefCount);
return(STATUS_SUCCESS);
@ -442,6 +447,12 @@ ObpPerformRetentionChecks(POBJECT_HEADER Header)
Header->HandleCount == 0 &&
Header->Permanent == FALSE)
{
if (Header->CloseInProcess)
{
KeBugCheck(0);
return STATUS_UNSUCCESSFUL;
}
Header->CloseInProcess = TRUE;
if (Header->ObjectType != NULL &&
Header->ObjectType->Delete != NULL)
{
@ -482,6 +493,10 @@ ObfReferenceObject(IN PVOID Object)
Header = BODY_TO_HEADER(Object);
if (Header->CloseInProcess)
{
KeBugCheck(0);
}
InterlockedIncrement(&Header->RefCount);
ObpPerformRetentionChecks(Header);