WDF Driver Still loads on DriverEntry failure

My Non-PnP WDF driver tries creating a device object. As part of testing, we added failure paths where the device creation fails, which means the driverentry fails. However, the driver is still loaded, till I do an sc stop

I even see the unload routine being called by WDF, do I need to perform some sort of Uninit to delete the framework objects?

Yes, that’s the way it works. Non-PnP drivers are never automatically unloaded, and it’s not an error for a service driver not to create a device object.

ummm not if driverEntry fails and returns a non-success error code though, right?

I find it hard to believe that you’re actually returning an error from DriverEntry.

Are you SURE?

Maybe, I dunno… check the log (!wdflogdump)?

Peter