Removed CloseInProcess from object header structure.
authorHartmut Birr <osexpert@googlemail.com>
Sun, 13 Mar 2005 16:44:15 +0000 (16:44 +0000)
committerHartmut Birr <osexpert@googlemail.com>
Sun, 13 Mar 2005 16:44:15 +0000 (16:44 +0000)
svn path=/trunk/; revision=14014

reactos/ntoskrnl/include/internal/ob.h
reactos/ntoskrnl/ob/object.c

index 11f4f9f..3e4df5e 100644 (file)
@@ -157,7 +157,6 @@ typedef struct _OBJECT_HEADER
    LIST_ENTRY Entry;
    LONG RefCount;
    LONG HandleCount;
-   BOOLEAN CloseInProcess;
    BOOLEAN Permanent;
    BOOLEAN Inherit;
    struct _DIRECTORY_OBJECT* Parent;
index 25f7d59..88951ae 100644 (file)
@@ -894,7 +894,7 @@ ObReferenceObjectByPointer(IN PVOID Object,
        DPRINT("eip %x\n", ((PULONG)&Object)[-1]);
      }
  
-   if (Header->CloseInProcess)
+   if (Header->RefCount == 0 && !Header->Permanent)
    {
       if (Header->ObjectType == PsProcessType)
         {
@@ -907,7 +907,10 @@ ObReferenceObjectByPointer(IN PVOID Object,
       return(STATUS_UNSUCCESSFUL);
    }
 
-   InterlockedIncrement(&Header->RefCount);
+   if (1 == InterlockedIncrement(&Header->RefCount) && !Header->Permanent)
+   {
+      KEBUGCHECK(0);
+   }
    
    return(STATUS_SUCCESS);
 }
@@ -1023,12 +1026,6 @@ ObpDeleteObjectDpcLevel(IN POBJECT_HEADER ObjectHeader,
       KEBUGCHECK(0);
     }
 
-  if (ObjectHeader->CloseInProcess)
-    {
-      KEBUGCHECK(0);
-      return STATUS_UNSUCCESSFUL;
-    }
-  ObjectHeader->CloseInProcess = TRUE;
   
   switch (KeGetCurrentIrql ())
     {
@@ -1094,12 +1091,11 @@ ObfReferenceObject(IN PVOID Object)
   Header = BODY_TO_HEADER(Object);
 
   /* No one should be referencing an object once we are deleting it. */
-  if (Header->CloseInProcess)
-    {
-      KEBUGCHECK(0);
-    }
+  if (InterlockedIncrement(&Header->RefCount) == 1 && !Header->Permanent)
+  {
+     KEBUGCHECK(0);
+  }
 
-  InterlockedIncrement(&Header->RefCount);
 }