Who is the parent? (IRP_MJ_INTERNAL_DEVICE_CONTROL)



Hi All,

I am using USBBuildVendorRequest to format an URB and then send the URB
to the bus driver. In case of XP this will be generic parent driver,
for Win2K this is usbhub.sys.

I am sending these urbs successfuly if I am inside a function driver.
The parent driver for a function drivers is the generic parent/bus
driver.

It happens that I cannot modify officially the function driver code and
I have to use the driver as it is. I am implementing an upper function
filer driver. Using the same mechanism for sending urbs my code into
the filter's custom IOCTL handler looks like this:

// Create the URB
urb = (PURB)ExAllocatePool(NonPagedPool, sizeof(struct
_URB_CONTROL_VENDOR_OR_CLASS_REQUEST));


UsbBuildVendorRequest(
urb,
URB_FUNCTION_VENDOR_DEVICE, sizeof(struct
_URB_CONTROL_VENDOR_OR_CLASS_REQUEST),
0,
0,
0,
0,
0,
IoBuffer,
NULL,
InputBufferLength,
NULL);


// use the original irp as an internal device control irp
nextStack = IoGetNextIrpStackLocation(Irp);
nextStack->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL;
nextStack->Parameters.Others.Argument1 = (PVOID) urb;
nextStack->Parameters.DeviceIoControl.IoControlCode =
IOCTL_INTERNAL_USB_SUBMIT_URB;
....

ntStatus=IoCallDriver(deviceExtension->TopOfStackDeviceObject, Irp);

My question is if this internal IOCTL will ever reach the generic
parent/bus driver?

Is this a general mechanism to talk to the generic parent/bus driver
from any place in the device stack above these driver - say upper
function filter, function, lower function filter drivers?

What if I place my driver as a lower function filter driver - in this
case it will be nearer to the generic parent/bus driver?

Thanks in advance!

Dim

.



Relevant Pages