Hi everyone,
Has anyone been able to successfully use
IOCTL_INTERNAL_USB_GET_ROOTHUB_PDO to 'bypass' the generic composite
device driver?
When I try with the code below, it returns STATUS_NOT_IMPLEMENTED
((NTSTATUS)0xC0000002L)
Any ideas?
DISCLAIMER:
I know it's not a pretty thing to do, but it seems Microsoft's
usbaudio.sys driver uses this so it can match 1 interface, and still
access other interfaces on the device.
This is unfortunately how usb class devices are enumerated - with one
audio control endpoint and several audio streaming (isoch) endpoints
which are functionally related.
Matching the device is not an option since there may be other endpoints
(e.g. MIDI)
-nick
/* IOCTL_INTERNAL_USB_GET_ROOTHUB_PDO
This IOCTL is used internally by the hub driver this API will
return the PhysicalDeviceObject of the root hub enumerated by the
controller.
Parameters.Others.Argument1 =
pointer to be filled in with PDO for the root hub;
Parameters.Others.Argument2 =
pointer to be filled in with FDO of the USB Host Controller;
*/
PDEVICE_OBJECT root_pdo = 0;
PDEVICE_OBJECT root_fdo = 0;
PIRP Irp = IoBuildDeviceIoControlRequest(
IOCTL_INTERNAL_USB_GET_ROOTHUB_PDO,
pdo, // DeviceObject
NULL, 0, // InputBuffer
NULL, 0, // OutputBuffer
TRUE, // Internal
&event,
&iostatus);
PIO_STACK_LOCATION stack = IoGetNextIrpStackLocation(Irp);
stack->Parameters.Others.Argument1 = (PVOID) &root_pdo;
stack->Parameters.Others.Argument2 = (PVOID) &root_fdo;
NTSTATUS status = IoCallDriver(pdo, Irp);