I have a bus driver similar to the toaster bus driver from the DDK. I
create a PDO (by using an application to send
IOCTL_BUSENUM_PLUGIN_HARDWARE), and then I load my SCSI miniport driver
onto that PDO. My bus driver exports an interface that the SCSI
miniport driver uses. In the SCSI miniport code, I want to send
IRP_MN_QUERY_INTERFACE to the child PDO that corresponds to the PDO on
which the miniport driver is installed. In the miniport code, I have
been sending the IRP by using the code below, where targetObject is the
DEVICE_OBJECT field of the DRIVER_OBJECT parameter passed to the
miniport's DriverEntry function. I believe that targetObject would
then correspond to the FDO (not the child PDO that I want), but,
nevertheless, this was working with no problems at all. However, I
recently switched to another test PC, and now I get Bug Check 0x35
(NO_MORE_IRP_STACK_LOCATIONS) on the call to IoCallDriver.
1) Any idea why I get this Bug Check?
2) Is there a way for the miniport driver to get the PDO pointer that I
need?
KeInitializeEvent(&event, NotificationEvent, FALSE);
irp = IoBuildSynchronousFsdRequest(IRP_MJ_PNP, targetObject, NULL, 0,
NULL, &event, &ioStatusBlock);
if(NULL == irp)
{
status = STATUS_INSUFFICIENT_RESOURCES;
goto End;
}
irpStack = IoGetNextIrpStackLocation(irp);
irpStack->MinorFunction = IRP_MN_QUERY_INTERFACE;
irpStack->Parameters.QueryInterface.InterfaceType =
(LPGUID)&ChannelBusProtocolGuid;
irpStack->Parameters.QueryInterface.Size = sizeof(CHANNEL_BUS);
irpStack->Parameters.QueryInterface.Version = 1;
irpStack->Parameters.QueryInterface.Interface =
(PINTERFACE)pChannelBus;
irpStack->Parameters.QueryInterface.InterfaceSpecificData = NULL;
irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
status = IoCallDriver(targetObject, irp);
if(STATUS_PENDING == status)
{
KeWaitForSingleObject(&event, Executive, KernelMode, FALSE,
NULL);
status = ioStatusBlock.Status;
}