Awhile back, I wrote:
Back in the WMP10 days, we would open a handle to our device
using the {f33fdc04-d1ac-4e8e-9a30-19bbd4b108ae} interface
class, and then issue IOCTL_SEND_USB_REQUEST to wpdusb.sys
in order to send some custom data to our device.In WMP11, wpdusb.sys doesn’t seem to export this IOCTL any
more. Further, I’ve looked through the WPD development
guide, but it’s not obvious that doing this (I just want to
send an eight-byte setup packet) is still possible.
After hearing back (well, sort of) from someone at MS support on this issue, I thought I would share my experience.
First, to my surprise, the support engineer told us that even though the MSDN documentation on IOCTL_SEND_USB_REQUEST says “Sends a vendor-defined request to a USB device, using the control pipe,” using it in exactly this manner was not an officially supported method and it was “never designed for such purpose”. Further attempts to clarify this statement with the support engineer were ignored.
So, my next plan was to load a filter driver on the stack and expose a control device through which we could send USB control requests through a custom IOCTL. However, whenever I tried to bring up the stack with my filter driver loaded (either as an upper or lower filter), the device would bang out in Device Manager. I assumed this was some sort of (easily subverted, of course) DRM measure, or maybe you can’t use filter drivers on a UMDF stack??..but don’t really know.
So, plan C (which we ended up using) was to use our generic parent bus driver to create a virtual MTP device from the one USB MTP interface exposed by our device. The virtual MTP device’s stack doesn’t have any filters, and then I just loaded my custom driver as a filter on the bus driver’s stack.