mirror of
https://github.com/reactos/reactos.git
synced 2024-08-16 16:39:08 +00:00
[RAMDISK]
- Whitespace fixes, - Add braces for long "case blah: ..." code blocks, - Add more informational messages when a feature is unimplemented (some control codes and cases happening when using ramdisk with bootcd). svn path=/trunk/; revision=66013
This commit is contained in:
parent
057211e26a
commit
f3dfb65738
|
@ -467,7 +467,7 @@ RamdiskCreateDiskDevice(IN PRAMDISK_BUS_EXTENSION DeviceExtension,
|
|||
//
|
||||
// Read the view count instead
|
||||
//
|
||||
//ViewCount = Input->ViewCount;
|
||||
// ViewCount = Input->ViewCount;
|
||||
|
||||
//
|
||||
// Sanitize disk options
|
||||
|
@ -1047,7 +1047,7 @@ RamdiskWorkerThread(IN PDEVICE_OBJECT DeviceObject,
|
|||
// Device control
|
||||
//
|
||||
case IRP_MJ_DEVICE_CONTROL:
|
||||
|
||||
{
|
||||
//
|
||||
// Let's take a look at the IOCTL
|
||||
//
|
||||
|
@ -1057,30 +1057,31 @@ RamdiskWorkerThread(IN PDEVICE_OBJECT DeviceObject,
|
|||
// Ramdisk create request
|
||||
//
|
||||
case FSCTL_CREATE_RAM_DISK:
|
||||
|
||||
{
|
||||
//
|
||||
// This time we'll do it for real
|
||||
//
|
||||
Status = RamdiskCreateRamdisk(DeviceObject, Irp, FALSE);
|
||||
break;
|
||||
}
|
||||
|
||||
case IOCTL_DISK_SET_PARTITION_INFO:
|
||||
|
||||
{
|
||||
Status = RamdiskSetPartitionInfo(Irp, (PRAMDISK_DRIVE_EXTENSION)DeviceExtension);
|
||||
break;
|
||||
}
|
||||
|
||||
case IOCTL_DISK_GET_DRIVE_LAYOUT:
|
||||
|
||||
UNIMPLEMENTED_DBGBREAK("Get drive layout request\n");
|
||||
break;
|
||||
|
||||
case IOCTL_DISK_GET_PARTITION_INFO:
|
||||
|
||||
{
|
||||
Status = RamdiskGetPartitionInfo(Irp, (PRAMDISK_DRIVE_EXTENSION)DeviceExtension);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
|
||||
UNIMPLEMENTED_DBGBREAK("Invalid request\n");
|
||||
break;
|
||||
}
|
||||
|
@ -1089,13 +1090,13 @@ RamdiskWorkerThread(IN PDEVICE_OBJECT DeviceObject,
|
|||
// We're here
|
||||
//
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Read or write request
|
||||
//
|
||||
case IRP_MJ_READ:
|
||||
case IRP_MJ_WRITE:
|
||||
|
||||
UNIMPLEMENTED_DBGBREAK("Read/Write request\n");
|
||||
break;
|
||||
|
||||
|
@ -1103,7 +1104,6 @@ RamdiskWorkerThread(IN PDEVICE_OBJECT DeviceObject,
|
|||
// Internal request (SCSI?)
|
||||
//
|
||||
case IRP_MJ_INTERNAL_DEVICE_CONTROL:
|
||||
|
||||
UNIMPLEMENTED_DBGBREAK("SCSI request\n");
|
||||
break;
|
||||
|
||||
|
@ -1111,7 +1111,6 @@ RamdiskWorkerThread(IN PDEVICE_OBJECT DeviceObject,
|
|||
// Flush request
|
||||
//
|
||||
case IRP_MJ_FLUSH_BUFFERS:
|
||||
|
||||
UNIMPLEMENTED_DBGBREAK("Flush request\n");
|
||||
break;
|
||||
|
||||
|
@ -1119,7 +1118,6 @@ RamdiskWorkerThread(IN PDEVICE_OBJECT DeviceObject,
|
|||
// Anything else
|
||||
//
|
||||
default:
|
||||
|
||||
UNIMPLEMENTED_DBGBREAK("Invalid request: %lx\n", IoStackLocation->MajorFunction);
|
||||
break;
|
||||
}
|
||||
|
@ -1329,8 +1327,8 @@ RamdiskReadWrite(IN PDEVICE_OBJECT DeviceObject,
|
|||
IN PIRP Irp)
|
||||
{
|
||||
PRAMDISK_DRIVE_EXTENSION DeviceExtension;
|
||||
//ULONG Length;
|
||||
//LARGE_INTEGER ByteOffset;
|
||||
// ULONG Length;
|
||||
// LARGE_INTEGER ByteOffset;
|
||||
PIO_STACK_LOCATION IoStackLocation;
|
||||
NTSTATUS Status, ReturnStatus;
|
||||
|
||||
|
@ -1351,8 +1349,8 @@ RamdiskReadWrite(IN PDEVICE_OBJECT DeviceObject,
|
|||
// Capture parameters
|
||||
//
|
||||
IoStackLocation = IoGetCurrentIrpStackLocation(Irp);
|
||||
//Length = IoStackLocation->Parameters.Read.Length;
|
||||
//ByteOffset = IoStackLocation->Parameters.Read.ByteOffset;
|
||||
// Length = IoStackLocation->Parameters.Read.Length;
|
||||
// ByteOffset = IoStackLocation->Parameters.Read.ByteOffset;
|
||||
|
||||
//
|
||||
// FIXME: Validate offset
|
||||
|
@ -1461,20 +1459,22 @@ RamdiskDeviceControl(IN PDEVICE_OBJECT DeviceObject,
|
|||
// Request to create a ramdisk
|
||||
//
|
||||
case FSCTL_CREATE_RAM_DISK:
|
||||
|
||||
{
|
||||
//
|
||||
// Do it
|
||||
//
|
||||
Status = RamdiskCreateRamdisk(DeviceObject, Irp, TRUE);
|
||||
if (!NT_SUCCESS(Status)) goto CompleteRequest;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
|
||||
{
|
||||
//
|
||||
// We don't handle anything else yet
|
||||
//
|
||||
UNIMPLEMENTED_DBGBREAK();
|
||||
UNIMPLEMENTED_DBGBREAK("IOCTL: %lx\n", IoStackLocation->Parameters.DeviceIoControl.IoControlCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1488,18 +1488,19 @@ RamdiskDeviceControl(IN PDEVICE_OBJECT DeviceObject,
|
|||
case IOCTL_STORAGE_CHECK_VERIFY:
|
||||
case IOCTL_STORAGE_CHECK_VERIFY2:
|
||||
case IOCTL_CDROM_CHECK_VERIFY:
|
||||
|
||||
{
|
||||
//
|
||||
// Just pretend it's OK, don't do more
|
||||
//
|
||||
Status = STATUS_SUCCESS;
|
||||
break;
|
||||
}
|
||||
|
||||
case IOCTL_STORAGE_GET_MEDIA_TYPES:
|
||||
case IOCTL_DISK_GET_MEDIA_TYPES:
|
||||
case IOCTL_DISK_GET_DRIVE_GEOMETRY:
|
||||
case IOCTL_CDROM_GET_DRIVE_GEOMETRY:
|
||||
|
||||
{
|
||||
//
|
||||
// Validate the length
|
||||
//
|
||||
|
@ -1530,9 +1531,10 @@ RamdiskDeviceControl(IN PDEVICE_OBJECT DeviceObject,
|
|||
Status = STATUS_SUCCESS;
|
||||
Information = sizeof(DISK_GEOMETRY);
|
||||
break;
|
||||
}
|
||||
|
||||
case IOCTL_CDROM_READ_TOC:
|
||||
|
||||
{
|
||||
//
|
||||
// Validate the length
|
||||
//
|
||||
|
@ -1569,14 +1571,16 @@ RamdiskDeviceControl(IN PDEVICE_OBJECT DeviceObject,
|
|||
Status = STATUS_SUCCESS;
|
||||
Information = RAMDISK_TOC_SIZE;
|
||||
break;
|
||||
}
|
||||
|
||||
case IOCTL_DISK_SET_PARTITION_INFO:
|
||||
|
||||
{
|
||||
Status = RamdiskSetPartitionInfo(Irp, DriveExtension);
|
||||
break;
|
||||
}
|
||||
|
||||
case IOCTL_DISK_GET_PARTITION_INFO:
|
||||
|
||||
{
|
||||
//
|
||||
// Validate the length
|
||||
//
|
||||
|
@ -1613,70 +1617,33 @@ RamdiskDeviceControl(IN PDEVICE_OBJECT DeviceObject,
|
|||
//
|
||||
Information = Irp->IoStatus.Information;
|
||||
break;
|
||||
}
|
||||
|
||||
case IOCTL_DISK_GET_DRIVE_LAYOUT:
|
||||
|
||||
UNIMPLEMENTED_DBGBREAK();
|
||||
break;
|
||||
|
||||
case IOCTL_DISK_GET_LENGTH_INFO:
|
||||
|
||||
UNIMPLEMENTED_DBGBREAK();
|
||||
break;
|
||||
|
||||
case IOCTL_DISK_IS_WRITABLE:
|
||||
|
||||
UNIMPLEMENTED_DBGBREAK();
|
||||
break;
|
||||
|
||||
case IOCTL_SCSI_MINIPORT:
|
||||
|
||||
UNIMPLEMENTED_DBGBREAK();
|
||||
break;
|
||||
|
||||
case IOCTL_STORAGE_QUERY_PROPERTY:
|
||||
|
||||
UNIMPLEMENTED_DBGBREAK();
|
||||
break;
|
||||
|
||||
case IOCTL_MOUNTDEV_QUERY_UNIQUE_ID:
|
||||
|
||||
UNIMPLEMENTED_DBGBREAK();
|
||||
break;
|
||||
|
||||
case IOCTL_MOUNTDEV_QUERY_STABLE_GUID:
|
||||
|
||||
UNIMPLEMENTED_DBGBREAK();
|
||||
break;
|
||||
|
||||
case IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS:
|
||||
|
||||
UNIMPLEMENTED_DBGBREAK();
|
||||
break;
|
||||
|
||||
case IOCTL_VOLUME_SET_GPT_ATTRIBUTES:
|
||||
|
||||
UNIMPLEMENTED_DBGBREAK();
|
||||
break;
|
||||
|
||||
case IOCTL_VOLUME_GET_GPT_ATTRIBUTES:
|
||||
|
||||
UNIMPLEMENTED_DBGBREAK();
|
||||
break;
|
||||
|
||||
case IOCTL_VOLUME_OFFLINE:
|
||||
|
||||
UNIMPLEMENTED_DBGBREAK();
|
||||
{
|
||||
UNIMPLEMENTED_DBGBREAK("IOCTL: %lx\n", IoStackLocation->Parameters.DeviceIoControl.IoControlCode);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
|
||||
{
|
||||
//
|
||||
// Drive code not emulated
|
||||
//
|
||||
DPRINT1("IOCTL: %lx\n", IoStackLocation->Parameters.DeviceIoControl.IoControlCode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// If requests drop down here, we just return them complete them
|
||||
|
@ -2082,7 +2049,7 @@ RamdiskQueryId(IN PRAMDISK_DRIVE_EXTENSION DriveExtension,
|
|||
switch (IoStackLocation->Parameters.QueryId.IdType)
|
||||
{
|
||||
case BusQueryDeviceID:
|
||||
|
||||
{
|
||||
//
|
||||
// Allocate a buffer long enough to receive Ramdisk\RamDisk in any case
|
||||
// In case we don't have RAMDISK_REGISTRY_DISK, we then need two more
|
||||
|
@ -2107,9 +2074,10 @@ RamdiskQueryId(IN PRAMDISK_DRIVE_EXTENSION DriveExtension,
|
|||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case BusQueryHardwareIDs:
|
||||
|
||||
{
|
||||
//
|
||||
// Allocate a buffer long enough to receive Ramdisk\RamDisk in any case
|
||||
// In case we don't have RAMDISK_REGISTRY_DISK, we then need two more
|
||||
|
@ -2138,9 +2106,10 @@ RamdiskQueryId(IN PRAMDISK_DRIVE_EXTENSION DriveExtension,
|
|||
OutputString[(StringLength / sizeof(WCHAR)) - 1] = UNICODE_NULL;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case BusQueryCompatibleIDs:
|
||||
|
||||
{
|
||||
if (DriveExtension->DiskType != RAMDISK_REGISTRY_DISK)
|
||||
{
|
||||
Status = STATUS_INVALID_DEVICE_REQUEST;
|
||||
|
@ -2159,9 +2128,10 @@ RamdiskQueryId(IN PRAMDISK_DRIVE_EXTENSION DriveExtension,
|
|||
OutputString[(StringLength / sizeof(WCHAR)) - 1] = UNICODE_NULL;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case BusQueryInstanceID:
|
||||
|
||||
{
|
||||
OutputString = ExAllocatePoolWithTag(PagedPool, DriveExtension->GuidString.MaximumLength, 'dmaR');
|
||||
if (OutputString == NULL)
|
||||
{
|
||||
|
@ -2172,15 +2142,16 @@ RamdiskQueryId(IN PRAMDISK_DRIVE_EXTENSION DriveExtension,
|
|||
wcsncpy(OutputString, DriveExtension->GuidString.Buffer, DriveExtension->GuidString.MaximumLength / sizeof(WCHAR));
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case BusQueryDeviceSerialNumber:
|
||||
|
||||
{
|
||||
//
|
||||
// Nothing to do
|
||||
//
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Irp->IoStatus.Status = Status;
|
||||
Irp->IoStatus.Information = (ULONG_PTR)OutputString;
|
||||
|
@ -2248,7 +2219,7 @@ RamdiskQueryDeviceText(IN PRAMDISK_DRIVE_EXTENSION DriveExtension,
|
|||
switch (DeviceTextType)
|
||||
{
|
||||
case DeviceTextDescription:
|
||||
|
||||
{
|
||||
OutputString = ExAllocatePoolWithTag(PagedPool, sizeof(L"RamDisk"), 'dmaR');
|
||||
if (OutputString == NULL)
|
||||
{
|
||||
|
@ -2259,9 +2230,10 @@ RamdiskQueryDeviceText(IN PRAMDISK_DRIVE_EXTENSION DriveExtension,
|
|||
wcsncpy(OutputString, L"RamDisk", sizeof(L"RamDisk") / sizeof(WCHAR));
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case DeviceTextLocationInformation:
|
||||
|
||||
{
|
||||
OutputString = ExAllocatePoolWithTag(PagedPool, sizeof(L"RamDisk\\0"), 'dmaR');
|
||||
if (OutputString == NULL)
|
||||
{
|
||||
|
@ -2273,6 +2245,7 @@ RamdiskQueryDeviceText(IN PRAMDISK_DRIVE_EXTENSION DriveExtension,
|
|||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Irp->IoStatus.Status = Status;
|
||||
Irp->IoStatus.Information = (ULONG_PTR)OutputString;
|
||||
|
@ -2386,7 +2359,7 @@ RamdiskPnp(IN PDEVICE_OBJECT DeviceObject,
|
|||
switch (Minor)
|
||||
{
|
||||
case IRP_MN_START_DEVICE:
|
||||
|
||||
{
|
||||
if (DeviceExtension->Type == RamdiskDrive)
|
||||
{
|
||||
ULONG ResultLength;
|
||||
|
@ -2493,34 +2466,20 @@ RamdiskPnp(IN PDEVICE_OBJECT DeviceObject,
|
|||
|
||||
Irp->IoStatus.Status = Status;
|
||||
break;
|
||||
}
|
||||
|
||||
case IRP_MN_QUERY_STOP_DEVICE:
|
||||
|
||||
UNIMPLEMENTED_DBGBREAK("PnP IRP: %lx\n", Minor);
|
||||
break;
|
||||
|
||||
case IRP_MN_CANCEL_STOP_DEVICE:
|
||||
|
||||
UNIMPLEMENTED_DBGBREAK("PnP IRP: %lx\n", Minor);
|
||||
break;
|
||||
|
||||
case IRP_MN_STOP_DEVICE:
|
||||
|
||||
UNIMPLEMENTED_DBGBREAK("PnP IRP: %lx\n", Minor);
|
||||
break;
|
||||
|
||||
case IRP_MN_QUERY_REMOVE_DEVICE:
|
||||
|
||||
UNIMPLEMENTED_DBGBREAK("PnP IRP: %lx\n", Minor);
|
||||
break;
|
||||
|
||||
case IRP_MN_CANCEL_REMOVE_DEVICE:
|
||||
|
||||
{
|
||||
UNIMPLEMENTED_DBGBREAK("PnP IRP: %lx\n", Minor);
|
||||
break;
|
||||
}
|
||||
|
||||
case IRP_MN_REMOVE_DEVICE:
|
||||
|
||||
{
|
||||
//
|
||||
// Remove the proper device
|
||||
//
|
||||
|
@ -2547,14 +2506,14 @@ RamdiskPnp(IN PDEVICE_OBJECT DeviceObject,
|
|||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
|
||||
case IRP_MN_SURPRISE_REMOVAL:
|
||||
|
||||
UNIMPLEMENTED_DBGBREAK("PnP IRP: %lx\n", Minor);
|
||||
break;
|
||||
|
||||
case IRP_MN_QUERY_ID:
|
||||
|
||||
{
|
||||
//
|
||||
// Are we a drive?
|
||||
//
|
||||
|
@ -2563,9 +2522,10 @@ RamdiskPnp(IN PDEVICE_OBJECT DeviceObject,
|
|||
Status = RamdiskQueryId((PRAMDISK_DRIVE_EXTENSION)DeviceExtension, Irp);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case IRP_MN_QUERY_BUS_INFORMATION:
|
||||
|
||||
{
|
||||
//
|
||||
// Are we a drive?
|
||||
//
|
||||
|
@ -2574,14 +2534,14 @@ RamdiskPnp(IN PDEVICE_OBJECT DeviceObject,
|
|||
Status = RamdiskQueryBusInformation(DeviceObject, Irp);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case IRP_MN_EJECT:
|
||||
|
||||
UNIMPLEMENTED_DBGBREAK("PnP IRP: %lx\n", Minor);
|
||||
break;
|
||||
|
||||
case IRP_MN_QUERY_DEVICE_TEXT:
|
||||
|
||||
{
|
||||
//
|
||||
// Are we a drive?
|
||||
//
|
||||
|
@ -2590,9 +2550,10 @@ RamdiskPnp(IN PDEVICE_OBJECT DeviceObject,
|
|||
Status = RamdiskQueryDeviceText((PRAMDISK_DRIVE_EXTENSION)DeviceExtension, Irp);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case IRP_MN_QUERY_DEVICE_RELATIONS:
|
||||
|
||||
{
|
||||
//
|
||||
// Call our main routine
|
||||
//
|
||||
|
@ -2602,9 +2563,10 @@ RamdiskPnp(IN PDEVICE_OBJECT DeviceObject,
|
|||
DeviceObject,
|
||||
Irp);
|
||||
goto ReleaseAndReturn;
|
||||
}
|
||||
|
||||
case IRP_MN_QUERY_CAPABILITIES:
|
||||
|
||||
{
|
||||
//
|
||||
// Are we a drive?
|
||||
//
|
||||
|
@ -2613,18 +2575,19 @@ RamdiskPnp(IN PDEVICE_OBJECT DeviceObject,
|
|||
Status = RamdiskQueryCapabilities(DeviceObject, Irp);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case IRP_MN_QUERY_RESOURCES:
|
||||
case IRP_MN_QUERY_RESOURCE_REQUIREMENTS:
|
||||
|
||||
{
|
||||
//
|
||||
// Complete immediately without touching it
|
||||
//
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
goto ReleaseAndReturn;
|
||||
}
|
||||
|
||||
default:
|
||||
|
||||
DPRINT1("Illegal IRP: %lx\n", Minor);
|
||||
break;
|
||||
}
|
||||
|
@ -2702,6 +2665,7 @@ RamdiskPower(IN PDEVICE_OBJECT DeviceObject,
|
|||
switch (IoStackLocation->MinorFunction)
|
||||
{
|
||||
case IRP_MN_SET_POWER:
|
||||
{
|
||||
//
|
||||
// If setting device power state
|
||||
// it's all fine and return success
|
||||
|
@ -2718,8 +2682,10 @@ RamdiskPower(IN PDEVICE_OBJECT DeviceObject,
|
|||
PoStartNextPowerIrp(Irp);
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
break;
|
||||
}
|
||||
|
||||
case IRP_MN_QUERY_POWER:
|
||||
{
|
||||
//
|
||||
// We can obviously accept all states
|
||||
// So just return success
|
||||
|
@ -2729,8 +2695,10 @@ RamdiskPower(IN PDEVICE_OBJECT DeviceObject,
|
|||
PoStartNextPowerIrp(Irp);
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
//
|
||||
// Just complete and save status for return
|
||||
//
|
||||
|
@ -2739,6 +2707,7 @@ RamdiskPower(IN PDEVICE_OBJECT DeviceObject,
|
|||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
@ -2982,7 +2951,9 @@ RamdiskAddDevice(IN PDRIVER_OBJECT DriverObject,
|
|||
//
|
||||
// Are we being booted from setup? Not yet supported
|
||||
//
|
||||
//ASSERT(!KeLoaderBlock->SetupLdrBlock);
|
||||
if (KeLoaderBlock->SetupLdrBlock)
|
||||
DPRINT1("FIXME: RamdiskAddDevice unsupported when being started from SETUPLDR!\n");
|
||||
// ASSERT(!KeLoaderBlock->SetupLdrBlock);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -3098,7 +3069,9 @@ DriverEntry(IN PDRIVER_OBJECT DriverObject,
|
|||
//
|
||||
// Installing from Ramdisk isn't supported yet
|
||||
//
|
||||
//ASSERT(!KeLoaderBlock->SetupLdrBlock);
|
||||
if (KeLoaderBlock->SetupLdrBlock)
|
||||
DPRINT1("FIXME: Installing from RamDisk is UNSUPPORTED!\n");
|
||||
// ASSERT(!KeLoaderBlock->SetupLdrBlock);
|
||||
|
||||
//
|
||||
// Are we reporting the device
|
||||
|
|
Loading…
Reference in a new issue