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
|
@ -58,16 +58,16 @@ typedef enum _RAMDISK_DEVICE_STATE
|
|||
} RAMDISK_DEVICE_STATE;
|
||||
|
||||
DEFINE_GUID(RamdiskBusInterface,
|
||||
0x5DC52DF0,
|
||||
0x2F8A,
|
||||
0x410F,
|
||||
0x80, 0xE4, 0x05, 0xF8, 0x10, 0xE7, 0xA8, 0x8A);
|
||||
0x5DC52DF0,
|
||||
0x2F8A,
|
||||
0x410F,
|
||||
0x80, 0xE4, 0x05, 0xF8, 0x10, 0xE7, 0xA8, 0x8A);
|
||||
|
||||
DEFINE_GUID(RamdiskDiskInterface,
|
||||
0x31D909F0,
|
||||
0x2CDF,
|
||||
0x4A20,
|
||||
0x9E, 0xD4, 0x7D, 0x65, 0x47, 0x6C, 0xA7, 0x68);
|
||||
0x31D909F0,
|
||||
0x2CDF,
|
||||
0x4A20,
|
||||
0x9E, 0xD4, 0x7D, 0x65, 0x47, 0x6C, 0xA7, 0x68);
|
||||
|
||||
typedef struct _RAMDISK_EXTENSION
|
||||
{
|
||||
|
@ -467,7 +467,7 @@ RamdiskCreateDiskDevice(IN PRAMDISK_BUS_EXTENSION DeviceExtension,
|
|||
//
|
||||
// Read the view count instead
|
||||
//
|
||||
//ViewCount = Input->ViewCount;
|
||||
// ViewCount = Input->ViewCount;
|
||||
|
||||
//
|
||||
// Sanitize disk options
|
||||
|
@ -628,9 +628,9 @@ RamdiskCreateDiskDevice(IN PRAMDISK_BUS_EXTENSION DeviceExtension,
|
|||
DiskLength = Input->DiskLength;
|
||||
ExInitializeFastMutex(&DriveExtension->DiskListLock);
|
||||
IoInitializeRemoveLock(&DriveExtension->RemoveLock,
|
||||
'dmaR',
|
||||
1,
|
||||
0);
|
||||
'dmaR',
|
||||
1,
|
||||
0);
|
||||
DriveExtension->DriveDeviceName = DeviceName;
|
||||
DriveExtension->SymbolicLinkName = SymbolicLinkName;
|
||||
DriveExtension->GuidString = GuidString;
|
||||
|
@ -808,12 +808,12 @@ RamdiskCreateRamdisk(IN PDEVICE_OBJECT DeviceObject,
|
|||
// Validate input parameters
|
||||
//
|
||||
if ((Length < sizeof(RAMDISK_CREATE_INPUT)) ||
|
||||
(Input->Version != sizeof(RAMDISK_CREATE_INPUT)))
|
||||
(Input->Version != sizeof(RAMDISK_CREATE_INPUT)))
|
||||
{
|
||||
//
|
||||
// Invalid input
|
||||
//
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
//
|
||||
// Invalid input
|
||||
//
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -827,16 +827,16 @@ RamdiskCreateRamdisk(IN PDEVICE_OBJECT DeviceObject,
|
|||
//
|
||||
if (DiskType == RAMDISK_BOOT_DISK)
|
||||
{
|
||||
//
|
||||
// We only allow this as an early-init boot
|
||||
//
|
||||
if (!KeLoaderBlock) return STATUS_INVALID_PARAMETER;
|
||||
//
|
||||
// We only allow this as an early-init boot
|
||||
//
|
||||
if (!KeLoaderBlock) return STATUS_INVALID_PARAMETER;
|
||||
|
||||
//
|
||||
// Save command-line flags
|
||||
//
|
||||
if (ExportBootDiskAsCd) Input->Options.ExportAsCd = TRUE;
|
||||
if (IsWinPEBoot) Input->Options.NoDriveLetter = TRUE;
|
||||
//
|
||||
// Save command-line flags
|
||||
//
|
||||
if (ExportBootDiskAsCd) Input->Options.ExportAsCd = TRUE;
|
||||
if (IsWinPEBoot) Input->Options.NoDriveLetter = TRUE;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -844,10 +844,10 @@ RamdiskCreateRamdisk(IN PDEVICE_OBJECT DeviceObject,
|
|||
//
|
||||
if ((Input->Options.ExportAsCd) && (DiskType != RAMDISK_BOOT_DISK))
|
||||
{
|
||||
//
|
||||
// If the type isn't CDFS, it has to at least be raw CD
|
||||
//
|
||||
if (DiskType != RAMDISK_MEMORY_MAPPED_DISK) return STATUS_INVALID_PARAMETER;
|
||||
//
|
||||
// If the type isn't CDFS, it has to at least be raw CD
|
||||
//
|
||||
if (DiskType != RAMDISK_MEMORY_MAPPED_DISK) return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -855,13 +855,13 @@ RamdiskCreateRamdisk(IN PDEVICE_OBJECT DeviceObject,
|
|||
//
|
||||
if (DiskType <= RAMDISK_MEMORY_MAPPED_DISK)
|
||||
{
|
||||
//
|
||||
// Validate the file name
|
||||
//
|
||||
FileNameStart = (PWCHAR)((ULONG_PTR)Input + Length);
|
||||
FileNameEnd = Input->FileName + 1;
|
||||
while ((FileNameEnd < FileNameStart) && *(FileNameEnd)) FileNameEnd++;
|
||||
if (FileNameEnd == FileNameStart) return STATUS_INVALID_PARAMETER;
|
||||
//
|
||||
// Validate the file name
|
||||
//
|
||||
FileNameStart = (PWCHAR)((ULONG_PTR)Input + Length);
|
||||
FileNameEnd = Input->FileName + 1;
|
||||
while ((FileNameEnd < FileNameStart) && *(FileNameEnd)) FileNameEnd++;
|
||||
if (FileNameEnd == FileNameStart) return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -873,11 +873,11 @@ RamdiskCreateRamdisk(IN PDEVICE_OBJECT DeviceObject,
|
|||
&DriveExtension);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
//
|
||||
// Invalidate and set success
|
||||
//
|
||||
IoInvalidateDeviceRelations(DeviceExtension->PhysicalDeviceObject, 0);
|
||||
Irp->IoStatus.Information = STATUS_SUCCESS;
|
||||
//
|
||||
// Invalidate and set success
|
||||
//
|
||||
IoInvalidateDeviceRelations(DeviceExtension->PhysicalDeviceObject, 0);
|
||||
Irp->IoStatus.Information = STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -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,69 +1617,32 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -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,14 +2142,15 @@ 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;
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -2272,6 +2244,7 @@ RamdiskQueryDeviceText(IN PRAMDISK_DRIVE_EXTENSION DriveExtension,
|
|||
wcsncpy(OutputString, L"RamDisk\\0", sizeof(L"RamDisk\\0") / sizeof(WCHAR));
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Irp->IoStatus.Status = Status;
|
||||
|
@ -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
|
||||
//
|
||||
|
@ -2738,6 +2706,7 @@ RamdiskPower(IN PDEVICE_OBJECT DeviceObject,
|
|||
PoStartNextPowerIrp(Irp);
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return Status;
|
||||
|
@ -2911,34 +2880,34 @@ RamdiskAddDevice(IN PDRIVER_OBJECT DriverObject,
|
|||
&DeviceObject);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
//
|
||||
// Initialize the bus FDO extension
|
||||
//
|
||||
//
|
||||
// Initialize the bus FDO extension
|
||||
//
|
||||
DeviceExtension = DeviceObject->DeviceExtension;
|
||||
RtlZeroMemory(DeviceObject->DeviceExtension,
|
||||
sizeof(RAMDISK_BUS_EXTENSION));
|
||||
|
||||
//
|
||||
// Set bus FDO flags
|
||||
//
|
||||
//
|
||||
// Set bus FDO flags
|
||||
//
|
||||
DeviceObject->Flags |= DO_POWER_PAGABLE | DO_DIRECT_IO;
|
||||
|
||||
//
|
||||
// Setup the bus FDO extension
|
||||
//
|
||||
//
|
||||
// Setup the bus FDO extension
|
||||
//
|
||||
DeviceExtension->Type = RamdiskBus;
|
||||
ExInitializeFastMutex(&DeviceExtension->DiskListLock);
|
||||
ExInitializeFastMutex(&DeviceExtension->DiskListLock);
|
||||
IoInitializeRemoveLock(&DeviceExtension->RemoveLock,
|
||||
'dmaR',
|
||||
1,
|
||||
0);
|
||||
InitializeListHead(&DeviceExtension->DiskList);
|
||||
InitializeListHead(&DeviceExtension->DiskList);
|
||||
DeviceExtension->PhysicalDeviceObject = PhysicalDeviceObject;
|
||||
DeviceExtension->DeviceObject = DeviceObject;
|
||||
|
||||
//
|
||||
// Register the RAM disk device interface
|
||||
//
|
||||
//
|
||||
// Register the RAM disk device interface
|
||||
//
|
||||
Status = IoRegisterDeviceInterface(PhysicalDeviceObject,
|
||||
&RamdiskBusInterface,
|
||||
NULL,
|
||||
|
@ -2952,42 +2921,44 @@ RamdiskAddDevice(IN PDRIVER_OBJECT DriverObject,
|
|||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Attach us to the device stack
|
||||
//
|
||||
//
|
||||
// Attach us to the device stack
|
||||
//
|
||||
AttachedDevice = IoAttachDeviceToDeviceStack(DeviceObject,
|
||||
PhysicalDeviceObject);
|
||||
DeviceExtension->AttachedDevice = AttachedDevice;
|
||||
if (!AttachedDevice)
|
||||
{
|
||||
//
|
||||
// Fail
|
||||
//
|
||||
IoSetDeviceInterfaceState(&DeviceExtension->BusDeviceName, 0);
|
||||
RtlFreeUnicodeString(&DeviceExtension->BusDeviceName);
|
||||
IoDeleteDevice(DeviceObject);
|
||||
return STATUS_NO_SUCH_DEVICE;
|
||||
//
|
||||
// Fail
|
||||
//
|
||||
IoSetDeviceInterfaceState(&DeviceExtension->BusDeviceName, 0);
|
||||
RtlFreeUnicodeString(&DeviceExtension->BusDeviceName);
|
||||
IoDeleteDevice(DeviceObject);
|
||||
return STATUS_NO_SUCH_DEVICE;
|
||||
}
|
||||
|
||||
//
|
||||
// Bus FDO is initialized
|
||||
//
|
||||
//
|
||||
// Bus FDO is initialized
|
||||
//
|
||||
RamdiskBusFdo = DeviceObject;
|
||||
|
||||
//
|
||||
// Loop for loader block
|
||||
//
|
||||
//
|
||||
// Loop for loader block
|
||||
//
|
||||
if (KeLoaderBlock)
|
||||
{
|
||||
//
|
||||
// Are we being booted from setup? Not yet supported
|
||||
//
|
||||
//ASSERT(!KeLoaderBlock->SetupLdrBlock);
|
||||
//
|
||||
// Are we being booted from setup? Not yet supported
|
||||
//
|
||||
if (KeLoaderBlock->SetupLdrBlock)
|
||||
DPRINT1("FIXME: RamdiskAddDevice unsupported when being started from SETUPLDR!\n");
|
||||
// ASSERT(!KeLoaderBlock->SetupLdrBlock);
|
||||
}
|
||||
|
||||
//
|
||||
// All done
|
||||
//
|
||||
//
|
||||
// All done
|
||||
//
|
||||
DeviceObject->Flags &= DO_DEVICE_INITIALIZING;
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
|
@ -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