@Tim_Roberts said:
Craig is wrong. It is absolutely not necessary to use WDM. The Sysvad sample from Microsoft itself is a KMDF driver, for gosh sakes.
However, you must use KMDF in miniport mode, so that it does not attempt to do any dispatching. Given that, it’s not entirely clear what KMDF brings to the party, but it is certainly possible.
Hmm … good to know, thanks, KMDF in “miniport” mode! When I had worked with SysVAD in the past there were always problems accessing some of the traditional KMDF functions like interface change notifications, PnP dispatching (I had to use DRIVER_DISPATCH) rather than simply using WdfDeviceInitSetFileObjectConfig and similar, it didn’t let me create WdfIoQueue’s or WdfCreateDeviceInterface or WdfDeviceSetPnPCapabilities or even WdfDeviceSetDeviceState. WMI static and dynamic registrations wouldn’t work, and even the WdfPreprocessIrp function wouldn’t work …
It’s true that both SysVAD and a KMDF driver started with WdfDriverCreate, but right there in a comment block in SysVAD above that function it states that we need to set the WdfDriverInitNoDispatchOverride flag to tell the framework to specifically NOT provide dispatch routines for the driver (which I had always seen as being a core feature of a KMDF driver) … implying that you’re on your own to set up the handlers in DispatchDriver … one of the hallmarks I had always seen of KMDF (and UMDF) was that it handled all of the cruft involved in IRP collection, completion, cancellation and dispatching, you just needed to provide a callback function and you’re gold versus simply being given a raw IRP through DRIVER_DISPATCH and a hearty pat on the back as you’re pushed back into the weeds …
KMDF in miniport mode, with so many things off the table or not working, to me says just use WDM and forget all about KMDF (in any flavor) … otherwise, you’re spending time hunting bugs that you don’t know if they are bad business logic or simply something that miniport KMDF doesn’t handle and it’s on you to implement (hence my statement to the OP that you have a very limited set of KMDF functions available).
Looking at the list of Wdf functions the OP provided, easily 80% of them I wasn’t able to get to work in “KMDF” SysVAD, helpful functions like WdfRequestXX (I needed to crack the IRP’s myself) and WdfSpinLockCreate (needed to use KSPIN_LOCK) which were all easily doable using WDM …
Hmm … SysVAD is a “KMDF” driver, you say … OK, again good toknow, I’ve got some research to do!