Getting WDFDEVICE handle from USB Device Emulation (UDE) device handle UDECXUSBDEVICE

Hi!

As the title states I’d like to know if and how it would be possible to get the WDFDEVICE handle of a virtual USB child created with UDE. Full of hope I found this archived discussion with the same question but looking at the UdecxUsbDeviceCreate API docs there is no mention of it, or did the answer imply that the opaque UDECXUSBDEVICE returned can be implicitly cast to WDFOBJECT (I don’t think so)?

Thanks & Cheers

When you create the UDECXUSBDEVICE, specify a context in the object attribute. Declare a WDFDEVICE field in the context type. After successful create, get the context from the UDECXUSBDEVICE and set the WDFDEVICE value.

Hi Doron, thanks for the reply! I’m not sure I understand, I do not want to pass along a WDFDEVICE object from my driver with the UDECXUSBDEVICE context, I’d like to get the WDFDEVICE of the PDO that UDE will implicitly create when calling UdecxUsbDeviceCreate, I do not see how the suggestion could aid in this task…

Don’t think that is possible. What bigger problem are you trying to solve?

I’d like to get a device property of the USB child device.