The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.
Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/
in my virtual USB controller project, I've run into a problem related to the extended properties descriptor as it is used by modern WinUSB devices. The hard part where I am currently stuck, however, is just related to PnP and WDF, so I think that it doesn't take a dedicated USB expert to help me here.
Anyway, when WinUSB.sys gets loaded for a device, in its AddDevice routine it looks for a "DeviceInterfaceGUID" value in the device hardware key (the "Device Parameters" branch in the registry) which it passes on to WdfDeviceCreateDeviceInterface(). WinUSB client applications then can use SetupDiGetClassDevs( DIGCF_DEVICEINTERFACE ) to locate their device.
Now my responsibility as the (virtual) USB hub driver is to make sure that this registry value exists before WinUSB goes looking for it. But when do I do that? Right after WdfDeviceCreate() is too soon: WdfDeviceOpenRegistryKey( PLUGPLAY_REGKEY_DEVICE ) will return STATUS_INVALID_DEVICE_STATE. (It seems that the "Device Parameters" branch is not even created until the PnP system has selected a suitable driver for the first time.) And the device's EvtDevicePrepareHardware callback is too late: experiments tell me that it runs only after WinUSB's AddDevice routine.
So to summarize my question: When is my first chance to write to the registry hardware key of a device that I, as a bus driver, have just created myself? And is there even a standard callback available that will run at the right moment?
|Upcoming OSR Seminars|
|OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!|
|Writing WDF Drivers||12 September 2022||Live, Online|
|Internals & Software Drivers||23 October 2022||Live, Online|
|Kernel Debugging||14 November 2022||Live, Online|
|Developing Minifilters||5 December 2022||Live, Online|