Removed CloseInProcess from object header structure.
Modified: trunk/reactos/ntoskrnl/include/internal/ob.h
Modified: trunk/reactos/ntoskrnl/ob/object.c

Modified: trunk/reactos/ntoskrnl/include/internal/ob.h
--- trunk/reactos/ntoskrnl/include/internal/ob.h	2005-03-13 16:41:05 UTC (rev 14013)
+++ trunk/reactos/ntoskrnl/include/internal/ob.h	2005-03-13 16:44:15 UTC (rev 14014)
@@ -157,7 +157,6 @@
    LIST_ENTRY Entry;
    LONG RefCount;
    LONG HandleCount;
-   BOOLEAN CloseInProcess;
    BOOLEAN Permanent;
    BOOLEAN Inherit;
    struct _DIRECTORY_OBJECT* Parent;

Modified: trunk/reactos/ntoskrnl/ob/object.c
--- trunk/reactos/ntoskrnl/ob/object.c	2005-03-13 16:41:05 UTC (rev 14013)
+++ trunk/reactos/ntoskrnl/ob/object.c	2005-03-13 16:44:15 UTC (rev 14014)
@@ -894,7 +894,7 @@
 	DPRINT("eip %x\n", ((PULONG)&Object)[-1]);
      }
  
-   if (Header->CloseInProcess)
+   if (Header->RefCount == 0 && !Header->Permanent)
    {
       if (Header->ObjectType == PsProcessType)
         {
@@ -907,7 +907,10 @@
       return(STATUS_UNSUCCESSFUL);
    }
 
-   InterlockedIncrement(&Header->RefCount);
+   if (1 == InterlockedIncrement(&Header->RefCount) && !Header->Permanent)
+   {
+      KEBUGCHECK(0);
+   }
    
    return(STATUS_SUCCESS);
 }
@@ -1023,12 +1026,6 @@
       KEBUGCHECK(0);
     }
 
-  if (ObjectHeader->CloseInProcess)
-    {
-      KEBUGCHECK(0);
-      return STATUS_UNSUCCESSFUL;
-    }
-  ObjectHeader->CloseInProcess = TRUE;
   
   switch (KeGetCurrentIrql ())
     {
@@ -1094,12 +1091,11 @@
   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);
 }