Training
Module
C# testing in Visual Studio - Training
Start testing your C# apps by using the testing tools in Visual Studio. Learn to write tests, use Test Explorer, create test suites, and apply the red, green, refactor pattern to write code.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
In this topic we explain how to use Visual Studio to start writing a new software driver. Software drivers are different from device function drivers, filter drivers, and file system drivers, which we cover in other topics. For more information about software drivers and how they differ from other types of drivers, see What is a Driver? and Choosing a Driver Model.
To begin, first determine which driver model is appropriate for your software driver. The three options are the Kernel Mode Driver Framework (KMDF), the legacy NT driver model, and the Windows Driver Model (WDM). For help determining which model is best for you, see Choosing a Driver Model.
Note
When you create a new KMDF driver, you must select a driver name that has 32 characters or less. This length limit is defined in wdfglobals.h.
In Visual Studio, on the File menu, choose New | Project.
In Visual Studio, in the New Project dialog box, under Windows Driver, select WDM | Empty WDM Driver.
Note
You are not going to write a WDM driver, but you need the Empty WDM Driver template.
Fill in the Name and Location boxes, and select OK.
At this point, you have an empty WDM driver project. In the Solution Explorer window, select and hold (or right-click) your driver project, and choose Add | New Item.
In the Add New Item dialog box, select C++ File (.cpp), enter a name for your file, and select OK.
Note
If you want to create a .c file instead of a .cpp file, enter a name that has the .c extension.
Include ntddk.h.
Implement the functions required by your software driver. As you implement and organize your functions, you might decide to add header files and additional .cpp or .c files.
It is extremely unlikely that you'll want to use WDM for a software driver. But if you do, follow these steps.
In Visual Studio, on the File menu, choose New | Project.
In Visual Studio, in the New Project dialog box, under Windows Driver, select WDM.
Fill in the Name and Location boxes, and select OK.
At this point, you have an empty WDM driver project. In the Solution Explorer window, select and hold (or right-click) your driver project, and choose Add | New Item.
In the Add New Item dialog box, select C++ File (.cpp), enter a name for your file, and select OK.
Note
If you want to create a .c file instead of a .cpp file, enter a name that has the .c extension.
Include wdm.h.
Implement the functions required by your software driver. As you implement and organize your functions, you might decide to add header files and additional .cpp or .c files.
Training
Module
C# testing in Visual Studio - Training
Start testing your C# apps by using the testing tools in Visual Studio. Learn to write tests, use Test Explorer, create test suites, and apply the red, green, refactor pattern to write code.
Documentation
Creating a New Device Function Driver - Windows drivers
In this article, we explain how to use Visual Studio to start writing a new device function driver.
Building a Windows Driver - Windows drivers
Guide to building a Windows Driver
Building a Driver with the WDK - Windows drivers
This topic describes how to build a driver with the Windows Driver Kit (WDK).