To help you write drivers for Windows, we provide code samples along with the necessary development tools. Whether you’re getting started or porting an older driver to the newest version of Windows, code samples are valuable guides on how to write a driver to enable your device to work well with Windows.
Before Windows 8, driver samples were included with the Windows Driver Kit (WDK) and appeared with the tools and libraries when you installed the kit. Driver samples are no longer part of the WDK, but are available through the MSDN samples gallery. You can download samples individually or as part of a complete samples pack. You can find specific samples by using the gallery's search function. You can specify a name, technology category, or driver model. You can use the code browse feature to view the contents of a sample's files without having to first download it. Go to the samples gallery to download a sample or browse its code.
Samples are downloaded as entire Visual Studio solutions, so you need Visual Studio and the Windows Driver Kit to build a driver sample. Together, Visual Studio and the WDK make up a complete driver development environment that you can use to install, deploy, test, and debug your drivers as well as build them. Driver sample solutions work with Visual Studio 2013 and the Windows Driver Kit (WDK) 8.1.
Here are some of the sample categories available:
Check out the new end-to-end sample for HID, which consists of a passive-infrared motion sensor, device firmware, and a WinRT app that monitors the sensor and triggers a video capture when motion is detected. The app lets the user establish a connection to the device, enable video captures, and set the interval at which the sensor transmits data.
Two tutorials are included with the Visual Studio projects for the firmware and app. The first describes the creation of the device and firmware, and the second describes the creation of the app.
If you’re interested in using a sample to get started in Windows driver development, you should also see the Getting started with drivers topics for an introduction to the process.