mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-02 12:23:31 +00:00
- Remove incorrect check in RamdiskPnp -- we should only early-quit if the device is removed, not uninitialized, otherwise we'll never get initialized.
- Add support for IRP_MN_SURPRISE_REMOVAL. - Handle IRP_MN_QUERY_ID for FDO (it is the first IRP we receive). - Handle IRP completion for FDOs and forward if necessary. svn path=/trunk/; revision=34451
This commit is contained in:
@@ -36,8 +36,10 @@ typedef enum _RAMDISK_DEVICE_STATE
|
||||
{
|
||||
RamdiskStateUninitialized,
|
||||
RamdiskStateStarted,
|
||||
RamdiskStatePaused,
|
||||
RamdiskStateStopped,
|
||||
RamdiskStateRemoved
|
||||
RamdiskStateRemoved,
|
||||
RamdiskStateBusRemoved,
|
||||
} RAMDISK_DEVICE_STATE;
|
||||
|
||||
DEFINE_GUID(RamdiskBusInterface,
|
||||
@@ -281,9 +283,9 @@ RamdiskPnp(IN PDEVICE_OBJECT DeviceObject,
|
||||
Minor = IoStackLocation->MinorFunction;
|
||||
|
||||
//
|
||||
// Check if the device is initialized
|
||||
// Check if the bus is removed
|
||||
//
|
||||
if (DeviceExtension->State == RamdiskStateUninitialized)
|
||||
if (DeviceExtension->State == RamdiskStateBusRemoved)
|
||||
{
|
||||
//
|
||||
// Only remove-device and query-id are allowed
|
||||
@@ -361,13 +363,25 @@ RamdiskPnp(IN PDEVICE_OBJECT DeviceObject,
|
||||
DPRINT1("PnP IRP: %lx\n", Minor);
|
||||
while (TRUE);
|
||||
break;
|
||||
|
||||
case IRP_MN_QUERY_ID:
|
||||
|
||||
case IRP_MN_SURPRISE_REMOVAL:
|
||||
|
||||
DPRINT1("PnP IRP: %lx\n", Minor);
|
||||
while (TRUE);
|
||||
break;
|
||||
|
||||
case IRP_MN_QUERY_ID:
|
||||
|
||||
//
|
||||
// Are we a PDO?
|
||||
//
|
||||
if (DeviceExtension->Type == RamdiskPdo)
|
||||
{
|
||||
DPRINT1("PnP IRP: %lx\n", Minor);
|
||||
while (TRUE);
|
||||
}
|
||||
break;
|
||||
|
||||
case IRP_MN_QUERY_BUS_INFORMATION:
|
||||
|
||||
DPRINT1("PnP IRP: %lx\n", Minor);
|
||||
@@ -404,11 +418,28 @@ RamdiskPnp(IN PDEVICE_OBJECT DeviceObject,
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Are we an FDO?
|
||||
//
|
||||
if (DeviceExtension->Type == RamdiskFdo)
|
||||
{
|
||||
//
|
||||
// Do we have an attached device?
|
||||
//
|
||||
if (DeviceExtension->AttachedDevice)
|
||||
{
|
||||
//
|
||||
// Forward the IRP
|
||||
//
|
||||
IoSkipCurrentIrpStackLocation(Irp);
|
||||
Status = IoCallDriver(DeviceExtension->AttachedDevice, Irp);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Release the lock and return status
|
||||
//
|
||||
IoReleaseRemoveLock(&DeviceExtension->RemoveLock, Irp);
|
||||
while (TRUE);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user