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;
}

Re: Sending Irp from SCSI miniport driver to bus driver by Gary

Gary
Mon Feb 06 16:15:05 CST 2006

Considering that a SCSI mini-port does NOT include NTDDK.H the questiion
bcomes HOW your are resolving the
header file inconsistencies to actually do KeXxx or IoXxxx in your miniport.
I've done such, but I'd like to know how you resolved it, becsue there could
lie the problem.

Also ... you've pretty well violated the principal of a SCSi mini-port in
doing what you have done.

--
The personal opinion of
Gary G. Little

<bglaudel@hotmail.com> wrote in message
news:1139259941.881613.294170@g47g2000cwa.googlegroups.com...
>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;
> }
>



Re: Sending Irp from SCSI miniport driver to bus driver by bglaudel

bglaudel
Tue Feb 07 10:27:07 CST 2006

I actually have been including ntddk.h in my SCSI miniport, and I
haven't hit a problem up until this Bug Check. How are you resolving
it?

Thanks.


Re: Sending Irp from SCSI miniport driver to bus driver by bglaudel

bglaudel
Tue Feb 07 15:50:37 CST 2006

Today I tried the method suggested in some other postings, where I
create a separate source file that includes NTDDK.H and exports wrapper
functions for the miniport source file to use. Unfortunately, I still
get the NO_MORE_IRP_STACK_LOCATIONS Bug Check.