Compiling a Simple Kernel Driver, DbgPrint, DbgView
Simple Windows Driver Framework (WDF) Kernel Driver
Select Kernel Mode Driver, Emtpy (KMDF) from templates:
Create a driver.c
Create a new driver.c
file under Source Files
:
Add Driver Code
Enable DbgPrint Monitoring for WinDBG
Change the debug output verbosity:
Starting the driver allows us to see the debug output in WinDBG:
Enable DbgPrint Monitoring for DbgView
Create a sub-key Debug Print Filter
if it does not exist:
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:
References
Last updated