[RAMDISK]
authorPierre Schweitzer <pierre@reactos.org>
Mon, 29 Dec 2014 23:14:42 +0000 (23:14 +0000)
committerPierre Schweitzer <pierre@reactos.org>
Mon, 29 Dec 2014 23:14:42 +0000 (23:14 +0000)
Implement RamdiskQueryDeviceRelations() when the device is a drive

According to HervĂ©, this allows booting ReactOS livecd using PXE (with one of his patch).

svn path=/trunk/; revision=65902

reactos/drivers/storage/class/ramdisk/ramdisk.c

index 143a6f6..2cbfdaa 100644 (file)
@@ -1731,10 +1731,45 @@ RamdiskQueryDeviceRelations(IN DEVICE_RELATION_TYPE Type,
     DeviceExtension = DeviceObject->DeviceExtension;
     if (DeviceExtension->Type == RamdiskDrive)
     {
+        NTSTATUS Status;
+        PDEVICE_RELATIONS DeviceRelations;
+
+        //
+        // We're a child device, only handle target device relations
+        //
+        if (Type != TargetDeviceRelation)
+        {
+            Status = Irp->IoStatus.Status;
+            IoCompleteRequest(Irp, IO_NO_INCREMENT);
+            return Status;
+        }
+
         //
-        // FIXME: TODO
+        // Allocate a buffer big enough to contain only one DO
         //
-        UNIMPLEMENTED_DBGBREAK();
+        DeviceRelations = ExAllocatePoolWithTag(PagedPool, sizeof(DeviceRelations), 'dmaR');
+        if (DeviceRelations != NULL)
+        {
+            //
+            // Reference the DO and add it to the buffer
+            //
+            ObReferenceObject(DeviceObject);
+            DeviceRelations->Objects[0] = DeviceObject;
+            DeviceRelations->Count = 1;
+            Status = STATUS_SUCCESS;
+        }
+        else
+        {
+            Status = STATUS_INSUFFICIENT_RESOURCES;
+        }
+
+        //
+        // Return our processing & complete
+        //
+        Irp->IoStatus.Information = (ULONG_PTR)DeviceRelations;
+        Irp->IoStatus.Status = Status;
+        IoCompleteRequest(Irp, IO_NO_INCREMENT);
+        return Status;
     }
     
     //