Reset the permanent flag if the object is changed to non permanent.
Modified: trunk/reactos/ntoskrnl/ob/ntobj.c

Modified: trunk/reactos/ntoskrnl/ob/ntobj.c
--- trunk/reactos/ntoskrnl/ob/ntobj.c	2005-05-29 15:37:47 UTC (rev 15664)
+++ trunk/reactos/ntoskrnl/ob/ntobj.c	2005-05-29 15:41:24 UTC (rev 15665)
@@ -223,13 +223,20 @@
   POBJECT_HEADER ObjectHeader;
 
   ObjectHeader = BODY_TO_HEADER(ObjectBody);
-  ObjectHeader->Flags |= OB_FLAG_PERMANENT;
-
-  if (ObjectHeader->HandleCount == 0 && !Permanent && HEADER_TO_OBJECT_NAME(ObjectHeader)->Directory)
+  ASSERT (ObjectHeader->PointerCount > 0);
+  if (Permanent)
   {
-    /* Remove the object from the namespace */
-    ObpRemoveEntryDirectory(ObjectHeader);
+     ObjectHeader->Flags |= OB_FLAG_PERMANENT;
   }
+  else
+  {
+     ObjectHeader->Flags &= ~OB_FLAG_PERMANENT;
+     if (ObjectHeader->HandleCount == 0 && HEADER_TO_OBJECT_NAME(ObjectHeader)->Directory)
+     {
+        /* Remove the object from the namespace */
+        ObpRemoveEntryDirectory(ObjectHeader);
+     }
+  }
 }
 
 /**********************************************************************