How to install WDF drivers (Quick-Start)

This post is a small quick-start on how to install WDF drivers.

Part 1: Installing a UMDF driver

You can start with the echo sample, which is located at %WinDDK%\6001.18002\src\umdf\echo.

First, you need to do a bcz in that directory. In your output directory you should see the following files:

1) WudfEchoDriver.dll: This is the UMDF echo driver

2) WudfEchoDriver.inf: This is your inf

3) WudfEchoDriver.pdb: This is the pdb of your driver

Copy these 3 files (the pdb is not needed actually, but it might help you in debugging) to a separate directory (e.g. c:\umdfdriver), together with:

4) devcon.exe: This is used to install the driver. You can find it at %WinDDK%\6001.18002\tools\devcon\devcon.exe

5) WUDFUpdate_01007.dll: This is the coinstaller that will update your system to the correct version of UMDF You can find it at %WinDDK%\6001.18002\redist\wdf\WUDFUpdate_01007.dll

After you put all these 5 files in the same directory (make sure that the architecture for all these files matches the architecture of your system, i.e. use x86, if you have 32-bit windows, amd64 if you have 64-bit), you can install the driver by executing (from an elevated command prompt):

devcon install WudfEchoDriver.inf WUDF\Echo

After the installation succeeds, you can go to the device manager and see a driver with the name "Sample WUDF Echo Driver". This is your UMDF driver that is running. If you look at the task manager, you will see an application with the name wudfhost.exe running. This is the exe that loads your driver (i.e. the dll).

 In order to test the driver, you can compile the application at %WinDDK%\6001.18002\src\kmdf\echo\exe and then run it. If you see success messages, it means that your driver is working correctly. You can look at the sources of the echo driver (possibly it might be easier for you to look at the sources of the UMDF skeleton driver, which is located at %WinDDK%\6001.18002\src\umdf\skeleton, because it is simpler) to understand how the driver is structured.

 

Part 2: Installing a KMDF driver

Again, let's start with the echo sample, which is located at %WinDDK%\6001.18002\src\kmdf\echo\sys.

First, you need to do a bcz in that directory. In your output directory you should see the following files:

1) echo.sys: This is the KMDF echo driver

2) echo.inf: This is your inf

3) echo.pdb: This is the pdb of your driver

Copy these 3 files (the pdb is not needed actually, but it might
help you in debugging) to a separate directory (e.g. c:\kmdfdriver),
together with:

4) devcon.exe: This is used to install the driver. You can find it at %WinDDK%\6001.18002\tools\devcon\devcon.exe

5) WdfCoinstaller01007.dll: This is the coinstaller
that will update your system to the correct version of KMDF You can
find it at %WinDDK%\6001.18002\redist\wdf\WdfCoinstaller01007.dll

After you put all these 5 files in the same directory (make sure that
the architecture for all these files matches the architecture of your
system, i.e. use x86, if you have 32-bit windows, amd64 if you have
64-bit), you can install the driver by executing (from an elevated
command prompt):

devcon install echo.inf root\ECHO

After
the installation succeeds, you can go to the device manager and see a
driver with the name "Sample WDF ECHO Driver". This is your KMDF
echo driver that is running

In
order to test the driver, you can use the same application as for the UMDF driver (echoapp), which is located at %WinDDK%\6001.18002\src\kmdf\echo\exe and then run it. If you see
success messages, it means that your driver is working correctly.

NOTE:   Since both the KMDF and UMDF echo driver as identical from echoapp's perspective, it would be good for you to have only one of the two installed, if you want to make sure that everything worked successfully.