IoDeleteDevice(): +'DeviceExtension' W32 binary compatibility as in IoCreateDevice()
authorshort <>
Sat, 1 Feb 2003 00:01:18 +0000 (00:01 +0000)
committershort <>
Sat, 1 Feb 2003 00:01:18 +0000 (00:01 +0000)
ntoskrnl/io/device.c

index a33f385..fac0268 100644 (file)
@@ -76,9 +76,15 @@ IoDeleteDevice(PDEVICE_OBJECT DeviceObject)
 #endif /* !LIBCAPTIVE */
        }
 
+#ifndef LIBCAPTIVE
+       /* W32 expects CreatedDeviceObject->DeviceExtension to follow *CreatedDeviceObject!
+        * Undocumented by W32!
+        * See also IoCreateDevice().
+        */
        /* free device extension */
        if (DeviceObject->DeviceObjectExtension)
                ExFreePool (DeviceObject->DeviceObjectExtension);
+#endif /* LIBCAPTIVE */
 
        /* remove device from driver device list */
        Previous = DeviceObject->DriverObject->DeviceObject;
@@ -645,6 +651,7 @@ IoCreateDevice(PDRIVER_OBJECT DriverObject,
 #ifdef LIBCAPTIVE
    /* W32 expects CreatedDeviceObject->DeviceExtension to follow *CreatedDeviceObject!
     * Undocumented by W32!
+    * See also IoDeleteDevice().
     */
    /* TODO:thread */
    IoDeviceObjectType->NonpagedPoolCharge = sizeof (DEVICE_OBJECT) + DeviceExtensionSize;
@@ -671,6 +678,7 @@ IoCreateDevice(PDRIVER_OBJECT DriverObject,
 #ifdef LIBCAPTIVE
    /* W32 expects CreatedDeviceObject->DeviceExtension to follow *CreatedDeviceObject!
     * Undocumented by W32!
+    * See also IoDeleteDevice().
     */
    /* TODO:thread */
    IoDeviceObjectType->NonpagedPoolCharge = sizeof (DEVICE_OBJECT);    /* restore */
@@ -710,6 +718,7 @@ IoCreateDevice(PDRIVER_OBJECT DriverObject,
 #else /* !LIBCAPTIVE */
   /* W32 expects CreatedDeviceObject->DeviceExtension to follow *CreatedDeviceObject!
    * Undocumented by W32!
+   * See also IoDeleteDevice().
    */
   CreatedDeviceObject->DeviceExtension = (void *)(CreatedDeviceObject+1);
 #endif /* LIBCAPTIVE */