Add a new DWORD value DEFAULT and set its Data field to 0xf:
If we load the driver now and start it, we can see the debug output in DbgView too:
Requested Control is Not Valid for This Service
The below error message is seen if you attempt to stop the WDF driver via OSR Driver Loader or the native sc.exe, even if you have defined the driver unloading routine:
I could not find a solution to this, but WDM driver has no such issue - see the code below.
Simple Windows Driver Model (WDM) Kernel Driver Load and Unload
Below is a simple WDM driver that can be compiled and then loaded and stopped with OSR Driver Loader:
Below shows how our driver is loaded and unloaded via OSR Loader while DbgView prints our DbgPrint output defined in the above DriverEntry and DriverUnload routines: