Bewerken

Delen via


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:

DCHU

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.

PLX9x5x

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

SimpleMediaSource

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

SystemDma/wdm

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.

cancel

Demonstrates the use of cancel-safe IRP queues.

echo

event

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.

IOCTL sample

Demonstrates how drivers should support I/O control codes.

obcallback

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

pcidrv

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.

perfcounters/kcs

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

registry/regfltr

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

toaster

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

tracedrv

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