IT tutorials
 
Technology
 

Windows 7 : Kernel Mode Installation and Build - Installing a KMDF Driver

10/9/2013 7:36:40 PM
- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019

Drivers must be installed before they can be used—either by the developer to test and debug the driver or by the end user who wants to use the related device. The procedures for installing a driver are distinctly different from those that are used to install applications. This section discusses how to create a WDF installation package and install it on a system.

There is a variety of ways to install drivers on a user’s system. One common way is to simply attach the associated hardware to the user’s system. The Plug and Play manager detects new hardware and prompts the user to insert a disk that contains the driver package. The system then installs the driver. Users can also install drivers manually with the New Hardware application in Control Panel.

KMDF driver packages contain at least three files in addition to the driver binaries:

  • The KMDF co-installer dynamic-link library (DLL).

  • An INF file.

  • A digitally signed catalog (.cat) file. This file is not necessary for test installations.

Driver packages can optionally contain files such as icons, property sheet providers, supporting DLLs, and so on. This section discusses the relatively simple driver package and test-installation procedure for Featured Toaster.

1. The WDF Co-Installer

A KMDF driver package must include the redistributable WDF co-install DLL. Its primary purpose is to install the KMDF run time. The WDF co-installer is located under the WinDDK\BuildNumber\Redis\Wdf folder. There are six co-installers—a checked and a free build for each supported process architecture (x86, Intel Itanium, and amd64). To install the WDF co-installer, add the appropriate DLL to the driver package and add the appropriate directives to the INF file.

The WDF co-installer version number must be greater than or equal to the KMDF version with which the driver is compiled. The version number is embedded in the DLL’s name. For example, the co-installer for KMDF version 1.5 is named WdfCoInstaller01005.dll. The KMDF run-time version and the KMDF co-installer version that are specified in the project’s INF must be identical. The build type of the co-installer must match that of the Windows version on which the driver will be installed. You cannot use the checked build of a co-installer to install a driver on a free build of Windows, or vice versa.

2. The INF

The INF is the core of the installation package. It is a text file that contains most of the information that the system uses to install a driver, including

  • General information about the device such as the device’s manufacturer, installation class, and version number.

  • Names and locations of files on the distribution disk and where they should be installed on the user’s system.

  • Directives for creating or modifying registry entries for the driver or device.

  • Installation directives for which drivers are to be installed, which binaries contain the driver, and a list of drivers to be loaded on the device.

  • Directives for setting KMDF-specific configuration information.

The INF format is much like the earlier Windows .ini files. Each line contains a single entry, and there are two basic types of entries:

  • Section— Each INF contains a number of sections, indicated by square brackets—for example, [Version].

  • Directive— Each section contains one or more directives. A directive is a key-value pair and is used to specify various types of installation-related data. For example, the Class=Mouse directive in the Version section specifies the mouse device class.

3. INFs for KMDF Drivers

Most of the contents of an INF for a KMDF driver are similar to those that are used for WDM drivers and aren’t discussed here. For further information, see the WDK document or examine the INF for Featured Toaster, wdffeatured.inf. The major difference is that INFs for KMDF drivers must contain several additional sections that are devoted to the KMDF co-installer. These sections instruct the system to run the co-installer and provide it with necessary data. The co-installer unpacks and installs a number of files that KMDF drivers require, including the KMDF run-time library.

4. wdffeatured.inf

The following sample shows the WDF co-installer sections from the Featured Toaster sample’s INF file, wdffeatured.inf. It was produced from an INX file by the build described earlier.

[DestinationDirs]
ToasterClasInstallerCopyFiles = 11

[Toaster_Device.NT.CoInstallers]
AddReg=Toaster_Device_CoInstaller_AddReg
CopyFiles=Toaster_Device_CoInstaller_CopyFiles

[Toaster_Device_CoInstaller_AddReg]
HKR, ,CoInstallers32, 0x00010000,
"WdfCoinstaller01000.dll,WdfCoInstaller"

[Toaster_Device_CoInstaller_CopyFiles]
WdfCoinstaller01000.dll

[SourceDisksFiles]
WdfCoinstaller01000.dll=1

[Toaster_Device.NT.Wdf]
KmdfService = wdffeatured, wdffeatured_wdfsect

[wdffeatured_wdfsect]
KmdfLibraryVersion = 1.1

To modify this code for your driver, replace the text that is specific to Featured Toaster with custom text of your choosing. The following example is a generic version of the co-installer section for a driver that is named MyDevice:

[DestinationDirs]
MyDeviceClassInstallerCopyFiles = 11

[MyDevice.NT.CoInstallers]
AddReg=MyDevice_CoInstaller_AddReg
CopyFiles= MyDeviceClassInstallerCopyFiles

[MyDevice_CoInstaller_AddReg]
HKR, ,CoInstallers32,0x00010000,
"WdfCoinstaller01000.dll,WdfCoInstaller"

[MyDevice_CoInstaller_CopyFiles]
wdfCoinstller01000.dll

[SourceDisksFiles]
wdfCoinstaller01000.dll=1 ;

[MyDevice.NT.Wdf]
KmdfService = MyDevice, MyDevice_wdfsect
[MyDevice_wdfsect]
KmdfLibraryVersion = 1.0
 
Others
 
- Windows 7 : Kernel Mode Installation and Build - Building Featured Toaster
- Windows 7 : Kernel Mode Installation and Build - WDK Build Tools, Build Environment, Building a Project
- System Center Configuration Manager 2007 : Using Microsoft Management Console 3.0 (part 3)
- System Center Configuration Manager 2007 : Using Microsoft Management Console 3.0 (part 2)
- System Center Configuration Manager 2007 : Using Microsoft Management Console 3.0 (part 1)
- Administering an Exchange Server 2007 Environment : Managing Exchange Server 2007 Remotely
- Administering an Exchange Server 2007 Environment : Administrative Tools
- Administering an Exchange Server 2007 Environment : Exchange Administrator Roles in Exchange Server 2007
- Sharepoint 2010 : Enterprise Content Management - Hierarchical File Plans and Folder-Based Retention, Records Center
- Sharepoint 2010 : Enterprise Content Management - In-Place Records Management
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
Technology FAQ
- Is possible to just to use a wireless router to extend wireless access to wireless access points?
- Ruby - Insert Struct to MySql
- how to find my Symantec pcAnywhere serial number
- About direct X / Open GL issue
- How to determine eclipse version?
- What SAN cert Exchange 2010 for UM, OA?
- How do I populate a SQL Express table from Excel file?
- code for express check out with Paypal.
- Problem with Templated User Control
- ShellExecute SW_HIDE
programming4us programming4us