[ros-diffs] [weiden] 14706: convert the device object to a temporary device before deleting it

weiden at svn.reactos.com weiden at svn.reactos.com
Tue Apr 19 23:47:06 CEST 2005


convert the device object to a temporary device before deleting it
Modified: trunk/reactos/ntoskrnl/io/device.c
Modified: trunk/reactos/ntoskrnl/ob/ntobj.c
  _____  

Modified: trunk/reactos/ntoskrnl/io/device.c
--- trunk/reactos/ntoskrnl/io/device.c	2005-04-19 20:52:49 UTC (rev
14705)
+++ trunk/reactos/ntoskrnl/io/device.c	2005-04-19 21:47:05 UTC (rev
14706)
@@ -557,6 +557,15 @@

    
    /* I guess this should be removed later... but it shouldn't cause
problems */
    DeviceObject->DeviceObjectExtension->ExtensionFlags |=
DOE_DELETE_PENDING;
+   
+   /* Make the object temporary. This should automatically remove the
device
+      from the namespace */
+   ObMakeTemporaryObject(DeviceObject);
+   
+   /* Dereference the driver object */
+   ObDereferenceObject(DeviceObject->DriverObject);
+   
+   /* Remove the keep-alive reference */
    ObDereferenceObject(DeviceObject);
 }
 
  _____  

Modified: trunk/reactos/ntoskrnl/ob/ntobj.c
--- trunk/reactos/ntoskrnl/ob/ntobj.c	2005-04-19 20:52:49 UTC (rev
14705)
+++ trunk/reactos/ntoskrnl/ob/ntobj.c	2005-04-19 21:47:05 UTC (rev
14706)
@@ -224,6 +224,12 @@

 
   ObjectHeader = BODY_TO_HEADER(ObjectBody);
   ObjectHeader->Permanent = Permanent;
+  
+  if (ObjectHeader->HandleCount == 0 && !Permanent &&
ObjectHeader->Parent != NULL)
+  {
+    /* Remove the object from the namespace */
+    ObpRemoveEntryDirectory(ObjectHeader);
+  }
 }
 
 /**********************************************************************



More information about the Ros-diffs mailing list