This is just for one specific backup application that does not like removable media.
Now I have a differnt problem.
I did intercept the the QUERY_CAPABILITIES in the IRP_MJ_PNP.
But I when I look at the DEVICE_CAPABILITIES data after my completion function returns, the following data are 0.
irpSp->Parameters.DeviceCapabilities.Capabilities->Removable, irpSp->Parameters.DeviceCapabilities.Capabilities->EjectSupported, irpSp->Parameters.DeviceCapabilities.Capabilities->WarmEjectSupported,
This is how I do it which is very much like the diskperf sample.
What I’m doing wrong?
Pada
/**************/
DispatchPnp( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp )
{
PIO_STACK_LOCATION irpSp = IoGetCurrentIrpStackLocation(Irp);
case IRP_MN_QUERY_CAPABILITIES:
{
status = ForwardIrpSynchronous(DeviceObject, Irp);
KdPrint((“IRP_MN_QUERY_CAPABILITIES %d %d %d %d %d %d %d”, irpSp->Parameters.DeviceCapabilities.Capabilities->Removable, irpSp->Parameters.DeviceCapabilities.Capabilities->EjectSupported, irpSp->Parameters.DeviceCapabilities.Capabilities->WarmEjectSupported));
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return status;
}
}
/***********/
NTSTATUS ForwardIrpSynchronous( IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp )
{
PDEVICE_EXTENSION deviceExtension;
KEVENT event;
NTSTATUS status;
KeInitializeEvent(&event, NotificationEvent, FALSE);
deviceExtension = (PDEVICE_EXTENSION) DeviceObject->DeviceExtension;
IoCopyCurrentIrpStackLocationToNext(Irp);
IoSetCompletionRoutine(Irp, IrpCompletion,
&event, TRUE, TRUE, TRUE);
status = IoCallDriver(deviceExtension->TargetDeviceObject, Irp);
// wait for the actual completion
if (status == STATUS_PENDING) {
KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, &timeout);
status = Irp->IoStatus.Status;
}
return status;
}
/*****************/
NTSTATUS DiskPerfIrpCompletion( IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp,
IN PVOID Context
)
{
PKEVENT Event = (PKEVENT) Context;
PIO_STACK_LOCATION irpSp1 = IoGetCurrentIrpStackLocation(Irp);
UNREFERENCED_PARAMETER(DeviceObject);
UNREFERENCED_PARAMETER(Irp);
KeSetEvent(Event, IO_NO_INCREMENT, FALSE);
return(STATUS_MORE_PROCESSING_REQUIRED);
}