Share via


Building a New Driver

To build a driver, open a build environment, then use the cd command to set your default directory to one that contains a Sources file or a Dirs file.

After you set the directory, start the Build utility with the /cZg switch as in the following example:

E:\NTDDK> cd mydriver\src
E:\NTDDK\mydriver\src> build /cZg

Running build /cZg compiles and links your driver. It creates a clean build (by deleting all pre-existing .obj files) and prevents dependency checking of source and header files.

Output files are put in a subdirectory whose name is based on the build environment type, the platform, and the Windows version for which they are built. For more information, see Specifying the Location of Created Files and How to Use the Build Utility.

For information about how to build a framework-based driver, see the Building and Loading a Framework-based Driver topic in the Windows Driver Kit (WDK) documentation.

Building a WDM Driver

To build a WDM driver, use the DRIVERTYPE macro in your Sources file:

DRIVERTYPE=WDM

When this macro is set, the Build utility sets the path for header files equal to the value of WDM_INC_PATH instead of DDK_INC_PATH. This means that the WDM-only header files will be used in your driver.

For information about how to create drivers that will run on multiple versions of WDM, see Determining the WDM Version and Differences in WDM Versions.

Note   When building an NT-based, non-WDM, unoptimized driver that uses the Ntoskrnl library functions, the Ntoskrnl library must be linked to before linking to any other library.

 

 

Send comments about this topic to Microsoft

Build date: 5/3/2011