From b9f5240173b1210e3a97cc35570c3cdfeef4741e Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Mon, 29 Dec 2014 23:14:42 +0000 Subject: [PATCH] [RAMDISK] Implement RamdiskQueryDeviceRelations() when the device is a drive MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit According to Hervé, this allows booting ReactOS livecd using PXE (with one of his patch). svn path=/trunk/; revision=65902 --- .../drivers/storage/class/ramdisk/ramdisk.c | 39 ++++++++++++++++++- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/reactos/drivers/storage/class/ramdisk/ramdisk.c b/reactos/drivers/storage/class/ramdisk/ramdisk.c index 143a6f6f600..2cbfdaa7d8b 100644 --- a/reactos/drivers/storage/class/ramdisk/ramdisk.c +++ b/reactos/drivers/storage/class/ramdisk/ramdisk.c @@ -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; } // -- 2.17.1