From 06226b583cee37ca927a05bab82039c27437eb35 Mon Sep 17 00:00:00 2001 From: Hartmut Birr Date: Tue, 27 Aug 2002 06:34:22 +0000 Subject: [PATCH] Added CloseInProcess to the structure OBJECT_HEADER. Check for close operation in ObReferenceObjectByPointer, ObpPerformRetentionChecks, ObfReferenceObject. svn path=/trunk/; revision=3402 --- reactos/include/ddk/obtypes.h | 3 ++- reactos/ntoskrnl/ob/object.c | 19 +++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/reactos/include/ddk/obtypes.h b/reactos/include/ddk/obtypes.h index 74c3f454144..157e68dba1a 100644 --- a/reactos/include/ddk/obtypes.h +++ b/reactos/include/ddk/obtypes.h @@ -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; diff --git a/reactos/ntoskrnl/ob/object.c b/reactos/ntoskrnl/ob/object.c index 596a22c7920..2f95b05a15a 100644 --- a/reactos/ntoskrnl/ob/object.c +++ b/reactos/ntoskrnl/ob/object.c @@ -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);