Sample Kernel-Mode Drivers

The WDK provides various sample kernel-mode drivers. After you have installed the WDK, the src\general subdirectory contains sample driver code that is applicable to all kernel-mode drivers. The samples are also maintained online. These samples include the following:


Applies the DCH design principles (Declarative, Componentized, and Hardware Support Apps [HSA]). You can use it as a model for your own Windows Driver package.


This sample demonstrates how to write driver for a generic PCI device using Windows Driver Framework.


This sample demonstrates how to create a custom media source and driver package that can be installed as a Camera and produce frames.


This sample demonstrates the usage of V3 System DMA. It shows how a driver could use a system DMA controller supported by Windows to write data to a hardware location using DMA.

WinHEC 2017 Lab

WinHEC 2017/Optimizing Windows Performance


Demonstrates the use of cancel-safe IRP queues.



Demonstrates techniques that kernel-mode drivers can use to notify applications of hardware events, if the application requests notification. One technique uses event objects and the other relies on queuing the notification request until an event occurs.


The FileHistory sample is a console application that starts the file history service, if it is stopped, and schedules regular backups. The application requires, as a command-line parameter, the path name of a storage device to use as the default backup target.

IOCTL sample

Demonstrates how drivers should support I/O control codes.


The ObCallback sample driver demonstrates the use of registered callbacks for process protection. The driver registers control callbacks which are called at process creation.


This sample demonstrates how to write a KMDF driver for a PCI device. The sample works with the Intel 82557/82558 based PCI Ethernet Adapter (10/100) and Intel compatibles.


The Kcs sample driver demonstrates the use of the kernel-mode performance library.


The RegFltr sample shows how to write a registry filter driver.


Provides sample code for a set of drivers that conform to the Windows Driver Model (WDM). This sample also includes sample installation software.


Shows how to use WPP software tracing.

UMDF Driver Skeleton Sample

This sample demonstrates how to use version 1 of the User-Mode Driver Framework to write a minimal driver.

Firefly KMDF filter driver for a HID device Along with illustrating how to write a filter driver, this sample shows how to use remote I/O target interfaces to open a HID collection in kernel-mode and send IOCTL requests to set and get feature reports, as well as how an application can use WMI interfaces to send commands to a filter driver.

Other subdirectories of the \src directory contain sample code for kernel-mode drivers for various types of hardware.

See also

Microsoft Windows driver samples on GitHub