ContentsContentsDeveloping Drivers
ContentsContentsDeveloping Drivers
Developing Drivers
Universal Drivers
Getting Started with Universal Drivers
Driver Package Isolation
Building a Universal Windows driver
Validating Universal Drivers
Building for OneCore
Universal Driver Scenarios
Debugging a Universal driver
Target platform on driver reference pages
Driver convergence model for Windows 10
Building Drivers
Creating a New Device Function Driver
Creating a New Filter Driver
Device Filter Driver Ordering
Creating a New Software Driver
Creating a New Primitive Driver
Creating a Driver From Existing Source Files
Building a Driver with the WDK
Building Drivers for Different Versions of Windows
Building ARM64 Drivers with the WDK
Using the Enterprise WDK 10
Installing the WDK 8.1 Build Environment in a Lab
Using the Microsoft C Runtime with User-Mode Drivers and Desktop Apps
Avoiding Floating Point Errors in Custom Build Environments
Counters Manifest Preprocessor Properties for Driver Projects
Driver Model Settings Properties for Driver Projects
Message Compiler Properties for Driver Projects
MOF Compiler Properties for Driver Projects
Stampinf Properties for Driver Projects
Converting WDK 8.1 Projects to WDK 10
Analyzing a Driver Using Code Analysis and Verification Tools
Preparing a Computer for Manual Driver Deployment
What happens when you provision a computer (WDK 8.1)
What happens when you provision a computer (WDK 8.0)
Troubleshooting Configuration of Driver Deployment, Testing and Debugging
Creating a Driver Package
Creating a Device Metadata Package
Signing Drivers
Signing a Driver
Attestation Signing a Kernel Driver for Public Release
Signing a Driver During Development and Testing
Signing a Driver for Public Release
Driver Signing Properties
Deploying Drivers
Deploying a Driver to a Test Computer
Deployment Properties for Driver Package Projects
Driver Verifier Properties for Driver Package Projects
KMDF Verifier Properties for Driver Package Projects
UMDF Verifier Properties for Driver Package Projects
Inf2Cat Properties for Driver Package Projects
How to create a custom driver installation script
Installing a driver on Windows 10 Mobile
Debugging a Driver
Testing Drivers
Testing a Driver
Tips for testing drivers during development
How to test a driver at runtime using Visual Studio
How to run the HCK Test Suites in WDK 8.1
How to select and configure the Device Fundamentals tests
How to test a driver package
How to read the driver test results log
How to test a driver at runtime from a Command Prompt
Troubleshooting the Device Fundamentals tests using the WDK
How to write a driver test using a Driver Test template
How to add test metadata
Static Driver Verifier Known Issues - Windows 10 October 2018 Update (version
1809)
Logging
Creating a Driver Verification Log
Creating a log file for the code analysis tool
Creating a log file for Static Driver Verifier
Distributing a driver package
minutes to read • Edit Online
The Windows driver development environment and the Windows debuggers are integrated into Microsoft Visual
Studio. In this integrated driver development environment, most of the tools you need for coding, building,
packaging, deploying, and testing a driver are available in the Visual Studio user interface.
To set up the integrated development environment, first install Visual Studio and then install the WDK. You can find
information about how to get Visual Studio and the WDK here. Debugging Tools for Windows is included when you
install the WDK.
The WDK uses [Link], which is available both in the Visual Studio user interface and as a command-line tool.
Drivers created in the Visual Studio environment use Project and Solution files to describe a project or group of
projects. The Visual Studio environment provides a tool for converting legacy Sources and Dirs files to Project and
Solution files.
The Visual Studio environment provides templates for:
New drivers
Driver packages
New tests
Enhancement of existing tests
Custom driver deployment scripts
In the Visual Studio environment, you can configure the build process so that it automatically creates and signs a
driver package. Static and run-time analysis tools are available in Visual Studio. You can configure a target
computer for testing your driver and automatically deploy your driver to the target computer each time you
rebuild. You can choose from an extensive set of run-time tests, and you can write your own tests.
The topics in this section show you how to use Visual Studio to perform several of the tasks involved in driver
development, deployment, and testing.
Additional Videos
You'll find videos on the following pages in the Windows driver docs:
What's New in HID
Capture and view USB traces with Microsoft Message Analyzer
Using the Windows Performance Toolkit (WPT) with WDF
Video: Accessing driver IFR logs without a debugger
Video: Debugging your driver with WDF source code
Videos: Debugging UMDF Drivers
minutes to read • Edit Online
Universal Windows drivers enable developers to create a single driver package that runs across multiple device
types, from embedded systems to tablets to desktop PCs.
A Universal Windows driver package contains an INF file and binaries that install and run on Universal Windows
Platform (UWP)-based editions of Windows 10. They also install and run on other editions of Windows 10 that
share a common set of interfaces.
The driver binary can use KMDF, UMDF 2, or the Windows Driver Model (WDM).
A universal driver consists of the following parts:
A base driver
Optional component packages
An optional hardware support app
The base driver contains all the core functionality and shared code. The optional component packages can contain
customizations and additional settings.
Typically, a device manufacturer, or independent hardware vendor (IHV), writes the base driver. Then, a system
builder, or original equipment manufacturer (OEM), provides any optional component packages.
An IHV follows the design best practices of driver package isolation to ensure the driver is reliable and robust to
servicing operations.
After the IHV has certified the base driver, it can be deployed on all OEM systems. Because a base driver can be
used across all systems that share a hardware part, Microsoft can test the base driver broadly by using Windows
Insider driver flighting instead of limiting distribution to specific machines.
After IHV has certified the base driver package, it can be deployed on all OEM systems. Because a base driver
package can be used across all systems that share a hardware part, Microsoft can test the base driver package
broadly via Windows Insider flighting, rather than limiting distribution to specific machines.
The OEM validates only the optional customizations that it provides for the OEM system.
Universal drivers are distributed through Windows Update, and hardware support apps are distributed through
Microsoft Store.
Design principles
When you write a universal driver package, there are four design principles to consider:
Declarative (D) : Install the driver by using only declarative INF directives. Don't include co-installers or
RegisterDll functions.
Componentized (C) : Edition-specific, OEM-specific, and optional customizations to the driver are separate
from the base driver package. As a result, the base driver, which provides only core device functionality, can
be targeted, flighted, and serviced independently from the customizations.
Hardware Support App (H) : Any user interface (UI) component associated with a universal driver must be
packaged as a Hardware Support App (HSA) or preinstalled on the OEM device. An HSA is an optional
device-specific app that's paired with a driver. The application can be a Universal Windows Platform (UWP)
or Desktop Bridge app. You must distribute and update an HSA through the Microsoft Store. For details, see
Hardware Support App (HSA): Steps for driver developers and Hardware Support App (HSA): Steps for app
developers.
Universal API compliance (U) : Binaries in the universal driver package call only those APIs and DDIs that are
included in UWP-based editions of Windows 10. These DDIs are marked as Universal on the
corresponding documentation reference pages. INF files use only universal INF syntax.
Additionally, Universal drivers also benefit from the principles of driver package isolation. You'll find detailed
guidance on how to follow these best practices in the Driver Package Isolation page.
In the documentation, we use the DCHU acronym to refer to these principles. Later in this article, you'll find
guidance to make your driver package DCHU-compliant. Also check out Universal driver scenarios, which
describes how the DCHU universal driver sample applies the DCHU design principles.
Requirements
When you write a universal driver package, follow these steps:
Create a universal INF file for your driver:
1. Review the list of INF sections and directives that are valid in universal driver packages.
2. Use the InfVerif tool to verify that your driver package's INF file is universal.
Use the ApiValidator tool to verify that the APIs your binaries call are valid for a universal driver package.
Best practices
If you're using the Windows Driver Kit (WDK) with Visual Studio, set the Target Platform value in the driver
project properties to Universal . This automatically adds the correct libraries, and it runs the Universal INF
validation and APiValidator as a part of build. To do this:
1. Open the driver project properties.
2. Select Driver Settings .
3. Use the drop-down menu to set Target Platform to Universal .
Driver Package Isolation:
To maximize reliability and serviceability of your Universal driver, ensure your driver follows the
principles of driver package isolation
Driver package isolation is a new concept that allows your driver to be self-contained and robust to OS
changes
See more details on the Driver Package Isolation page
If your INF performs any custom setup actions that depend on the target platform, consider separating
them out into an extension INF. You can update an extension INF independently from the base driver
package to make it more robust and serviceable. For more information, see Using an extension INF file.
If you want to provide an application that works with your device, include a UWP app. For more
information, see Hardware Support App (HSA): Steps for driver developers. An OEM can preload such an
app by using DISM - Deployment Image Servicing and Management. Or, users can manually download the
app from the Microsoft Store.
In the INF DestinationDirs section , set the destination directories to dirid 13 to make the driver run from
the driver store. This setting won't work for some devices.
Submit your universal driver package for certification in the Windows Hardware Compatibility Program.
See the following topics for more details:
Create a new hardware submission
Managing hardware submissions in the Windows Hardware Dev Center dashboard
Get drivers signed by Microsoft for multiple Windows versions
Driver flighting
minutes to read • Edit Online
Driver package isolation describes a set of best practices that make drivers more resilient to external changes,
easier to update, and more straightforward to install.
The following table shows legacy driver practices that are no longer recommended in the left column along with
the recommended best practice in the right column.
INF copies files to System32\drivers Driver files are run from the driver store
Interacts with other drivers using hardcoded paths Interacts with other drivers using system-supplied functions
or device interfaces
Hardcodes path to global registry locations Uses HKR and system-supplied functions for relative location
of registry and file state
Runtime file writes to any location Driver writes files to system-supplied locations
Access to various state should be done by calling functions that provide a caller with the location of the state and
then the state is read/written relative to that location. Do not use hardcoded absolute registry paths and file paths.
This section contains the following subsections:
PnP Device Registry State
Device Interface Registry State
Service Registry State
Device File State
Service File State
PnP Device Registry State
Isolated driver packages and user-mode components typically use two locations to store device state in the
registry. These are the hardware key (device key) for the device and the software key (driver key) for the device. To
retrieve a handle to these registry locations, use one of the following options, based on the platform you are using:
IoOpenDeviceRegistr yKey (WDM)
WdfDeviceOpenRegistr yKey , WdfFdoInitOpenRegistr yKey (WDF)
CM_Open_DevNode_Key (user-mode code)
INF AddReg directive using HKR reg-root entries in an add-registry-section referenced from an INF DDInstall
section or [Link] section, as shown below:
[[Link]]
AddReg = Example_DDInstall.AddReg
[Example_DDInstall.AddReg]
HKR,,ExampleValue,,%13%\[Link]
[[Link]]
Addservice = ExampleService, 0x2, Example_Service_Inst
[Example_Service_Inst]
DisplayName = %[Link]%
ServiceType = 1
StartType = 3
ErrorControl = 1
ServiceBinary = %13%\[Link]
AddReg=Example_Service_Inst.AddReg
[Example_Service_Inst.AddReg]
HKR, Parameters, ExampleValue, 0x00010001, 1
To access the location of this state, use one of these functions, based on your platform:
IoOpenDriverRegistr yKey (WDM)
WdfDriverOpenParametersRegistr yKey (WDF)
Device File State
If files related to a device need to be written, those files should be stored relative to a handle or file path provided
via OS API’s. Configuration files specific to that device is one example of what types of files to be stored here.
IoGetDeviceDirector y (WDM)
WdfDeviceRetrieveDeviceDirector yString (WDF)
Service File State
Both Win32 and driver services read and write state about themselves.
To access its own internal state values, a service uses one of the following options:
IoGetDriverDirector y (WDM)
IoGetDriverDirector y (KMDF)
WdfDriverRetrieveDriverDataDirector yString (UMDF)
To share internal state of the service with other components, use a controlled, versioned interface instead of direct
registry or file reads.
ProgramData
The %ProgramData% user-mode environment variable is available for user-mode components to use when storing
data.
Avoid writing files in the root of the DriverData or ProgramData directories. Instead, create a subdirectory with
your company name and then write files and further subdirectories within that directory.
For example, for a company name of Contoso, a kernel-mode driver could write a custom log to
\DriverData\Contoso\Logs and a user-mode application could collect or analyze the log files from
%DriverData%\Contoso\Logs .
minutes to read • Edit Online
You can use Microsoft Visual Studio 2015 in conjunction with Windows Driver Kit (WDK) 10 to build drivers for
desktop, mobile, or universal. You can download kits and tools from the Windows Hardware Dev Center.
In many cases, you can recompile a legacy kernel-mode driver as a Universal Windows driver, as long as the driver
does not work with any user-mode components. Legacy WDM and KMDF drivers should recompile as Universal
Windows drivers targeting Windows 10 with no conversion required.
In contrast, existing user-mode drivers may require modification to compile as Universal Windows drivers.
Specifically, your driver package must not have any dependencies outside of UWP. For example, only some of the
Win32 APIs are part of UWP.
Provider="Contoso"
4. You can now build the solution. Visual Studio links against the required libraries and generates a .cat file, an
.inf file, and a driver binary.
You can use the [Link] tool to verify that the APIs that your binaries call are valid for a Universal
Windows driver. The tool returns an error if your binaries call an API that is outside the set of valid APIs for
Universal Windows drivers. This tool is part of the Windows Driver Kit (WDK) for Windows 10.
Warning 1 warning : API DecodePointer in [Link] is not supported. [Link] calls this API.
C:\Program Files (x86)\Windows Kits\10\src\usb\umdf2_fx2\driver\[Link] osrusbfx2um
Warning 2 warning : API DisableThreadLibraryCalls in [Link] is not supported. [Link] calls
this API. C:\Program Files (x86)\Windows Kits\10\src\usb\umdf2_fx2\driver\[Link] osrusbfx2um
Warning 3 warning : API EncodePointer in [Link] is not supported. [Link] calls this API.
C:\Program Files (x86)\Windows Kits\10\src\usb\umdf2_fx2\driver\[Link] osrusbfx2um
Warning 4 warning : API GetCurrentProcessId in [Link] is not supported. [Link] calls this
API. C:\Program Files (x86)\Windows Kits\10\src\usb\umdf2_fx2\driver\[Link] osrusbfx2um
Warning 5 warning : API GetCurrentThreadId in [Link] is not supported. [Link] calls this API.
C:\Program Files (x86)\Windows Kits\10\src\usb\umdf2_fx2\driver\[Link] osrusbfx2um
Warning 6 warning : API GetSystemTimeAsFileTime in [Link] is not supported. [Link] calls this
API. C:\Program Files (x86)\Windows Kits\10\src\usb\umdf2_fx2\driver\[Link] osrusbfx2um
Warning 7 warning : API IsDebuggerPresent in [Link] is not supported. [Link] calls this API.
C:\Program Files (x86)\Windows Kits\10\src\usb\umdf2_fx2\driver\[Link] osrusbfx2um
Warning 8 warning : API IsProcessorFeaturePresent in [Link] is not supported. [Link] calls
this API. C:\Program Files (x86)\Windows Kits\10\src\usb\umdf2_fx2\driver\[Link] osrusbfx2um
Warning 9 warning : API QueryPerformanceCounter in [Link] is not supported. [Link] calls this
API. C:\Program Files (x86)\Windows Kits\10\src\usb\umdf2_fx2\driver\[Link] osrusbfx2um
Error 10 error MSB3721: The command ""C:\Program Files (x86)\Windows Kits\10\bin\x64\[Link]" -
DriverPackagePath:"C:\Program Files (x86)\Windows Kits\10\src\usb\umdf2_fx2\Debug\\" -
SupportedApiXmlFiles:"C:\Program Files (x86)\Windows Kits\10\build\universalDDIs\x86\[Link]" -
ApiExtractorExePath:"C:\Program Files (x86)\Windows Kits\10\bin\x64"" exited with code -1. C:\Program Files
(x86)\Windows Kits\10\build\[Link] 1531 5 osrusbfx2um
%AdditionalDependencies);$(SDK_LIB_PATH)\[Link]
To review other linker options for targeting OneCore SKUs, see Building for OneCore.
2. Remove or replace the non-universal API calls one at a time and rerun the tool until there are no errors.
3. In some cases, you can replace these calls with alternate DDIs that are listed on the reference pages for the
desktop-only DDI. If you cannot find a suitable replacement, please submit feedback. You may have to code
a workaround if there is not a suitable replacement. If you need to, write a new Universal Windows driver
starting from the driver templates in the WDK.
If you see errors like the following, please refer to the guidance in Building for OneCore.
[Link]: Warning: API DecodePointer in [Link] is not supported. [Link] calls this API.
[Link]: Warning: API DisableThreadLibraryCalls in [Link] is not supported. [Link]
calls this API.
[Link]: Warning: API EncodePointer in [Link] is not supported. [Link] calls this API.
[Link]: Warning: API GetCurrentProcessId in [Link] is not supported. [Link] calls
this API.
[Link]: Warning: API GetCurrentThreadId in [Link] is not supported. [Link] calls this
API.
[Link]: Warning: API GetSystemTimeAsFileTime in [Link] is not supported. [Link] calls
this API.
[Link]: Warning: API IsDebuggerPresent in [Link] is not supported. [Link] calls this
API.
[Link]: Warning: API IsProcessorFeaturePresent in [Link] is not supported. [Link]
calls this API.
[Link]: Warning: API QueryPerformanceCounter in [Link] is not supported. [Link] calls
this API.
The XML files that enumerate the valid APIs for Universal Windows drivers are located in C:\Program Files
(x86)\Windows Kits\10\build\universalDDIs\<arch>.
Troubleshooting
If [Link] outputs an incorrect format error such as the following:
Error 1 error : AitStatic output file has incorrect format or analysis run on incorrect file
types. C:\Program Files (x86)\Windows Kits\10\src\usb\umdf2_fx2\driver\[Link]
osrusbfx2um
$(SolutionDir)$(Platform)\$(ConfigurationName)\
Known issues
ApiValidator does not run on ARM64 because AitStatic does not work on ARM64.
ARM64 binaries can be tested on x64 machines but not on an x86 machine.
ApiValidator can run on x86 to test x86 binaries and ARM binaries.
ApiValidator can run on x64 to test x86, x64, ARM, and ARM64 binaries.
minutes to read • Edit Online
When you use Visual Studio to build user-mode code for Windows 10, you can customize linker options to target
specific versions of Windows. Consider the following factors:
Should the built binary run on only the most recent version of Windows? Or should it run on earlier
versions, such as Windows 7?
Does your project have any UWP dependencies?
For example, when you create a new UMDF v2 driver project, Visual Studio links to [Link] by default. This
results in a binary that runs on the most recent version of Windows, and it permits addition of UWP functionality.
However, depending on your requirements, you might choose instead to link to [Link] . The following table
shows the scenarios applicable to each library:
L IB RA RY SC EN A RIO
NOTE
To change linker options in Visual Studio, choose project properties and navigate to Linker->Input->Additional
Dependencies .
A subset of Windows APIs compile cleanly but return runtime errors on non-Desktop OneCore editions (for
example Mobile or IoT).
For example, the InstallApplication function returns ERROR_ NOT_SUPPORTED on non-Desktop OneCore editions.
The ApiValidator tool also reports these problems. The next section describes how to fix them.
If your app or base driver needs to run on Windows 10 as well as earlier versions of Windows, you must
remove API calls in the above category.
Error: <Binary Name> has a dependency on <Module Name><Api Name> but is missing: IsApiSetImplemented("
<contract-name-for-Module>)
API calls in the above category compile fine, but may not behave as expected at runtime, depending on the
target operating system. To pass the U requirement of DCHU, wrap these calls with IsApiSetImplemented .
This enables you to compile your code with no errors. Then at runtime, if the target machine does not have the
needed API, IsApiSetImplemented returns FALSE.
The following code samples illustrate how to do this.
Code sample: Direct usage of API, without evaluating for existence
This code runs fine on versions of Windows earlier than Windows 10, but running it on a OneCore edition of
Windows 10 results in WTSEnumerateSessions failure : 78 or ERROR_CALL_NOT_IMPLEMENTED 120 (0x78).
This code sample fails the U part of DCHU with the following ApiValidator errors:
#include <windows.h>
#include <stdio.h>
#include <Wtsapi32.h>
WTSFreeMemory(pInfo);
}
else
{
wprintf(L"WTSEnumerateSessions failure : %x\n", GetLastError());
}
return 0;
}
if (!IsApiSetImplemented("ext-ms-win-session-wtsapi32-l1-1-0"))
{
wprintf(L"IsApiSetImplemented on ext-ms-win-session-wtsapi32-l1-1-0 returns FALSE\n");
}
else
{
if (WTSEnumerateSessionsW(WTS_CURRENT_SERVER_HANDLE, 0, 1, &pInfo, &count))
{
wprintf(L"SessionCount = %d\n", count);
WTSFreeMemory(pInfo);
}
else
{
wprintf(L"WTSEnumerateSessions failure : %x\n", GetLastError());
}
}
return 0;
}
Recommended actions
Review the linker options above and update your Visual Studio project accordingly.
Use the ApiValidator tool in the WDK. This tool runs automatically when you build a driver in Visual Studio.
Use runtime testing to verify that your user-mode code runs as you expect on non-Desktop OneCore editions.
Note that stubbed APIs may generate different error codes.
See Also
Validating Universal Windows drivers
OneCore
minutes to read • Edit Online
This topic describes how the DCHU universal driver sample applies the DCHU design principles (Declarative,
Componentized, Hardware Support Apps [HSA], and Universal API compliance). You can use it as a model for your
own universal driver package.
If you would like a local copy of the sample repo, clone from Windows-driver-samples.
This sample is intended to be used with Windows 10 Version 1703 and later.
Prerequisites
Before you read this section, check out the requirements and best practices for universal driver packages described
in Getting Started with Universal Windows drivers.
Overview
The DCHU sample provides example scenarios where two hardware partners, Contoso (a system builder, or OEM)
and Fabrikam (a device manufacturer, or IHV) are working together to create a Universal Windows Driver for a
device in Contoso's upcoming system. The device in question is an OSR USB FX2 learning kit. In the past, Fabrikam
would write a non-universal driver package that was customized to a specific Contoso product line, and then hand
it to the OEM to handle servicing. This resulted in significant maintenance overhead, so Fabrikam decides to
refactor the code and create a universal driver package instead.
[Version]
Class = Extension
ClassGuid = {e2f84ce7-8efa-411c-aa69-97454ca4cb57}
Provider = Contoso
ExtensionId = {zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzzz} ; replace with your own GUID
In osrfx2_DCHU_base.inx , Fabrikam specifies the following entries:
[OsrUsbFx2_AddReg]
HKR, OSR, "OperatingMode",, "Default" ; FLG_ADDREG_TYPE_SZ
HKR, OSR, "OperatingParams",, "None" ; FLG_ADDREG_TYPE_SZ
In osrfx2_DCHU_extension.inx , Contoso overrides the OperatingParams registry value set by the base and adds
OperatingExceptions :
[OsrUsbFx2Extension_AddReg]
HKR, OSR, "OperatingParams",, "-Extended"
HKR, OSR, "OperatingExceptions",, "x86"
Note that extensions are always processed after the base INF in no definite order. If a base INF is updated to a
newer version, then the extensions will still be re-applied after the new base INF is installed.
[OsrFx2_Install.NT]
CopyFiles = OsrFx2_UserSvcCopyFiles
[OsrFx2_Install.[Link]]
AddService = osrfx2_DCHU_usersvc, 0x00000800, UserSvc_ServiceInstall
[UserSvc_ServiceInstall]
DisplayName = %UserSvcDisplayName%
ServiceType = 0x00000010
StartType = 3
ErrorControl = 1
ServiceBinary = %13%\osrfx2_DCHU_usersvc.exe
[OsrFx2_UserSvcCopyFiles]
osrfx2_DCHU_usersvc.exe
Note that such a service could also be installed in a component or extension INF, depending on the scenario.
[OsrFx2Extension_Install.[Link]]
AddComponent = osrfx2_DCHU_component,,OsrFx2Extension_ComponentInstall
[OsrFx2Extension_ComponentInstall]
ComponentIds=VID_045e&PID_94ab
Then, in the component INF osrfx2_DCHU_component.inx , Fabrikam specifies the AddSoftware directive to install
the optional executable:
[OsrFx2Component_Install.[Link]]
AddSoftware = osrfx2_DCHU_componentsoftware,, OsrFx2Component_SoftwareInstall
[OsrFx2Component_SoftwareInstall]
SoftwareType = 1
SoftwareBinary = osrfx2_DCHU_componentsoftware.exe
SoftwareArguments = <<DeviceInstanceId>>
SoftwareVersion = [Link]
[OsrFx2Component_CopyFiles]
osrfx2_DCHU_componentsoftware.exe
The source code for the Win32 app is included in the DCHU sample.
Note that the component driver package is only distributed on Desktop SKUs due to targeting set in the Windows
Hardware Dev Center dashboard. For more info, see Publish a driver to Windows Update.
WDF_DEVICE_INTERFACE_PROPERTY_DATA PropertyData = { 0 };
static const wchar_t customCapabilities[] = L"CompanyName.yourCustomCapabilityNameTBD_YourStorePubId\0";
WDF_DEVICE_INTERFACE_PROPERTY_DATA_INIT(&PropertyData,
&GUID_DEVINTERFACE_OSRUSBFX2,
&DEVPKEY_DeviceInterface_UnrestrictedAppCapabilities);
Status = WdfDeviceAssignInterfaceProperty(Device,
&PropertyData,
DEVPROP_TYPE_STRING_LIST,
sizeof(customCapabilities),
(PVOID)customCapabilities);
The new app (not included in the DCHU sample) is secure and can be updated easily in the Microsoft Store. With
the UWP application ready, Contoso uses DISM - Deployment Image Servicing and Management to pre-load the
application on Windows desktop edition images.
[OsrFx2Extension_Install.NT]
CopyInf=osrfx2_DCHU_component.inf
This directive can also be used to coordinate installation of INF files in multifunction devices. For more details, see
Copying INF files.
NOTE
While a base driver can payload an extension (and target the base driver in the shipping label), an extension bundled with
another driver cannot be published to the extension hardware ID.
[DestinationDirs]
OsrFx2_UserSvcCopyFiles = 13 ; copy to Driver Store
A kernel mode driver that is running from the Driver Store can call IoQuer yFullDriverPath and use that path to
find configuration files relative to it. If the kernel mode driver is a KMDF driver, it can use
WdfDriverWdmGetDriverObject to retrieve the WDM driver object to pass to IoQueryFullDriverPath. UMDF
drivers can use GetModuleHandleExW and GetModuleFileNameW to determine where the driver was loaded
from. For example:
bRet = GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
(PCWSTR)&DriverEntry,
&handleModule);
if (bRet) {
winErr = GetModuleFileNameW(handleModule,
path,
pathLength);
…
[[Link]]
AddReg = Example_DDInstall.AddReg
[Example_DDInstall.AddReg]
HKR,,ExampleValue,,%13%\[Link]
An INF example for setting this as device interface state would be:
[[Link]]
AddInterface = {<fill in an interface class GUID for an interface exposed by the
device>},,Example_Add_Interface_Section
[Example_Add_Interface_Section]
AddReg = Example_Add_Interface_Section.AddReg
[Example_Add_Interface_Section.AddReg]
HKR,,ExampleValue,,%13%\[Link]
The above examples use an empty flags value, which results in a REG_SZ registry value. This results in the %13%
being turned into a fully qualified user mode file path. In many cases, it is preferable to have the path be relative to
an environment variable. If a flags value of 0x20000 is used, the registry value is of type REG_EXPAND_SZ and the
%13% converts to a path with appropriate environment variables to abstract the location of the path. When
retrieving this registry value, call ExpandEnvironmentStrings to resolve the environment variables in the path.
If the value needs to be read by a kernel mode component, the value should be a REG_SZ value. When the kernel
mode component reads that value, it should prepend \??\ before passing it to APIs such as ZwOpenFile .
To access this setting when it is part of the device's state, first the application must find the identity of the device.
User mode code can use CM_Get_Device_ID_List_Size and CM_Get_Device_ID_List to get a list of devices,
filtered as necessary. That list of devices might contain multiple devices, so search for the appropriate device before
reading state from the device. For example, call CM_Get_DevNode_Proper ty to retrieve properties on the device
when looking for a device matching specific criteria.
Once the correct device is found, call CM_Open_DevNode_Key to get a handle to the registry location where the
device state was stored.
Kernel mode code should retrieve a PDO (physical device object) and call IoOpenDeviceRegistr yKey .
To access this setting when it is device interface state, User mode code can call
CM_Get_Device_Interface_List_Size and CM_Get_Device_Interface_List .
Additionally CM_Register_Notification can be used to be notified of arrivals and removals of device interfaces
so the code gets notified when the interface is enabled and then can retrieve the state. There may be multiple
device interfaces in the device interface class used in the above APIs. Examine those interfaces to determine which
is the correct interface for the setting to read.
Once the correct device interface is found, call CM_Open_Device_Interface_Key .
Kernel mode code can retrieve a symbolic link name for the device interface from which to get state. To do so, call
IoRegisterPlugPlayNotification to register for device interface notifications on the appropriate device interface
class. Alternatively, call IoGetDeviceInterfaces to get a list of current device interfaces on the system. There may
be multiple device interfaces in the device interface class used in the above APIs. Examine those interfaces to
determine which is the correct interface that should have the setting to be read.
Once the appropriate symbolic link name is found, call IoOpenDeviceInterfaceRegistr yKey to retrieve a handle
to the registry location where the device interface state was stored.
NOTE
Use the CM_GETIDLIST_FILTER_PRESENT flag with CM_Get_Device_ID_List_Size and CM_Get_Device_ID_List or the
CM_GET_DEVICE_INTERFACE_LIST_PRESENT flag with CM_Get_Device_Interface_List_Size and
CM_Get_Device_Interface_List . This ensures that hardware is present and ready for communication.
Summary
The following diagram shows the driver packages that Fabrikam and Contoso created for their Universal Windows
Driver. In the loosely coupled example, they will make three separate submissions on the Windows Hardware Dev
Center dashboard: one for the base, one for the extension, and one for the component. In the tightly coupled
example, they will make two submissions: base and extension/component.
Note that the component INF will match on the component hardware ID, whereas the base and extensions will
match on the board's hardware ID.
See also
Getting Started with Universal Windows drivers
Using an Extension INF File
minutes to read • Edit Online
For general information about debugging universal drivers, see Getting Started with Windows Debugging.
You can access the ETW logs using Tracelog by using !wmitrace in a debugger session.
minutes to read • Edit Online
In the Requirements block at the bottom of Microsoft driver reference pages, you'll see an entry called Target
Platform . This line lists editions of Windows to which the page applies.
Here's an example of such an entry:
The values specified in Target Platform map to the values you can use in Visual Studio, in the Target Platform
property under Configuration Proper ties->Driver Settings->General .
Here are the values you might see for Target Platform , and what they mean:
Mobile A driver binary for Windows 10 Mobile can call this DDI.
minutes to read • Edit Online
To make your device work on Windows and Windows Phone releases before Windows 10, you probably needed to
write two separate drivers, for example one for Windows 8.1 and one for Windows Phone 8.1. In Windows 10, in
most cases, you can write one driver that will run on any Windows 10 version. This topic describes convergence
plans for device driver interfaces in Windows 10 and provides details when there are version-specific differences. It
answers these questions:
For legacy drivers, will a Windows 8.1 driver work on Windows 10 for desktop editions (Home, Pro, and
Enterprise) and/or Windows 10 Mobile?
For new drivers, can I build one driver with the Windows 10 kit that will work on Windows 10 for desktop
editions and Windows 10 Mobile?
W IN DO W S 8. 1 DRIVER B IN A RY RUN S
T EC H N O LO GY O N W IN DO W S 10? C H A N GES F O R W IN DO W S 10
Windows Driver Frameworks (WDF) Yes Windows 10 ships with KMDF 1.15,
UMDF 2.15, UMDF 1.11, and earlier
framework versions. Windows 10
Mobile also ships with KMDF 1.15,
UMDF 2.15, and earlier framework
versions. Note that UMDF version 1
is not available in Windows 10
Mobile. Only KMDF and UMDF
version 2 can be used to write
Universal Windows drivers.
In this topic we explain how to use Visual Studio to start writing a new device function driver. Device function
drivers are different from filter drivers, software drivers, and file system drivers, which we cover in other topics. To
learn about device function drivers and how they differ from other types of drivers, see What is a Driver?, Choosing
a Driver Model, and Device Nodes and Device Stacks.
To begin, first determine where your device fits in the list of technologies described in Device and Driver
Technologies. To learn about which driver models are available for your device, see the documentation for that
particular technology. The recommended driver model varies from one technology to the next. For some
technologies, the documentation recommends using the User Mode Driver Framework (UMDF) or the Kernel Mode
Driver Framework (KMDF). For other technologies, the documentation explains how to create a minidriver that is
part of a driver pair. Minidrivers go by a variety of names, including miniport and miniclass.
Next, determine which of the following cases describes your driver model recommendation and follow the steps:
Case 1: The documentation for your technology recommends UMDF.
1. In Visual Studio, on the File menu, choose New | Project .
2. In the New Project dialog box, in the left pane, locate and select Visual C++ | Windows Driver | WDF .
3. In the middle pane, select User Mode Driver (UMDF) .
4. Fill in the Name and Location boxes, and click OK . For more details, see Writing a UMDF Driver Based on a
Template. Note When you create a new UMDF driver, you must select a driver name that has 32 characters or
less. This length limit is defined in wdfglobals.h.
5. At this point, you have a driver project that implements the general code required by most UMDF drivers. Now
you can supply the code that is specific to your device. Refer to the documentation for your technology to learn
about the interfaces that you need to implement.
Case 2: The documentation for your technology recommends KMDF.
1. In Visual Studio, on the File menu, choose New | Project .
2. In the New Project dialog box, in the left pane, locate and select WDF .
3. In the middle pane, select Kernel Mode Driver (KMDF) .
4. Fill in the Name and Location boxes, and click OK . For more details, see Writing a KMDF Driver Based on a
Template. 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.
5. At this point, you have a driver project that implements the general code required by most KMDF drivers. Now
you can supply the code that is specific to your device. Refer to the documentation for your technology to learn
about the methods that you need to implement.
Case 3: The documentation for your technology describes a minidriver model.
If your device technology has a miniport, miniclass, or some other kind of minidriver model, check to see if Visual
Studio has a specific template for the model.
1. In Visual Studio, on the File menu, choose New | Project .
2. In the New Project dialog box, in the left pane, locate and select Templates | Visual C++ | Windows Driver .
3. Browse the list of installed templates to find a template for the type of minidriver you need to write.
4. If there is no template for your type of minidriver under Windows Driver , click Online and browse the
templates that are available online.
5. If you find a template for your type of minidriver, select the template, fill in the Name and Location boxes, and
click OK .
6. At this point, you have a driver project that implements the general code required by your minidriver. Now you
can supply the code that is specific to your device. Refer to the documentation for your technology to learn
about the functions that you need to implement.
If your device technology has a minidriver model, and you are not able to find a specific template for your type of
minidriver, the Windows Driver Model (WDM) template is most likely going to be your starting point. Refer to your
technology-specific documentation for guidance. In rare cases, you can use KMDF to write a minidriver, but usually
the starting point is WDM.
1. In Visual Studio, on the File menu, choose New | Project .
2. In Visual Studio, in the New Project dialog box, under Windows Driver , select WDM.
3. Fill in the Name and Location boxes, and click OK .
4. At this point, you have an empty WDM driver project. In the Solution Explorer window, right-click your driver
project, and choose Add | New Item .
5. In the Add New Item dialog box, select C++ File (.cpp) , enter a name for your file, and click OK .
Note If you want to create a .c file instead of a .cpp file, enter a name that has the .c extension.
6. Refer to the documentation for your technology to learn about the functions that you need to implement. As
you implement and organize your functions, you might decide to add additional .cpp or .c files.
minutes to read • Edit Online
In this topic we explain how to use Visual Studio to start writing a new filter driver. Filter drivers are different from
device function drivers, software drivers, and file system drivers, which we cover in other topics. To learn about
filter drivers and how they differ from other types of drivers, see the following topics.
What is a Driver?
Choosing a Driver Model
Device Nodes and Device Stacks
Filter Drivers
Types of WDM Drivers
To begin, first determine which driver model is appropriate for your filter driver. For help determining which model
is best for you, see Choosing a Driver Model. If you are writing a filter driver for a hardware device, determine
where your device fits in the list of technologies described in Device and Driver Technologies. See the
documentation for that particular technology to see whether there is any guidance for choosing a filter driver
model. The recommended filter driver model varies from one technology to the next. For some technologies, the
documentation recommends using the User Mode Driver Framework (UMDF), the Kernel Mode Driver Framework
(KMDF), or the Windows Driver Model (WDM). For other technologies, the documentation gives explicit details on
how to write a filter driver. Some technologies have mini filter models. For some technologies, there might not be
any recommendation for a filter driver model.
Next, determine which of the following cases describes your driver model recommendation and follow the steps:
Microsoft has developed a method of declaratively adding filters by expressing the intent of the filter, rather than
the stack position, known as device filter driver ordering.
NOTE
Even without levels defined by the base INF, a declarative filter may register as simply upper or lower. When levels are not
defined, this is logically equivalent to appending the filter to the end of the UpperFilters/LowerFilters registry value. When
levels are defined, one of the levels must be marked as the default level in the base driver, and in this case the filter will be
registered into that level.
Scenarios
Consider an I/O device driver that encrypts the data that is coming through the stack. A typical implementation
may use a lower filter driver immediately underneath the function driver to accomplish this. In order to ensure that
the encryption filter is placed at the exact position the driver author desires, they may use declarative filters as
shown below:
The Base INF establishes two levels of lower filters, "Encryption" and "Monitoring" (Default). "Monitoring" (Default)
in this example are the rest of the lower filters that might exist for this particular device. By explicitly placing the
"Encrypt" filter driver in the "Encryption" level, the driver ensures that the resulting device stack order will put the
"Encrypt" filter driver before any other lower filters and immediately following the function driver.
Let's take the example one step further. Imagine a newer version of the driver comes out and the author has built in
encryption to the function driver. This removes the need for a separate "Encrypt" filter driver. The author simply
needs to remove the level that contained the "Encrypt" filter from the Base INF and when the driver updates, the
stack is dynamically built again.
If a filter declares itself to be in an explicit level that does not exist, the filter does not end up in the device stack. In
the example, the Base INF has been updated and even though the Extension INF remains the same, the resulting
device stack excludes the "Encrypt" filter as it was not included in the Base INF's declaration of levels.
Level Order: A, B, C
DefaultFilterLevel: C
Specifying the default level as the final level indicates that any filter that lacking position information will be
appended to the filter list. Alternatively, the driver author may wish to have the stack always end with filters
explicitly registered to level C:
Level Order: A, B, C
DefaultFilterLevel: B
Due to the default filter level being set to B, any additional filter without position information will be inserted
between A's filters and C's filters.
Syntax
Registering filters
[[Link]]
AddFilter = <FilterName>, [Flags], FilterSection
[FilterSection]
FilterLevel=<LevelName>
Option 2:
FilterPosition=Upper/Lower
[[Link]]
AddReg = FilterLevel_Definition
[FilterLevel_Definition]
HKR,,UpperFilterLevels,%REG_MULTI_SZ%,"LevelA","LevelB","LevelC"
HKR,,UpperFilterDefaultLevel,,"LevelC"
HKR,,LowerFilterLevels,%REG_MULTI_SZ%,"LevelD","LevelE","LevelF"
HKR,,LowerFilterDefaultLevel,,"LevelE"
DEVPKEY_Device_CompoundUpperFilters
DEVPKEY_Device_CompoundLowerFilters
[Filters]
HKR,,"UpperFilters", 0x00010008, "MyFilter"
This syntax will add "MyFilter" to the end of the list of upper filters.
With the new syntax that has been introduced, the above section is logically similar to:
[[Link]]
AddFilter = MyFilter,,MyUpperFilterInstall
[MyUpperFilterInstall]
FilterPosition = Upper
This specifies that the filter "MyFilter" should be added to the list of upper filters. If the base INF has specified filter
levels, using FilterPosition will register the filter in the default level for that position.
If filter levels are not specified, this filter will be registered as an upper filter in arbitrary order.
minutes to read • Edit Online
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.
5. At this point, you have a driver project that implements the general code required by most KMDF drivers. Now
you can supply the code that is specific to your software driver.
NOTE
You are not going to write a WDM driver, but you need the Empty WDM Driver template.
NOTE
If you want to create a .c file instead of a .cpp file, enter a name that has the .c extension.
6. Include ntddk.h.
7. 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.
NOTE
If you want to create a .c file instead of a .cpp file, enter a name that has the .c extension.
6. Include wdm.h.
7. 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.
Creating a new primitive driver
4/7/2020 • 4 minutes to read • Edit Online
Use a primitive driver to handle and manage software that uses INF-based installation but are not necessarily tied
to a particular hardware device.
Legacy Compatibility
While [DefaultUninstall] is prohibited in Primitive Drivers, an exception is made for the sake of down-level OS
compatibility. Windows introduces an INF directive that causes an OS version that supports Primitive Drivers to
ignore the [DefaultUninstall] section. If your driver package needs to support down-level OS versions, include the
following syntax to ensure that the platform will appropriately handle such cases:
[DefaultUninstall.NTamd64]
LegacyUninstall=1
The [DefaultInstall] and [DefaultUninstall] sections must still be architecture decorated ; however, by including
the LegacyUninstall=1 , Windows ignores the [DefaultUninstall] section (in Windows 10 version 1903 and later). By
doing so, you can include that section in your INF, where it can be used down-level with a legacy install/uninstall
application in order to uninstall the primitive driver package.
Beginning with Windows 10 version 1903, if you pass an architecture-decorated [DefaultInstall] or
[DefaultUninstall] section in to the InstallHInfSection API in [Link], the driver package will be checked to
determine if it supports primitive driver functionality. If it does support primitive driver functionality, rather than
process the specified section in the legacy way, the INF is passed to DiInstallDriver or DiUninstallDriver, as
appropriate. This way, a single installer can make use of primitive drivers on compatible OS versions and maintain
support for previous OS versions.
[Driver.NTx86]
%DeviceDesc% = InstallSection_32,
[Driver.NTamd64]
%DeviceDesc% = InstallSection_64,
[InstallSection_64]
CopyFiles = MyCopyFiles_64
AddReg = MyAddReg
[InstallSection_64.Services]
AddService = MyService,, MyService_Install
[InstallSection_32]
CopyFiles = MyCopyFiles_x86
AddReg = MyAddReg
[InstallSection_32.Services]
AddService = MyService,, MyService_Install
This INF will receive an 1297 error in InfVerif because it doesn't install on any hardware. This INF can be converted
to a [DefaultInstall]-based INF, as shown below.
[DefaultInstall.NTamd64]
CopyFiles = MyCopyFiles_64
AddReg = MyAddReg
[[Link]]
AddService = MyService,, MyService_Install
[DefaultInstall.NTx86]
CopyFiles = MyCopyFiles_x86
AddReg = MyAddReg
[[Link]]
AddService = MyService,, MyService_Install
minutes to read • Edit Online
The WDK is integrated with Microsoft Visual Studio, and uses the same compiler and build tools that you use to
build Visual Studio solutions and projects. MSBuild replaces the Windows Build Utility ([Link]) that was used in
versions of the WDK prior to Windows Driver Kit (WDK) 8.
To convert a driver that was created with a previous version of the WDK, create a new Windows driver solution in
Visual Studio using one of the provided Windows driver templates. If you start with a template for your driver
model, the structure of the project will be in place and the correct platform tool set will be selected. You can then
add your source files to the solution. For information about selecting templates, see Creating a New Device
Function Driver, Creating a New Filter Driver, or Creating a New Software Driver.
Related topics
WDK and the Visual Studio build environment
ProjectUpgradeTool
MSBuild
Walkthrough: Using MSBuild
Creating a New Device Function Driver
Creating a New Filter Driver
Creating a New Software Driver
minutes to read • Edit Online
This topic describes how you can build a driver with the Windows Driver Kit (WDK). WDK 10 is fully integrated
with Microsoft Visual Studio. You can build a driver using the Visual Studio development environment, or you can
build a driver directly from the command line by using the Microsoft Build Engine (MSBuild).
You can use any edition of Microsoft Visual Studio 2015, including Microsoft Visual Studio Community 2015, to
build drivers for:
Windows 10
Windows 8.1
Windows 7
Impor tant Starting in Windows Driver Kit (WDK) 8, MSBuild replaced the Windows Build Utility ([Link]). The
WDK now uses the same compiler and build tools that you use to build Visual Studio projects. Driver projects that
were built with previous versions of the WDK must be converted to work in the Visual Studio environment. You
can run a conversion utility from the command line, or you can convert an existing driver by creating new Visual
Studio project from existing sources. For more info, see Creating a Driver From Existing Source Files and WDK and
the Visual Studio build environment.
Syntax - To specify a specific configuration and platform, use the following command syntax:
For example, the following command builds a Universal Windows driver for the "Debug" configuration,
"Win32" platform, and for Windows 10.
The TargetPlatformVersion setting is optional and allows you to specify the kit version to build with. The
default is to use the latest kit.
Signing properties for individual driver files (see Signing a Signing properties for driver packages (see Signing a
Driver) Driver)
Counters Manifest Preprocessor Properties for Driver Projects Deployment Properties for Driver Package Projects (see
(for CTRPP) Deploying a Driver to a Test Computer)
Driver Model Settings Properties for Driver Projects Driver Verifier Properties for Driver Package Projects
Message Compiler Properties for Driver Projects KMDF Verifier Properties for Driver Package Projects
Stampinf Properties for Driver Projects UMDF Verifier Properties for Driver Package Projects
WPP Preprocessor (WPP Tracing) Inf2Cat Properties for Driver Package Projects (see the
Inf2Cat tool)
Related topics
Building in Visual Studio
Building Drivers for Different Versions of Windows
Using the Microsoft C Runtime with User-Mode Drivers and Desktop Apps
ProjectUpgradeTool
MSBuild
Creating a Driver From Existing Source Files
WDK and the Visual Studio build environment
Signing a Driver
Deploying a Driver to a Test Computer
minutes to read • Edit Online
If you are writing drivers for different versions of Windows, the following section provides some guidelines about
how you should build those drivers using the Windows Driver Kit (WDK) 8.1 or WDK 8, Visual Studio, and MSBuild.
XM L
<KernelBufferOverflowLib>$(DDK_LIB_PATH)\[Link]</KernelBufferOverflowLib>
For example, if your driver supports Windows 8.1 and Windows 8 debug and release builds, those
configuration sections would look like the following:
XM L
The <KernelBufferOverflowLib> elements must appear in the driver project file before the element that
imports [Link], which imports the tool set.
After you modify and save the driver project file, you can open the project file in Visual Studio and build the
driver.
Related topics
Writing drivers for different versions of Windows
Building a Driver
Building ARM64 Drivers with the WDK
6/25/2019 • 2 minutes to read • Edit Online
Starting with version 1709, Windows 10 Desktop (Pro and S editions) can run on machines that are powered by
ARM64 processors. However, because Windows 10 on ARM does not support x86 emulation of kernel-mode
drivers, you must recompile kernel-mode drivers to ARM64 using the instructions below.
Setup
1. Download Visual Studio 2017 Preview. You'll need at minimum version 15.4.0 Preview 2.0.
2. On the Windows start menu, type Visual Studio Installer . Then on the Workloads tab, select Desktop
development with C++ .
4. From Type or Select new Platform , select ARM64 . Copy settings from Win32 . Click OK and Close .
See Also
Debugging ARM64
Windows 10 on ARM
HLK ARM64 Getting Started Guide
minutes to read • Edit Online
The Enterprise Windows Driver Kit (Enterprise WDK) is a command-line build environment that does not require
any installation prior to use. Once you have downloaded the EWDK, you can manage it with version control
software or you can zip the files and copy as needed. A .zip file created with the Enterprise WDK contains all the
necessary compilers, linkers, build tools, headers and libs to build Visual Studio-based driver projects.
The Enterprise WDK contains the necessary elements to build drivers and basic Win32 driver test applications. Use
your favorite code editor to modify source code and project files. Because it is command-line based, the Enterprise
WDK does lack some of the features incorporated into Visual Studio, such as an IDE, driver deployment and driver
testing.
Getting Started
NOTE
Starting in Windows 10 version 1709, the Enterprise WDK is ISO-based. To get started, download and mount the ISO, then
run LaunchBuildEnv .
See Also
MSBuild Reference
minutes to read • Edit Online
The Windows Driver Kit (WDK) 8.1 provides a feature that enables you to copy components of Visual Studio and the
WDK to a new location and then launch the build environment from the command line. From here you can build
Windows drivers without having to run the Visual Studio or WDK installation programs.
You might find this feature useful if you need to integrate the WDK with your build process, or if you want to
distribute the build process in a lab or test environment.
Note You can only use this feature for building drivers and applications that use C and C++. This feature cannot be
used for managed code or UWP apps.
1. Download the Visual Studio and WDK and SDK setup files
To run the set up script that enables this feature, you need to provide the paths to the Visual Studio and WDK setup
files. Be sure to save these files (rather than install them).
1. Download Visual Studio Professional 2013 or Visual Studio Ultimate 2013. Download the Product Layout (for
example, vs_ultimate_download.exe ). When you are asked if you want to run or save vs_ultimate_download.exe,
click Run and then select the download option and specify the download path as C:\VSSetup (this makes the
later steps easier). Click Download to download and install a local copy of the DVD layout on the computer.
2. Download the standalone SDK. When you are asked if you want to run or save [Link], click Run and then
specify the download location as C:\Kits\SDK . Click Next and follow the instructions to download the
standalone SDK.
3. Download the WDK 8.1. When you are asked if you want to run or save [Link], click Run and then
specify the download location as C:\Kits\WDK . Click Next and follow the instructions to download the WDK. If
you have already installed the WDK on the computer, the web installation program will tell you that the features
installed on the computer are up-to-date. To download the WDK setup files so that you can deploy the build
environment, click Next and specify the C:\Kits\WDK path.
The <VSInstallerFilePath> is the path to the Visual Studio installation program (for example,
Vs_ultimate.exe) and directory that contains the product layout.
The <KitInstallersPath> is the path to the WDK and SDK setup files.
The <Target Directory> is the target directory for the extracted content.
The <LogFilePath> is the target destination for the log file.
<[Link]> is the name of the CatalogFile, which contains a list of Microsoft Windows installation
files (MSI) to expand as part of the installation. The name of the file is [Link].
For example, the following command runs the script from BuildLabSupport directory and installs the build
environment in C:\BuildLabInstall directory.
Related topics
Building a Driver
MSBuild
minutes to read • Edit Online
[This topic applies only to desktop drivers and not universal drivers.]
This topic provides information about distributing the C Runtime Libraries with applications and drivers for
Windows 8 and Windows 8.1. It provides guidelines for user-mode driver and desktop application writers to
compile their code, and package it for redistribution with the necessary C Runtime libraries.
Recommended Strategies
Use the following strategies when redistributing the C/C++ run time components with your drivers and
applications.
For applications installed under Program Files:
Use the Visual C++ Redistributable Package (VCRedist_x86.exe, VCRedist_x64.exe, VCRedist_arm.exe), which
deploys the CRT under System32. In this case, the redistributable package can be updated automatically.
Alternatively, install the DLL(s) to the application local directory (copied directly to the directory where the
application is installed), or link statically to the CRT. In this case, the CRT would need to be serviced manually.
For printer drivers:
These drivers should include the required CRT files in the INF, so the CRT files are copied to the driver store as
part of the driver payload.
V4 print drivers cannot use a co-installer for setup, so the INF must copy relevant binaries of the C/C++ runtime
library to the driver store. To do this, you should reference the appropriate files in the [COPY_FILES] section of
the driver package.
V3 print drivers should not use co-installers for setup, as they are not run during Point and Print connections.
These drivers should reference the appropriate files in the [COPY_FILES] section of the driver package.
The following is an example of how to include the CRT binaries in the [COPY_FILES] section of an INF:
[COPY_FILES]
;CRT
[Link]
; other files
* [SourceDisksFiles]
[Link] = 2
; other files
* [SourceDisksNames.amd64]
1 = %Location%,,,
2 = %Location%,,,"amd64"
[Link] C runtime.
To determine which DLLs you must redistribute with your application, you should collect a list of the DLLs that your
application depends on. One way to collect the list is to run Dependency Walker ([Link]).
When you have the list of dependencies, compare it to the list of files described in Redistributable Code for Visual
Studio 2013 Preview and Visual Studio 2013 SDK Preview. For more information, see Determining Which DLLs to
Redistribute and Choosing a Deployment Method.
You cannot redistribute all of the files that are included in Visual Studio; you are only permitted to redistribute the
files that are specified in Redistributable Code for Visual Studio 2013 Preview and Visual Studio 2013 SDK Preview.
Debug versions of applications and the various Visual C++ dynamic-link libraries are not redistributable.
Related topics
Determining Which DLLs to Redistribute
Redistributable Code for Visual Studio 2013 Preview and Visual Studio 2013 SDK Preview
Choosing a Deployment Method
minutes to read • Edit Online
This information is intended for developers and build engineers who compile kernel-mode drivers for Windows. In
Microsoft Visual Studio Professional 2012, the default architecture for the Visual C++ (VC++) compiler changed
from IA32 to the Streaming SIMD Extensions 2 (SSE2) instruction set. As a result of this change, SSE2 floating point
(FP) instructions injected into the binary at compile time can generate floating-point errors if not accounted for. The
issue can be encountered by those who use the Microsoft VC++ compiler, or a custom build environment to
develop Windows drivers. However, the issue does not affect developers who use the Microsoft Visual Studio
development environment, or who use the MSbuild utility to build drivers with an unmodified toolset.
Solution
To avoid these problem with floating-point calculations, add the /kernel flag to the C++ compiler and linker
command lines to prevent generating SSE2 instructions. The /kernel flag changes the default /arch:sse2 value
back to /arch:ia32 .
In addition, if you build a driver using the WDK and the Visual Studio Professional 2012 development environment,
or use MSBuild, in a Visual Studio Command prompt window, the Microsoft provided platform toolset
(WindowsKernelModeDriver8.0 ) sets the /kernel flag. As a result, floating-point generation errors are avoided.
Recommendations
Here are the recommended solutions based on the type of development environment you use:
Microsoft tool set (MSBuild) - No work required. Use WindowsKernelModeDriver8.0 as the platform
toolset the /kernel is automatically added where appropriate.
Microsoft VC++ Compiler - Add the /kernel flag to prevent compiler from emitting SSE2.
Custom Tooling/Non-Microsoft Compiler - You must manually account for the assembly instructions used
in the resulting binary.
minutes to read • Edit Online
Sets the properties for the CTRPP tool that parses and validates your counters manifest. For information about
working with performance counters, see Performance Counters. For information about using performance
counters in a kernel-mode Windows driver, see Kernel Mode Performance Monitoring.
O P T IO N DESC RIP T IO N
Add Prefix Specifies the prefix to use for the global variables and
functions defined in the generated header file (same as
the -prefix command option.)
Generate header file for containing counter names and Creates a header file that assigns symbols to the counter
GUIDs set names and GUIDs for each counter set in the manifest.
Generate header file for provider Specifies the name of the header file that the tool
generates. If you do not specify a path, the file is
generated in the current folder.
Generate resource file Specifies the name of the resource file that the tool
generates. If you do not specify a path, the file is
generated in the current folder.
Generate Summary Global File Generates a binary counter file per provider. (-summar y
path)
Generates a summary global file [Link].
Generated Counter Files Path Specifies the path to generate binary counter files. (-
sumPath path)
If no path is specified, the current directory is used.
Header File Name For Counter Generates a header file for containing counter names and
ids. (-ch filename)
Header FileName For Provider Generates a header file for the provider. It replaces the
default name. (-o filename)
Resource File Name Specifies the name for the resource file. This replaces the
default name. (-rc filename)
Comment
The default names of the files that the tool generates are based on the name of the manifest file that you pass to
the CTRPP tool.
Related topics
CTRPP
Performance Counters
Kernel Mode Performance Monitoring
minutes to read • Edit Online
Sets the basic properties for a kernel-mode or user-mode driver, including the WDF library version and
preprocessor definitions.
Related topics
Framework Library Versioning
Building and Loading a Framework-based Driver
UMDF Version History
Building UMDF Drivers
Creating Export Drivers
minutes to read • Edit Online
Sets the properties for the Message Compiler ([Link]) tool. The compiler generates the message resource files
that you can add to your project.
For example, if you are using the Event Tracing for Windows (ETW) kernel-mode API to add event tracing to a
kernel-mode driver, you could use the message compiler to create a header file that contains definitions for the
event provider, event attributes, channels, and events. You must include this header file in your source code. The
message compiler creates a resource compiler script (*.rc) that you add to your project file.
O P T IO N DESC RIP T IO N
Ansi Input File Specifies that the input file contains ANSI content (this is
the default). (-a )
Ansi Message In Bin File Specifies that the messages in the output .bin file should
be ANSI. (-A )
Baseline Path The path must point to the folder that contains the .BIN
files that the baseline operation created. (-t directory)
Baseline Resource Path The folder which contains the baseline manifest files. (-s
directory)
Debug Output Path The path in which to place the .dbg C include file. (-x path)
Enable Callout Macro Adds a callout macro to invoke user code at logging. Not
available for C#, and ignored. (-co )
Enable Debug Output Path Enables the compiler to place the .dbg C include file
specified by the Debug Output Path property.
O P T IO N DESC RIP T IO N
File extension for the generated header Specifies the extension of the generated header file. (-e
extension)
Generate C# (managed) logging class Generates a C# (managed) logging class that includes
methods that you would call to log events in your
manifest. (-cs namespace)
Generate header file for containing counter names Use this option to specify the folder into which you want
and GUIDs the compiler to place the generated header file.
Generate Kernel Mode Logging Macros Generates kernel-mode logging macros. (-km )
Generate MOF File Generate down-level support for all functions and macros
generated. MOF file will be generated from the manifest.
MOF file will be placed in the location specified by the -h
option (-mof ).
Generate static C# (managed) logging class Generates a static C# (managed) logging class that
includes methods that you would call to log events in
your manifest. (-css namespace)
Generate User Mode Logging Macros Generate user-mode logging macros. (-um )
Generated Files Base Name Specifies the base name of all generated files. (-z
basename)
Generated RC and Binar y Message Files Path Specifies the path to the generated the RC and binary
message files.
Header File Path Specifies the path the generated header file. (-h path)
Maximum Message Length Use this argument to have the compiler generate a
warning if any message exceeds length characters. (-m
length)
Prefix Macro Name Use this argument to override the default prefix that the
compiler uses for the logging macro names and method
names. (-p prefix)
O P T IO N DESC RIP T IO N
RC File Path The folder into which you want the compiler to place the
generated resource compiler script (.rc file) and the
generated .bin files. (-r path)
Remove Characters From Symbolic Name Use this argument to remove characters from the
beginning of the symbolic name that you specified for the
event. (-P prefix)
Set Customer Bit Sets the Customer bit in the entire message Ids. (-c)
Terminate Message With Null Terminates all strings with nulls in the message tables. (-n )
Unicode Input File Specifies that the input file contains Unicode content. (-u )
The default is ANSI.
Unicode Message In Bin File Specifies that the messages in the output .bin file are
Unicode. (-U )
This is the default.
Use Base Name Of Input Use this argument to have the compiler use the base
name of the input file for the name of the output .bin files.
(-b )
Use Decimal Values Use this argument to use decimal values for the Severity
and Facility constants in the header file instead of
hexadecimal values. (-d )
Validate Against Baseline Resource Use this argument when you create a new version of your
manifest and want to check it for application compatibility
against the baseline that you created using the -s option.
Related topics
Message Compiler ([Link])
WDK and Visual Studio build environment Message compiler task
Event Tracing for Windows (ETW)
minutes to read • Edit Online
The Managed Object Format (MOF) compiler ([Link]) parses MOF files and adds the classes and class
instances defined in the files to the WMI repository. Use the Mofcomp property page to compile MOF files with
your driver. For more information about [Link] and WMI, see mofcomp , Compiling MOF Files, and
Compiling a Driver's MOF File.
O P T IO N DESC RIP T IO N
Auto Recover Adds the named MOF file to the list of files compiled
during repository recovery. (-autorecover )
Create Binar y Mof File Requests that the compiler create a binary version of the
MOF file with the name filename without making any
modifications to the WMI repository. (-B: Filename)
Language Neutral Output Name of the language neutral output. (-MOF: Path)
Language Specific Output Name of the language specific output. (-MFL: Path)
O P T IO N DESC RIP T IO N
NamespacePath Requests that the compiler load the MOF file into the
namespace specified as namespacepath. (-
N: namespacepath)
Resource Locale Extracts the localized MOF descriptions from the binary
MOF when used with -ER switch. (-L: ResourceLocale)
Syntax Check Requests that the compiler perform a syntax check only
and print appropriate error messages. No other option
can be used with the Syntax Check option.
WMI Syntax Check Requests that the compiler perform a WMI syntax check -
WMI . If you select this option, you must also select the
Create Binar y Mof File option (-B: Filename)
Related topics
Compiling MOF Files
Compiling a Driver's MOF File
mofcomp
minutes to read • Edit Online
Sets the properties for the Stampinf tool. You can use Stampinf to update common INF and INX file directives when
you build the driver.
Enable VersionStamp Enables the version time stamp. If enabled, the Driver
Version Number must not be empty. The Driver
Version Number specifies the time that is written in the
INF DriverVer directive for the version number. If not
enabled, see the description of the default behavior for
this option under Driver Version Number .
STA M P IN F O P T IO N DESC RIP T IO N
Driver Version Number Specifies the time that is written in the INF DriverVer
directive for the version number. The format for the time
is [Link] (for example,
[Link]). This option is useful during development
because it provides a convenient way to increase the
version number of the driver. This setting is equivalent to
specifying the Stampinf option -v [ time | ] .
To use the current time, specify an asterisk () with this
parameter.
Default behavior:
If the Driver Version Number is not specified, or if
Enable VersionStamp is No or unspecified, Stampinf
uses one of the following version number values:
If the STAMPINF_VERSION environment variable is
set, Stampinf uses the version number value that is
specified by this environment variable.
If the STAMPINF_VERSION environment variable is
not specified, Stampinf extracts the version number
from the ntverp.h file.
Enable DateStamp Enables the date stamp. If enabled, the Driver Version
Directive Date must not be empty. If not enabled, see
the description of the default behavior for this option
under Driver Version Directive Date .
STA M P IN F O P T IO N DESC RIP T IO N
Driver Version Directive Date Specifies the date that is written in the INF DriverVer
directive . The format for the date is month/date/year (for
example, 10/20/2011 ).
To use the current date, specify an asterisk () with this
parameter.
Default behavior:
If the Driver Version Directive Date parameter is not
specified, or if Enable DateStamp is No or unspecified,
Stampinf uses one of the following date values:
If the STAMPINF_DATE environment variable is set,
Stampinf uses the date value that is specified by
this environment variable.
If the STAMPINF_DATE environment variable is not
specified, Stampinf uses the current date.
This setting is equivalent to specifying the Stampinf option
-d [ date|] .
Driver Version Directive Section Specifies the INF section in which to put the INF
DriverVer directive . The default location for this
directive is the INF Version section .
This setting is equivalent to specifying the Stampinf option
-s section.
KMDF Version Number Specifies the version of KMDF that this driver depends on.
This is used to customize the KmdfLibraryVersion and
KMDF co-installer name in the INF file. This option
replaces the $KMDFVERSION$ and
$KMDFCOINSTALLERVERSION$ keywords in the INF file.
The string has the following format:
<major_version>.<minor_version>
For example, if you specify 1.5 as the version string, the
values 1.5 and 01005 are used for the two keywords
(respectively).
This setting is equivalent to specifying the Stampinf option
-k KMDFversion.
STA M P IN F O P T IO N DESC RIP T IO N
UMDF Version Number Specifies the version of UMDF that this driver depends on.
This option is used to specify the UmdfLibraryVersion and
UMDF co-installer name in the INF file. The version that is
specified replaces the $UMDFVERSION$ and
$UMDFCOINSTALLERVERSION$ keywords in the INF file.
The version string has the following format:
<major_version>.<minor_version>.<service_version>
(where <service_version> is typically zero).
For example, if you specify 1.5.0 as the version string, the
values 1.5.0 and 01005 are used for the major and minor
keywords (respectively).
This setting is equivalent to specifying the Stampinf option
-u UMDFversion.
Catalog File Name Specifies the value that is written in the CatalogFile
directive in the INF Version section . By default, the
CatalogFile directive is not written.
This setting is equivalent to specifying the Stampinf option
-c catalogfile.
Version Header Path Specifies the location of Ntverp.h file. The path represent
the fully qualified location of the directory containing
Ntverp.h.
This setting is equivalent to specifying the Stampinf option
-i path.
Related topics
Stampinf
INF DriverVer directive
INF Version section
WDK and Visual Studio build environment
Stampinf task
How to: Use Environment Variables in a Build
minutes to read • Edit Online
This topic describes how to convert a driver project that was created using Microsoft Visual Studio 2013 and
Windows Driver Kit (WDK) 8.1 to a driver project that builds in Microsoft Visual Studio 2015 with the Windows
Driver Kit (WDK) 10.
Visual Studio 2015 has new compiler warnings and errors. Even if your driver project built with no errors in Visual
Studio 2013, you might see errors when you build it in Visual Studio 2015.
Use these steps to convert the projects in a driver solution.
1. In Visual Studio 2015, open the legacy driver solution.
Visual Studio automatically runs ProjectUpgradeTool to convert the projects in this solution. You can also run
this tool from the command line. By default, when you install the WDK, [Link] installs in
Windows Kits\10\bin\x86.
Visual Studio opens a Review Solution Actions dialog with the title Upgrade VC++ Compiler and
Libraries . Click OK and Visual Studio attempts to upgrade all projects in the solution.
If you see a File Modification Detected dialog, choose Reload All .
2. In the Solution Explorer pane, right-click the driver project name and choose Proper ties . Click the
Configuration Manager button. In the Active solution configuration list, choose <New...> . Type a
name and copy the settings from a Windows 8.1 project context. Click OK .
Typically, the converted solution contains two configuration profiles, one for debug (testing) and one for
release. To create a similar environment with WDK 10, simply choose <New...> twice. To create a debug
profile, copy from the Win 8.1 Debug profile. To create a release profile, copy from the Win 8.1 Release
profile.
3. In WDK versions prior to WDK 10, your driver solution always needed a package project. In WDK 10, you
only need a package project if you are including multiple drivers in a driver package. Use the following
guidelines:
If you have only one driver in the solution and a package project exists, delete it.
If you have more than one driver in the solution, ensure that your solution contains a package project.
Then, for each driver project in the solution, open project properties and navigate to Configuration
Proper ties > Driver Settings . Set BuildPackage to No . If you are building from the command
line, set /p:Suppor tsPackaging=false .
4. Again in driver project properties, choose Proper ties . Navigate to Configuration Proper ties > Driver
Settings > General > Target OS Version . Select Windows 10.
Verify that Target Platform is set to Desktop , and build the solution. Fix any errors that occur.
5. Once the solution builds successfully, change Target Platform to Universal .
Build the solution again. At this point, the only errors are from the ApiValidator tool, which checks if the
driver calls any non-universal functionality. Replace any calls to non-universal DDIs with calls to universal
DDIs.
For more information about ApiValidator, see Validating Universal Windows drivers.
To learn how to determine the target platform for a given DDI, see Target platform on driver reference pages.
minutes to read • Edit Online
Code analysis and verification tools can help improve the stability and reliability of your driver by systematically
analyzing the source code. The code analysis and verification tools can detect errors that are missed by the
compiler and by conventional runtime testing. Additionally they can determine whether the driver correctly
interacts with the Windows operating system kernel. Using Microsoft Visual Studio and the Windows Driver Kit
(WDK), you can configure the code analysis and verification tools to run as part of the build process, or you can
schedule the tools to analyze your driver at a predetermined time.
You can deploy a driver automatically or manually. In either case, you need to prepare the target computer first.
Here we describe how to prepare the target computer if you choose to deploy your driver manually.
Typically the computer where you install and test a driver is separate from the computer where you develop and
build the driver package. The computer where you build the driver is called the host computer, and the computer
where you install and test the driver is called the target computer or the test computer. The process of moving the
driver package to the target computer and installing the driver it is called deploying the driver.
1. On the target computer, open a Command Prompt window as Administrator. Enter bcdedit /set
TESTSIGNING ON . Reboot the target computer.
2. Copy the DevCon tool to a folder on the target computer (for example, c:\Tools). The DevCon tool is included in
the Windows Driver Kit (WDK). You can find it under the Tools directory (for example, C:\Program Files
(x86)\Windows Kits\10\Tools\x64\[Link]).
3. Create or get a certificate (.cer) file that you can install on the target computer. For example, when you build one
of the WDK sample drivers, the build process creates a certificate (.cer) file. The location of the certificate file
varies depending on what you have specified for configuration and platform. For example, if your configuration
is Win7 Debug and your platform is x64, then the certificate file is in your solution folder under
C++\x64\Win7Debug.
4. Copy the certificate file to a folder on your target computer (for example c:\Certificates).
5. On the target computer, right click the certificate file, and choose Install . Work through the installation wizard.
When you build one of the WDK driver samples, the build process creates a test-signing certificate. You need to
install a test-signing certificate only once. If you have installed a certificate from a WDK driver sample, you can
install other driver samples without installing a certificate again.
minutes to read • Edit Online
Using Microsoft Visual Studio to configure and set up driver deployment and driver testing is called provisioning a
target computer or provisioning a test computer. For information about provisioning, see Provision a computer for
driver deployment and testing (WDK 8.1). Here we show what happens when you use version 8.1 of the Windows
Driver Kit (WDK) to provision a target computer.
Using Microsoft Visual Studio to configure and set up driver deployment and driver testing is called provisioning a
target computer or provisioning a test computer. For information about provisioning with Windows Driver Kit
(WDK) 8 , see Provision a computer for driver deployment and testing (WDK 8). Here we show what happens when
you use version 8.0 of the Windows Driver Kit (WDK) to provision a target computer.
Note WDK 8 is not the most current version of the WDK. We recommend that you get the current version of the
WDK and provision your target computer according to the provisioning instructions here.
Provisioning a target computer is described in Provision a computer for driver deployment and testing (WDK 8.1).
Here we give some troubleshooting tips for the provisioning process.
General tips
Configure Computers menu command is inactive
Provisioning fails
Provisioning fails
The network path was not found
The network name cannot be found
Could not access remote machine
Note The messages that are displayed when you enter an incorrect target computer name can vary. For example,
you might see a message about enabling network discovery.
sxe ld <DriverName>
Note
If you use a driver template to create a driver solution, then the template should automatically create a solution
that contains two projects. One for the driver, and another for the driver package.
You can create a Device Metadata Package for your device directly in Visual Studio. The Device Metadata Authoring
Wizard, located in the Driver menu, allows you to author specific information that appears to end users in
Windows, including the icon and name for your device. It also allows you to associate a UWP device app to your
device, which gets installed automatically when a user first connects the device.
For more information about how to use the Device Metadata Authoring Wizard, please see Device Metadata
Authoring Wizard.
minutes to read • Edit Online
All drivers running on 64-bit versions of Windows must be signed before Windows will load them. However,
driver signing is not required on 32-bit versions of Windows.
In order to sign a driver, a certificate is required. You can create your own certificate to sign your driver with
during development and testing. However, for a public release you must sign your driver with a certificate issued
by a trusted root authority.
Note A driver package project can package the output of other projects. If you build a driver package project,
Microsoft Visual Studio will build the other projects on which it has dependencies. The driver package project has
its own driver signing properties that are separate from any other dependent projects, and its driver signing
properties apply only to the catalog (if any) produced by the driver package project. That is, the driver package
project will not automatically add an embedded signature to driver binaries produced by other projects, as a
different certificate may be used to sign the other driver projects, for example, a test certificate, and the result in
such a case would be a driver package where the binaries are unintentionally signed with one certificate, while the
package catalog is signed with a different certificate. This can result in performance degradation. For example, if a
boot start driver binary's embedded signature is invalid, Windows cannot use certificate it was signed with to
validate the binary. Instead, Windows must validate the binary against the catalog's signature, which would
increase boot time.
This section describes how to use Visual Studio to sign a driver package.
Signing a Driver During Development and Testing
Signing a Driver for Public Release
2 minutes to read
minutes to read • Edit Online
Before you install a driver on a computer running a 64-bit version of Windows, you must sign the driver package.
For testing purposes, you can test sign the driver package, which is a more relaxed form of signing than signing for
public release.
In Microsoft Visual Studio, test signing is enabled by default. Suppose you have created a KMDF driver solution as
described in Writing a KMDF driver based on a template. When you build the solution, you can see in the Output
window that the driver package has been test signed.
Related topics
Writing Your First Driver
Building a Driver
Developing, Testing, and Deploying Drivers
minutes to read • Edit Online
Before you release a driver package to the public, we recommend that you submit the package for certification. For
more information, see Windows Hardware Certification and Hardware Dashboard Services. To submit a driver
package for certification, you must sign the package with a certificate that you obtain from a trusted certification
authority like VeriSign. For more information, see Get a VeriSign Certificate. You will also need a cross certificate,
which is provided by Microsoft.
Suppose you have obtained a pair of files from Verisign: a private key file (PVK) and a software publishing
certificate (SPC). Also suppose you have a Microsoft Visual Studio solution that contains a driver project named
MyDriver and a driver package project named MyDriver Package. To sign your driver package, follow these steps.
1. Use the Pvk2Pfx tool to create a Personal Information Exchange (PFX) certificate. The Pvk2Pfx tool takes
your PVK and SPC files as input and creates a single PFX file. For this exercise, assume that your PFX file is
named [Link].
Note Once you have created your PFX file, you can reuse it for other driver projects and on other driver
development computers.
2. To determine which cross certificate you need, see Cross-Certificates for Kernel Mode Code Signing. Verify
that the required cross certificate is in $(BASEDIR)\CrossCertificates, where $(BASEDIR) is the base directory
of the Windows kits (for example c:\Program Files (x86)\Windows Kits\8.0\CrossCertificates). If the required
cross certificate is not there, download the cross certificate from Microsoft, and copy it to
$(BASEDIR)\CrossCertificates.
3. In Visual Studio, open the solution that contains the MyDriver and MyDriver Package projects. If the Solution
Explorer window is not already open, choose Solution Explorer from the View menu. In the Solution
Explorer window, right-click the package project, MyDriver Package , and choose Proper ties .
4. In the property pages for the package, navigate to Configuration Proper ties > Driver Signing >
General . In the Sign Mode drop-down list, select Production Sign . For Production Cer tificate , do one
of the following:
Enter the path to your signing certificate (for example c:\Certs\[Link]).
Choose Select From File , and browse to your signing certificate.
Choose Select From Store and choose a certificate that you previously imported into a certificate
store.
Note To import a certificate into a store, right-click the certificate file (PFX file), and choose Install
PFX . Follow the instructions in the Certificate Import Wizard.
Note If you decide to use a different certificate at a later time, be sure that your new certificate gets
imported into the certificate store. If you choose Select From File and browse to your new
certificate, the new certificate will be automatically imported into the certificate store. However, if you
manually enter the path to your new certificate, it will not be automatically imported into the
certificate store. In that case, you must right-click your new certificate file and choose Install PFX .
5. On the Driver Signing > General property page, for TimeStampSer ver , select one of the time stamp
servers in the drop-down list.
Note Using one of the time stamp servers in the drop-down list requires that you be connected to the
Internet when you build your driver package. If you need to be disconnected from the Internet when you
build your driver package, clear the TimeStampSer ver field.
6. In the property pages for the package, navigate to Configuration Proper ties > Inf2Cat > General . In
the Run Inf2Cat drop-down list, select Yes .
7. Close the property pages for the package.
8. Right-click the driver project, MyDriver , and choose Proper ties
9. In the property pages for the driver, navigate to Configuration Proper ties > Driver Signing > General .
Set TimeStampSer ver to the same value that you used in the driver package properties. Set Sign Mode
to Production Sign , and set Production Cer tificate to the same value that you used in the driver
package properties.
10. When you are ready to build your driver package, press F5 . Visual Studio will automatically sign your
package and your driver file. If you have configured deployment, Visual Studio will also deploy your signed
driver package to a test computer. For more information, see Provision a computer for driver deployment
and testing (WDK 8.1).
Related topics
Driver Signing changes in Windows 10
Availability of SHA-2 Code Signing Support for Windows 7 and Windows Server 2008 R2
Signing a Driver
Windows Hardware Certification
Hardware Dashboard Services
Driver Signing Requirements for Windows
Cross-Certificates for Kernel Mode Code Signing
Kernel-Mode Code Signing Walkthrough
Driver Signing
Installing a Boot-Start Driver
Tools for Signing Drivers
minutes to read • Edit Online
When a project is selected in Solution Explorer, the Proper ties dialog under the Driver Signing node, displays
two sections of properties:
Under General:
Sign Mode
Test Sign - Microsoft Visual Studio should sign the driver with the test certificate specified in Test Cer tificate
(default). If no certificate is specified in Test Cer tificate then Visual Studio will create one for the driver. Note :
Windows requires all 64-bit drivers to be signed.
Production Sign - Visual Studio should sign the driver with the production certificate specified in Production
Cer tificate .
Off - Visual Studio should not sign the driver with any certificate.
Test Cer tificate
Blank - No test certificate is selected (default).
<Edit...> - Selects the certificate to use when Sign Mode is set to Test Sign .
Production Cer tificate
Blank - No production certificate is selected (default).
<Edit...> - Selects the certificate to use when Sign Mode is set to Production Sign .
TimeStampSer ver
Verisign - Use Verisign to time stamp the driver (default).
GlobalSign - Use Globalsign to time stamp the driver.
None - Do not time stamp the driver.
Disable Warnings
No - Display warnings when signing the driver (default).
Yes - Do not display warnings when signing the driver.
Enable Diagnostic Verbosity
No - Do not display diagnostic verbosity when signing the driver (default).
Yes - Display diagnostic verbosity when signing the driver.
File Digest Algorithm
Blank - No file digest algorithm is selected (default).
<Edit...> - Select the file digest algorithm to use when signing the driver.
Taking advantage of the Visual Studio development environment, the WDK provides a test feature that enables
you to build, deploy, and debug a driver on a test computer. To successfully deploy a driver to a test system using
the WDK, you must first set up and configure a test computer. You can set up and configure multiple computers if
you want to test your driver under different testing scenarios.
You can configure the automatic deployment of a driver package on a remote test computer in each configuration
of your project. From the project property pages for your driver, you have additional control over how you want to
deploy your driver for testing. You can choose to deploy the driver automatically whenever you build the driver
solution in each configuration. For more information about deployment, see Provision a computer for driver
deployment and testing (WDK 8.1) and Deploying a Driver to a Test Computer.
Enabling deployment
You can choose to deploy your driver package on a test computer by selecting Enable deployment . In
combination with the configuration list, you could choose to disable deployment for debug builds and enable it for
release builds.
To ensure that you are testing the latest version of the driver, select Remove previous driver versions before
deployment .
Additional Files
You can use the Additional Files box to specify custom installation scripts or applications that you want to copy
to the remote test computer. The files that you specify here are added to the %Systemdrive%\drivertest\drivers
folder on the remote computer.
Related topics
Deploying a Driver to a Test Computer
How to test a driver at runtime using Visual Studio
Getting Started with Windows Debugging
minutes to read • Edit Online
Driver Verifier is a run-time verification tool that increases the effectiveness of your driver testing. You can enable
and configure Driver Verifier to run on all test computers when you deploy your driver for testing.
You should always set up a kernel mode debugging connection with the test computer when you enable Driver
Verifier on the remote test computer. For information about configuring a target computer and setting up a debug
cable, see Getting Started with Windows Debugging.
Verify Drivers
Specifies which driver or drivers to verify on the test computer.
All Drivers
Specifies that Driver Verifier verifies all installed drivers on the remote test computer.
Project Output
Specifies that Driver Verifier verifies the driver project installed on the remote test computer. This is the default
option.
Driver List
Specifies the driver or list of drivers that Driver Verifier verifies on the remote test computer. For example, you
could list all of the drivers associated with a particular device. Specify the drivers by binary name, for example,
[Link]. Use a semicolon to separate a list of drivers. Wildcard values, such as n*.sys, are not supported.
Related topics
Driver Verifier
How to test a driver at runtime using Visual Studio
Deploying a Driver to a Test Computer
Getting Started with Windows Debugging
minutes to read • Edit Online
Sets the properties for the KMDF Verifier (or framework verifier) on a remote computer. You can use these settings
when you build and deploy a KMDF driver to a test computer. For information about KMDF drivers, see Kernel-
Mode Driver Framework.
For more information about the framework verifier, see Using the Framework's Verifier and WDF Verifier Control
Application.
O P T IO N DESC RIP T IO N
Enable KMDF Verifier Enables the KMDF verifier on the test computer. The
choices are KMDF verifier is always on or KMDF
verifer is off . If the KMDF verifier is not enabled, basic
framework verification is enabled as part of Driver Verifier
if KMDF version is 1.9 or higher.
KMDF Ser vice Names Specifies the service names of the KDMF drivers to
monitor.
IRQL checks Enables IRQL checks and critical memory leak checks.
For ward Compatible Checks Enables checks created after the current driver version.
For ward Progress Handler Testing Specifies options for testing forward progress handling of
your driver.
No Allocation Failures No faults will be simulated to
test the forward progress handling of your driver.
Fail All Allocations All I/O requests destined for a
forward progress queue will appear to fail, relying on your
driver's forward progress handling.
Randomly Fail Allocations Randomly fail I/O requests
destined for a forward progress queue.
Track KMDF Object Handles Specifies the list of object handle types to track.
O P T IO N DESC RIP T IO N
Enable KMDF Loader Messages Enables KMDF loader messages through the debugger. A
reboot of the target computer is required to enable this.
Starting with Windows Vista, the operating system
suppresses DbgPrint output by default, which makes the
WDF Loader diagnostic messages unusable until the
suppression is overridden. KDMF Verifier can manage this
for you so that KMDF loader diagnostics are available in
the kernel debugger for these systems.
Memor y Pages for Logs Specifies the number of non-paged pool pages (1-10) to
allocate for kernel event trace logs. The options are
Runtime Choice or [1 -10 ]. If Runtime Choice , the
number of pages depends on the KMDF runtime. Starting
with KMDF 1.9, the runtime uses more pages when
verification is enabled with verbose logging.
Related topics
Kernel-Mode Driver Framework
Driver Verifier
Deploying a Driver to a Test Computer
minutes to read • Edit Online
Sets the properties for the UMDF Verifier on a test computer. You can use these settings when you build and
deploy a driver to a test computer.
For information about deployment, see Provision a computer for driver deployment and testing (WDK 8.1) and
Deploying a Driver to a Test Computer
For information about debugging UMDF drivers, see How to Enable Debugging of a UMDF Driver and WDF
Verifier Control Application.
O P T IO N DESC RIP T IO N
Deploy UMDF Verifier Enables the UMDF verifier settings on the test computer.
UMDF Ser vice Names Specifies the service names of the UMDF drivers to
monitor.
Maximum Restar t Attempts Maximum number of times UMDF will restart a failed host
process.
UMDF Logging level Specifies the amount of information logged by the UMDF
verifier for the drivers it is hosting.
Only Critical and Fatal Errors - Logs only critical and
fatal errors.
All Errors - Logs all errors.
Warnings and all Errors - Logs warnings and all errors.
Informational events, Warnings and all Errors -
Logs informational events, warnings, and all errors.
Verbose Output (All Events of any Sor t) - Logs all
events.
O P T IO N DESC RIP T IO N
Break into Kernel Debugger Break into kernel debugger when the UMDF host process
fails.
Timeout on Driver Load (sec) Specifies the time to wait (in seconds) before attaching the
debugger after the driver loads.
Timeout on Driver Star t (sec) Specifies the time to wait (in seconds) before attaching the
debugger after the driver starts.
Verify at Current Level Verifies drivers built using earlier versions of the
framework against current framework versions rules.
Related topics
User-Mode Driver Framework
Driver Verifier
Deploying a Driver to a Test Computer
minutes to read • Edit Online
Sets the properties for the Inf2Cat tool. The Inf2Cat tool can be used to create catalog files for any driver package
that has an INF file.
O P T IO N DESC RIP T IO N
Run Inf2Cat Runs the Inf2Cat tool on any INF files in the project (for
example, .inf, .inx, or .inv files).
Windows Version List Specifies a list of Windows versions supported by the .inf
file. Separate each Windows version with a comma. The
default setting is $(Inf2CatWindowsVersionList), a macro
that builds the driver for the active platform and
configuration.
This setting is equivalent to specifying the Inf2Cat option
/os: WindowsVersionList.
Include Page Hashes Include page hashes with files. Optionally followed by a list
of files.
This setting is equivalent to specifying the Inf2Cat option
/pageHashes[: file1][, file2]...] .
Use Local Time Use the local time zone while verifying the INF DriverVer
Directive directive. By default UTC, is used.
This setting is equivalent to specifying the Inf2Cat option
/uselocaltime .
For more information about the Inf2Cat tool, see Using Inf2Cat to Create a Catalog File.
For information about property pages and projects, see the WDK and Visual Studio build environment.
Related topics
Creating a Catalog File for a PnP Driver Package
Inf2Cat
Creating a Driver Package
Signing a Driver
Using Inf2Cat to Create a Catalog File
WDK and Visual Studio build environment
minutes to read • Edit Online
If your deployment scenario requires more than installing the driver package on the test computers, you can
choose to run your own custom command scripts upon installation.
Prerequisites
Driver package that is test signed and ready to install. You must first create and build your driver and then create
a driver package for installation. For more information, see Building a Driver and Creating a Driver Package.
Test computers that are configured and provisioned for deployment. See How to test a driver at runtime using
Visual Studio.
Instructions
Step 1: To run your own custom command scripts upon installation
From the project property pages for your driver package, you can configure whether you want to automatically
deploy a driver package on a test computer. You can also run a custom installation script from these pages. You can
choose to deploy the driver automatically whenever you build the driver solution in each configuration. For more
information about deployment, see Deploying a Driver to a Test Computer and Deployment Properties for Driver
Projects.
1. Open the property pages for your driver package project. Right-click the driver project in Solution Explorer
and select Proper ties .
2. In the property pages for the driver package, click Configuration Proper ties , click Driver Settings , and
then click Deployment .
3. Click Enable deployment and then select the test computer to use.
4. Click Custom Command Line . In the box, type custom command scripts that you want to run upon
installation.
5. In the Additional Files text box, add the command script and other installation files to be copied to the test
computer. When the driver is deployed, the additional files are copied to the
%Systemdrive%\drivertest\drivers folder on the remote computer.
Related topics
Deploying a Driver to a Test Computer
Deployment Properties for Driver Projects
How to test a driver at runtime using Visual Studio
Building a Driver
Creating a Driver Package
minutes to read • Edit Online
To install a driver on Windows 10 Mobile, use an .spkg file. An .spkg ("package file") is a standalone module that
contains your driver package.
WDK 10 includes PkgGen, a tool that generates package files. You run PkgGen in Visual Studio when you build your
driver, using the following procedure.
Using PkgGen to generate a package file
1. Right-click the driver project and choose Add->New Item . Next, under Visual C++->Windows Driver ,
choose Package Manifest . Click Add .
2. Visual Studio adds a file called [Link] to your driver project. You can right-click the file and choose
properties to verify that the item type is PkgGen . (On this same property page, you can set Excluded from
Build to Yes if you decide later that you want to build this driver project and not generate a package file.) Click
OK .
3. Right-click the driver project and choose Proper ties . Under Configuration Properties, open the PackageGen
node and change Version to any value you like.
4. Save your work and restart Visual Studio as administrator.
5. Build your driver. Visual Studio links against the required libraries and generates a .cat file, an .inf file, a driver
binary, and an .spkg file.
To view the contents of the package file, append a .cab suffix to the file name and then open the cab file in Windows
Explorer.
To learn about running PkgGen outside of Visual Studio, see Creating mobile packages.
To install a mobile driver package (.spkg file), you have two options.
If you are updating an existing package on a target system or adding a new package to the target, use [Link]
to install an .spkg driver package.
If you are combining packages into a mobile OS image, use ImgGen to add the .spkg driver package to a full
flash update (FFU) image that can then be flashed to a mobile device.
Using IUTool to add a mobile driver package (.spkg) to a running device
1. [Link] is in the \tools\bin\<architecture> subdirectory of WDK 10.
Attach your mobile device to the PC. Then, from an elevated command prompt, issue the following
command:
IUTool -p [Link]
Debugging a kernel-mode driver requires two computers. The debugger runs on the host computer, and the code
being debugged runs on the target computer. The target computer is also called the test computer. You can debug a
user-mode driver on the host computer or on a separate target computer. Before you can debug a driver running
on a target computer, you must configure the target computer for debugging.
For general information about debugging drivers, see Getting Started with Windows Debugging.
For information about configuring a target computer and setting up a debug cable using a network connection, see
Setting Up KDNET Network Kernel Debugging Automatically.
See Also
Windows Debugging.
minutes to read • Edit Online
The WDK adds a driver testing interface to Visual Studio that allows you to build, deploy, install, and test a driver on
a remote test computer on your network. The WDK also provides a collection of device driver tests that you can use
to test features and functions of your driver. You can also write customize or write your own driver tests using the
Driver Test Template in Visual Studio.
Video Demonstration
This video demonstrates the how to run driver-related tests in a test group.
[Link]
This section describes some strategies for testing driver, and information about how you select and configure a
remote computer to use for testing.
To prepare a driver for public distribution, you should run the Windows Hardware Certification Kit (HCK). For
information about the Windows Certification program and how to obtain the HCK, see Windows Hardware
Certification Program.
The WDK provides the test binaries and tools which make it easy to run the Device Fundamentals tests from the
command-line. For more information, see Run the DevFund Tests via the command-line.
TO P IC DESC RIP T IO N
Tips for testing drivers during development When should you star t testing? As soon as you have
the requirements for your driver, you can begin to design
test cases to test that the critical requirements have been
implemented. Studies show that finding and fixing defects
in code becomes more expensive the longer the defects
remain in the code. Finding and fixing defects early in the
development cycle is less costly and disruptive than
finding defects after the code has been released and
distributed. Creating your test cases early can also help
you find problems in your design.
How to test a driver at runtime using Visual Studio The WDK extensions to Visual Studio provide a device
testing interface that enables you to conveniently build,
deploy, install, and test a driver on a test computer on
your network. The WDK provides a collection of device
driver tests that you can use to test the features and
functions of your driver.
How to write a driver test using a Driver Test template You can use the Windows Driver Kit (WDK) for Windows 8
to create your own driver tests or to customize some of
the tests that are provided. You can deploy the tests that
you create to remote test computers using the driver
testing framework that the WDK provides for Microsoft
Visual Studio Ultimate 2012.
See Also
Tools for Verifying Drivers
minutes to read • Edit Online
When should you star t testing? As soon as you have the requirements for your driver, you can begin to design
test cases to test that the critical requirements have been implemented. Studies show that finding and fixing defects
in code becomes more expensive the longer the defects remain in the code. Finding and fixing defects early in the
development cycle is less costly and disruptive than finding defects after the code has been released and
distributed. Creating your test cases early can also help you find problems in your design.
The WDK extensions to Visual Studio provide a device testing interface that enables you to conveniently build,
deploy, install, and test a driver on a test computer on your network. The WDK provides a collection of device
driver tests that you can use to test the features and functions of your driver.
Prerequisites
A Driver Package that is ready to install. You must first create and build your driver and then create a Driver
Package for installation. For more information, see Building a Driver and Creating a Driver Package.
The driver must be test signed. For more information, see Signing a Driver.
A test computer (or computers). The test computer must be on the same network as the computer that you
are using for development. Both computers must be connected to the same domain, or both connected to the
network under the same workgroup. The test computer should be running the version of Windows that you
want to target for testing.
A device to be tested.
(Recommended) Set up a kernel mode debugging connection to the test computer. To use a network
connection for kernel mode debugging, the target computer must be running Windows 8. On computers
running Windows 7 or Windows Vista, you can set up a USB, 1394, or a serial connection for kernel mode
debugging. For more information, see Provision a computer for driver deployment and testing (WDK 8.1).
Instructions
Step 1: Configure computers for testing
From Visual Studio, you can configure and provision computers for testing. When you configure the test
computers, the WDK driver test framework automatically enables the test computer for remote debugging and
transfers the necessary test binaries and support files.
1. If you have not already done so, follow the instructions to Provision a computer for driver deployment and
testing (WDK 8.1).
2. Connect the device that you want to test to the test computer or computers.
After you have configured and provisioned a test computer, you can use Visual Studio to deploy drivers, schedule
tests, and debug drivers on the test computer. For information about deployment and about how you can deploy
a driver automatically at build time, see Deploying a Driver to a Test Computer.
You can also enable and set options for Driver Verifier, the runtime verification tool for drivers. Driver Verifier
monitors your driver as you run tests on the test computer. For information about setting the Driver Verifier
options for deployment, see Driver Verifier Properties for Driver Projects.
You can also run tests outside of Visual Studio, for more information see How to test a driver at runtime from a
Command Prompt. Starting in WDK 8.1, you can copy and run the HCK Test Suites on test computers using
command scripts. See How to run the HCK Test Suites in WDK 8.1.
Step 2: Select an HCK Test Suite to run on the test computer (using WDK 8.1)
Starting with WDK 8.1, you can select HCK Test Suites to run on the test computer. The HCK Test Suites include the
Device Fundamentals Tests, and Windows Hardware Certification kit (HCK) Basic tests for graphics, imaging,
wireless LAN, mobile broadband (CDMA and GSM), and WiFi Direct devices.
See How to run the HCK Test Suites in WDK 8.1.
Step 3: Select the tests to run on the test computer (WDK 8 and WDK 8.1)
To make driver testing on different test targets easier, tests are scheduled to run against test systems in units
called test groups. A driver test group is a collection of tests that you select to run on the test computer. The
driver test groups help you organize your tests and test results from each test pass. You can save your test results
to separate folders. You can create and manage test groups, change parameters passed to the tests in the test
groups, and schedule them to run against your test systems.
1. From the Driver menu, click Test and then select Test Group Explorer .
2. In the Driver Test Group Explorer window, click the Create a new test group button. Or, click New
Test Group from the Driver menu.
3. In the Driver Test Group window for the group that you created, type a name in Test Group Name text
box to identify the group. The default name is Driver Test Group_nnnnn, where nnnnn represents the
number of the test group
4. Click Add/Remove Tests .
5. In the Add or Remove Driver Tests dialog box, you can specify the driver test category and architecture
(All, x86, x64, ARM). By default all tests are shown. To view the test categories, click the folders in the Driver
Test Categories drop-down list.
For example, in WDK 8, to select all of the Device Fundamentals tests that are used in the Windows
Hardware Certification Kit (HCK), click All Tests , Cer tification , and Device Fundamentals . For
information about the tests, see How to select and configure the Device Fundamentals Tests.
In WDK 8.1, the Device Fundamentals tests are under All Tests , HCK Tests , Cer tification , and Device
Fundamentals folder. In WDK 8.1 the Driver Test Categories include the HCK (Basic) Tests. See How to run
the HCK Test Suites in WDK 8.1 for more information.
6. Be sure that you select the tests that match the architecture of the intended test computer (x86, x64, ARM).
Use the Architecture Filter to show only those tests that will run on your test computer.
7. Click >> to add the selected tests.
Step 4: Configure test parameters
After you select the tests for your test group, you can configure any of the runtime parameters that are passed to
the driver tests. For example, many of the Device Fundamentals Tests have a parameter DQ, which stands for
Device Query. This is a Simple Data Evaluation Language (SDEL) query. The Windows Driver Test Framework
provides SDEL as a query language to simplify the task of collecting targets based on attributes or relationships.
For example, to run the tests for USB devices only, use the device query: class='usb'. You can change the value of
each test parameter in the test group.
1. You can view and edit the all of the runtime test parameters for a test by clicking on the name of the test in
the Driver Test Group window. The Driver Test Group window provides a description of the selected
test and also provides a description of the test parameters that you select. For information about setting
the test parameters, see How to select and configure the Device Fundamentals Tests
2. After you select the tests, set the parameters, and name the group, click Save .
When you save the test group, the test group will become the currently selected test group, and the name
of the test group will appear in the Driver Test toolbar. You can now run tests against the currently selected
remote test computer (also shown in the Driver Test toolbar).
Step 5: Build and deploy the driver
From the Build menu, click Deploy Solution .
For information about deploying a driver automatically at build time, see Deploying a Driver to a Test Computer.
For information about automatically setting the Driver Verifier options on the test computer, see Driver Verifier
Properties for Driver Projects. You should always enable Driver Verifier on your test computer.
Step 6: Run the tests on the test computer
From the Driver menu, click Test > Run test . By default, the Run test command runs all of the tests in the
currently selected test group.
Remarks
For information about the driver tests and test categories, see How to select and configure the Device
Fundamentals Tests. For information about the testing framework, see Test Authoring and Execution Framework
(TAEF) and Windows Driver Test Framework (WDTF).
You can write your own driver tests and deploy those tests on test computers. For more information, see How to
write a driver test.
Running the Device Fundamentals tests in Visual Studio early in the development cycle will help you when are
finally ready to test your driver using the Windows Hardware Certification Kit (HCK).
Related topics
How to run the HCK Test Suites in WDK 8.1
How to select and configure the Device Fundamentals Tests
Deploying a Driver to a Test Computer
Getting Started with Windows Debugging
Hardware Certification Program
Windows Hardware Certification Kit (HCK)
How to test a driver at runtime from a Command Prompt
minutes to read • Edit Online
To make testing Windows drivers easier in the WDK, starting with WDK 8.1 you can now select HCK test suites to
run on the test computers. The HCK test suites include the device fundamentals tests, and tests for graphics,
imaging, wireless LAN, mobile broadband (CDMA and GSM), and WiFi Direct devices. These are the same tests
that are used in the Windows Hardware Certification kit (Windows HCK). See Windows Certification Program for
Hardware for information about the Windows HCK.
You can run the HCK test from a Command Prompt window or from Visual Studio. In addition, you can copy these
tests to a new location—which might be another computer or a USB key drive—and run the tests from that
location. Launching the tests automatically sets any local configuration needed to run the tests.
Running the HCK Test Suites on a test computer using Visual Studio
Running the HCK Test Suites from a Command Prompt window
Running the HCK Test Suites on a test computer using Visual Studio
If you have not already done so, follow the instructions in Provision a computer for driver deployment and testing
(WDK 8.1). After you have configured a test computer, the name of the test computer appears in the toolbar. Be
sure you have select the test computer that you have configured for device you are testing with the HCK Test Suite.
Prepare the test computer as needed, by installing the device and driver and any additional requirements for test
topology (see the HCK test prerequisites for the device you are testing). In place of the HCK Studio and HCK
controller, you run the tests using Visual Studio and WDK 8.1.
To select an HCK Test Suite to run on a test computer
1. From the Driver menu, click Test and then select Test Group Explorer .
2. In the Driver Test Group Explorer window, click one of the HCK Test Suites.
When you select a Test Suite, the Test Suite appears in the Driver Test Group window.
3. Be sure you have selected the test computer that you have configured for device you are testing with the
HCK Test Suite.
4. To use the HCK test suites, you must also follow the configuration requirements for the device you are
testing.
5. You can use the check boxes to select the tests that match the architecture of the intended test computer
(x86, x64, ARM).
6. From the Driver menu, click Test > Run test . By default, the Run test command runs all of the tests in the
currently selected test group.
You can also copy one of the provided HCK Test Suites and export it, along with the necessary test support files so
that you can run the test suite from a Command Prompt window.
To expor t a Test Suite
1. In the Test Group Explorer , right-click the HCK Test Suite you want to copy and click Expor t Test Suite...
from the short-cut menu. (The command runs the [Link] script).
2. Select a destination folder for the test suite. You can export the test suite to a network share or to a USB flash
drive.
3. To run the HCK Test Suite, open a Command Prompt window on the test computer with elevated permissions.
Navigate to the destination directory and run the [Link] script. For more information, see To run the
HCK Test Suite from a Command Prompt window.
Run on any computer using an administrator command prompt in the same folder as
the [Link] script.
"[Link] <infFileName>"
Note If the test computer is running Windows 7, you need to download and install the Microsoft .NET Framework
4.5 before you can run the HCK Test Suite.
To run the HCK Test Suite from a Command Prompt window
1. On the test computer that you have configured for testing, open a Command Prompt window with elevated
privileges (Run as administrator ) and navigate to the directory where you copied the HCK Test Suite.
2. Run the [Link] script and specify the path and name of the INF file. The script has the following
syntax:
[Link] infFileName
For example:
[Link] [Link]
Note The [Link] test suite does not make use of an INF file, however, the [Link] script
requires an INF file. You can provide the name of substitute INF file if necessary.
Test descriptions DF - PNP (disable and enable) with IO Before and After
(Basic)
DF - Sleep with IO Before and After (Basic)
Hardware, software, and test requirements Graphic Adapter or Chipset Testing Prerequisites
HCK
T EST S. B A SIC . DEVIC E. N ET W O RK . M O B IL EB RO A DB A N D. C DM A
T EST SUIT E
HCK
T EST S. B A SIC . DEVIC E. N ET W O RK . M O B IL EB RO A DB A N D. GSM
T EST SUIT E
Hardware, software, and test requirements Wireless LAN (802.11) Testing Prerequisites
Related topics
How to test a driver a runtime using Visual Studio
How to select and configure the Device Fundamentals Tests
Deploying a Driver to a Test Computer
Getting Started with Windows Debugging
Hardware Certification Program
Windows Hardware Certification Kit (HCK)
How to test a driver at runtime from a Command Prompt
minutes to read • Edit Online
The WDK for Windows 8 provides a driver testing framework that includes a set of tests called the Device
Fundamentals tests. The Device Fundamentals tests are a collection of tests that are used both internally at
Microsoft for testing the drivers and driver samples that ship with Windows and the WDK, and externally as part
of the Windows Certification Program for Hardware. You can run the tests from your development environment.
When you run the tests, you can use the same parameters that are used for Windows Certification testing, or
you can configure and customize the run-time parameters according to your testing and debugging needs.
DoPoolCheck True or False. Monitors the driver's use of the paged and
nonpaged system memory pools by using pool tags and
lookaside lists. This option also monitors changes in the
number of exceptions handled which might indicate
errors in exception handling.
FillZeroPageWithNull True or False. Maps the zero page and fills it with NULL
values. This test identifies drivers that do not verify a
pointer reference before dereferencing the pointer.
PingPongPeriod Specifies the ping pong period in minutes; the time the
processor alternates between high (HPU) and low (LPU)
processor utilization levels.
ResumeDelay The delay time (in seconds) after the machine resumes
from sleep mode and before the next I/O cycle starts.
The delay time is necessary to allow devices to restore
their working state (renew IP address for network card
and so on).
Utility tests
T EST DESC RIP T IO N
Display devices that have WDTF Simple I/O plug-ins Parameters: None
Driver Verifier
T EST DESC RIP T IO N
Enable Driver Verifier You can use this test to enable Driver Verifier for all
drivers of a device (or devices) on the test computer.
Parameters: - See Driver Verifier Options.
Related topics
How to How to test a driver at runtime using Visual Studio
Device Fundamentals Tests
Provided WDTF Simple I/O plug-ins
How to customize I/O for your device using the WDTF Simple I/O Action Plug-in
minutes to read • Edit Online
You can use Visual Studio to deploy and install a driver package on a test computer, and then verify that the driver is
installed and running.
Prerequisites
A driver package that is ready to install. You must first create and build your driver and then create a driver
package for installation. For more information, see Building a Driver and Creating a Driver Package.
If you have not already done so, follow the instructions to Provision a computer for driver deployment and
testing (WDK 8.1).
After you have configured and provisioned a test computer, you can use Visual Studio to deploy drivers,
schedule tests, and debug drivers on the test computer. For information about deployment and about how you
can deploy a driver automatically at build time, see Deploying a Driver to a Test Computer.
Instructions
Step 1: To test the driver installation on a test computer
After you have configured and provisioned a test computer, you can configure the driver package project so that it
is automatically deployed and installed on the test computer.
1. Open the property pages for your driver project. Right-click the driver project in Solution Explorer and select
Proper ties .
2. In the property pages for the driver, click Configuration Proper ties , click Driver Install , and then click
Deployment .
3. Select the Enable deployment option. For more information, see Deployment Properties for Driver Projects.
4. Select the test computer you have configured as the Remote Computer .
5. Under Driver Installation Options , click Install and Verify , and then select the Default Driver Installation
Task .
Related topics
Provision a computer for driver deployment and testing (WDK 8.1)
Deploying a Driver to a Test Computer
Testing a Driver
minutes to read • Edit Online
From the Driver Test Group Explorer , you can display the results from driver tests, save the test results to a
folder, or load the results from a folder.
Open the test results
1. In the Driver Test Group Explorer window, click the Driver Test Group you are interested in.
2. Click the results from a specific test run.
The results for the test group are shown as a folder titled Results ( computer - date:time)
3. The results for the tests in that test run are listed. Click the name of the test to view the results log.
The results log provides a summary of the tests that were run, along with the details generated by the test cases.
The information recorded included the time and date that each test was run, the name of the remote test computer
that ran the test, and the test results (number of tests run, passed, failed).
The WDK provides device testing components that enable you to test a driver on a test computer on your network.
You can use these components outside of Visual Studio by copying and installing the necessary files. You can use
these components to run the same collection of device driver tests that are available in Visual Studio to test the
features and functions of your driver.
Starting in WDK 8.1, you can copy and run the HCK Test Suites on test computers using command scripts. See How
to run the HCK Test Suites in WDK 8.1.
Prerequisites
Install Visual Studio and the WDK on the computer you use for development.
From Visual Studio, you can configure and provision computers for testing. When you configure the test
computer, the WDK driver test framework automatically enables the test computer for remote debugging and
transfers the necessary test binaries and support files. If you have not already done so, follow the instructions
in Provision a computer for driver deployment and testing (WDK 8.1)
Although it is not recommended, you can also install the necessary test components manually. Follow the
instructions to install the Test Authoring and Execution Framework (TAEF) and WDTF on the test computer. See
Manually installing and uninstalling TAEF on a test computer and Manually installing WDTF on a test computer.
Instructions
Step 1: Copy the tests to the test computer
Copy the Device Fundamentals Tests from the computer you use for development. Copy the folder
%ProgramFiles%\Windows Kits\8.0\Testing\Tests\Device Fundamentals to the test computer.
Step 2: Run the tests
The TAEF command to run the tests uses the following syntax:
Remarks
You must specify the test binary (.dll) or script (.wsc) file. The test method (/name:<test method>) is optional. For
the test names and test methods, see the Device Fundamentals Tests. For information about specifying test
parameters, see Device Fundamentals Test Parameters and [Link] Command Options .
For example, to run all PnP tests in the Devfund_PnPDTest.dll on a device with a specific device ID.
For example, to run PnP Surprise Remove test on a device with a specific device ID.
Provisioning a target computer is described in Provision a computer for driver deployment and testing (WDK 8.1).
Here we give some troubleshooting tips for the provisioning process.
General tips
Configure Computers menu command is inactive
Provisioning fails
Provisioning fails
The network path was not found
The network name cannot be found
Could not access remote machine
Note The messages that are displayed when you enter an incorrect target computer name can vary. For example,
you might see a message about enabling network discovery.
sxe ld <DriverName>
NOTE
This topic describes functionality that is only available in Visual Studio 2013. For info on previous WDK and Visual Studio
editions, see Other WDK downloads.
You can use the Windows Driver Kit (WDK) for Windows 8 to create your own driver tests or to customize some of
the tests that are provided. You can deploy the tests that you create to remote test computers using the driver
testing framework that the WDK provides for Microsoft Visual Studio Ultimate 2012.
The WDK provides templates that create starter code for a Windows Driver test project in C++, C#, and Script
(JScript). You can select the test cases that you want to include, or you can start with a blank project. You can
customize the code to add new test cases for your driver. You can deploy your tests from Visual Studio using the
driver test framework.
To customize a driver test using the Driver Test template for C++
1. From the File menu, click New > Project .
2. From the list of installed templates in the New Project dialog box, select Visual C++ > Windows Driver >
Tests .
3. Select Windows Driver Test in C++ .
4. Provide a name for your driver test project and a location (or use the default).
5. From the Windows Driver Test dialog box, select the test cases that you want to include or choose an empty
(blank) driver test. For more information about the test cases, see Windows Driver test cases.
6. Add the required test metadata. For more information, see How to add test metadata.
7. Build your driver test.
To customize a driver test using the Driver Test template for Script
1. From the File menu, click New > Project .
2. From the list of installed templates in the New Project dialog box, select Script > Windows Driver .
3. Select Windows Driver Test Script .
4. Provide a name for your driver test project and a location (or use the default).
5. From the Windows Driver Test dialog box, select the test cases that you want to include or choose an empty
(blank) driver test. For information about the test cases, see Windows Driver test cases.
6. Add the required test metadata. For more information, see How to add test metadata.
7. Build your driver test.
Making the driver tests you create available for deployment on test
computers
When you build your driver test, the new test will be available for deployment to a test computer. By default, the
tests that you create will appear in the test category My Test Categor y . The names of the tests are based upon
the test cases that you choose, and they will have names such as My Plug and Play Surprise Remove Test .
During each build of the test, the test will be overwritten. The latest build of the test will be available to deploy and
run on the test computer.
Disable/Enable Provides code for test cases that disable and enable a PnP
device.
Remove Provides code for test cases that remove a PnP device.
Surprise Remove Provides code for test cases that perform a surprise remove of
a PnP device.
Power Management Test Cases Provides test cases that force a driver to handle system sleep
states.
System Sleep States Provides code for test cases that perform device I/O while the
system cycles through sleep and power state.
Stress and Functionality Test Cases Provides test cases that perform I/O stress and function
testing of IOCTL and WMI interfaces.
I/O Stress Provides test cases that perform device I/O stress.
Functional IOCTL Interface Provides a template for creating functional test cases for the
IOCTL interface. (only available for C++ ).
Functional WMI Interface Provides a template for creating functional test cases for the
Windows Management Interface (WMI). (only available in
Script)
Related topics
Test Authoring and Execution Framework
Windows Driver Testing Framework
How to add test metadata
minutes to read • Edit Online
For Windows 8, the Windows Driver Kit (WDK) uses the Test Authoring and Execution Framework (TAEF) for
creating test content. A TAEF test is an object implemented as a dynamic-link library (DLL) that contains multiple
methods, where each method maps to a specific test scenario. The TAEF object combines related methods into a
group of tests. For each test, there is a set of metadata that describes the test. To improve test portability and
encapsulation, TAEF stores test metadata within the test object itself. When you create your own driver tests using
the Driver Test templates, you need to add this metadata so that your driver tests are available and can be
deployed using Visual Studio.
Prerequisites
The source code for a driver test written by using one of the Driver Test templates. For information, see How to
write a driver test using a Driver Test template.
To add test metadata attributes
1. Add the required test property metadata to the source files for your test.
2. For example, if you use the Driver Test template to create your version of the SurpriseRemove test, the
following metadata is added. Edit the test description, display name, category, and results file attributes.
C ++
// Declare the test class method DoSurpriseRemove - the main test method within this class
BEGIN_TEST_METHOD(DoSurpriseRemove)
// Required properties for driver tests
TEST_METHOD_PROPERTY(L"[Link]", L"TRUE")
TEST_METHOD_PROPERTY(L"[Link]", L"DQ")
TEST_METHOD_PROPERTY(L"[Link]", L"A WDTF SDEL query that is used to
identify the target device(s) - [Link]
TEST_METHOD_PROPERTY(L"[Link]", L"INF::OriginalInfFileName='%InfFileName%'")
TEST_METHOD_PROPERTY(L"RebootPossible", L"true")
// TODO: Required properties to be customized to match your test requirements
TEST_METHOD_PROPERTY(L"Description", L"Plug and Play Surprise Remove Generated Template")
TEST_METHOD_PROPERTY(L"[Link]", L"My Plug and Play Surprise Remove Test")
TEST_METHOD_PROPERTY(L"[Link]", L"My Test Category")
// Optional properties for driver tests
TEST_METHOD_PROPERTY(L"[Link]", L"[Link]")
// TODO: (see Windows Driver Kit documentation for additional optional properties)
END_TEST_METHOD()
C#
//
// DoSurpriseRemove is a test method as identified by the [TestMethod] tag.
// More methods can be added by following this basic pattern.
// The name of the function defines the name of the test.
//
[TestMethod]
// Required properties (see Windows Driver Kit documentation for more information):
[TestProperty("[Link]", "TRUE")]
[TestProperty("[Link]", "DQ")]
[TestProperty("[Link]", "A WDTF SDEL query that is used to identify the
target device(s) - [Link]
[TestProperty("[Link]", "INF::OriginalInfFileName='%InfFileName%'")]
// TODO: Required properties to be customized to match your test requirements.
[TestProperty("Description", "Plug and Play Surprise Remove Generated Template")]
[TestProperty("[Link]", "My Plug and Play Surprise Remove Test")]
[TestProperty("[Link]", "My Test Category")]
[TestProperty("RebootPossible", "true")]
// Optional properties (see Windows Driver Kit documentation for additional optional
properties):
[TestProperty("[Link]", "[Link]")]
3. The following table describes the test property attributes. Use the examples for guidance as you edit or add
the metadata for your tests.
Description
A short description of what the test does.
[Script]
< TestProperty name="Description" value= "This test cycles the system through various sleep states
and performs IO on devices before and after each sleep state cycle"/>
C ++
[C++]
TEST_METHOD_PROPERTY(L"Description", L"Plug and Play Surprise Remove Generated Template")
DisplayName
The name of the test as it shown in Driver Test.
[Script]
< TestProperty name="[Link]" value="Sleep with IO Before and After"/>
C ++
[C++]
TEST_METHOD_PROPERTY(L"[Link]", L"My Plug and Play Surprise Remove Test")
[Link]
A standard parameter for a method call. A test can have multiple parameters.
[Script]
<ModuleProperty name="[Link]" value="TM"/>
C ++
[C++]
TEST_METHOD_PROPERTY(L"[Link]", L"DQ")
[Link].<ParameterName>.Description
The description for the parameter.
[Script]
C ++
[C++]
TEST_METHOD_PROPERTY(L"[Link]", L"A WDTF SDEL query that is used to
identify the target device(s)")
[Link].<ParameterName>.Default
The default value for the parameter.
[Script]
< TestProperty name="[Link]" value="Logo"/>
C ++
[C++]
TEST_METHOD_PROPERTY(L"[Link]", L"INF::OriginalInfFileName='%InfFileName%'")
[Link]
This attribute marks the test for inclusion in the WDK.
[Script]
< TestProperty name="[Link]" value=""/>
C ++
[C++]
TEST_METHOD_PROPERTY(L"[Link]", L"TRUE")
[Link] y
Describes the category of a test.
[Script]
< TestProperty name="[Link]" value="Logo\Device Fundamentals"/>
C ++
[C++]
TEST_METHOD_PROPERTY(L"[Link]", L"My Test Category")
Deploymentitem
Identifies files and/or folders as test dependencies. These may contain any resources needed to run the
tests. For more information about using this metadata, see DeploymentItem Metadata.
Related topics
How to write a driver test using a Driver Test template
minutes to read • Edit Online
This page describes common issues you may encounter when using the Static Driver Verifier tool in the WDK. The
information below pertains specifically to the version of the tool that ships with Windows 10 October 2018 Update
(Version 1809).
InterceptedBuild failures
Primary symptom: SDV fails with FATAL ERROR: Unrecoverable error in InterceptedBuild stage .
When examining the DVL file, you will see an AssessmentScore value with
ScoreName="[driverName].[architecture].[Link]" and
ScoreUnit="Unrecoverable error in InterceptedBuild stage."
For InterceptedBuild failures, perform the following steps to diagnose the issue.
1. Rerun SDV from the Visual Studio 2017 Native Tools Command Line with the /debug flag. For details on
command options, see Static Driver Verifier commands.
a. First, run SDV's library function on any dependent library projects. For example:
msbuild /p:Configuration=Release /p:Platform=x64 /t:sdv /p:inputs="/lib /debug" .
b. Then run SDV on the driver project itself. For example:
msbuild /p:Configuration=Release /p:Platform=x64 /t:sdv /p:inputs="/check /debug"
del /s *.obj
del /s *.rawcfg*
del /s *.li
del /s *.pdb
del /s *.sys
Workaround:
1. Back up your project file, and then open the project file in a text editor.
2. Under the section, find two XML tags: one with the format
\<PropertyGroup Label="Globals"\>
\<Configuration\>\[Configuration type\]\</Configuration\> and one with the format
\<Platform Condition="'$(Platform)' == ''"\>\[Architecture\]\</Platform\> , where \[Configuration type\]
and \[Architecture\] are the default configuration and release for this type of project.
3. Update \[Configuration type\] and \[Architecture\] to values appropriate for your project. For example, if
you removed the Win32 platform, you might update \[Architecture\] to x64 instead.
Alternative workaround:
1. Open a Visual Studio 2017 Native Tools Command Prompt.
2. Navigate to the driver folder.
3. Run msbuild [Your Project] /p:Configuration=[Configuration type] /p:Platform=[Architecture] /t:dvl ,
where \[Your Project\] is the vcxproj file, \[Configuration type\] is a valid configuration such as Release,
and \[Architecture\] is a valid architecture such as x64.
Make sure the TAEF package is deployed or [Link] is deployed to a location in your PATH environment
variable.
The key symptom is the failure to load [Link].
If you have a Server GUI installation with the same architecture and Windows version as your ServerCore
installation, copy the [Link] file from Server GUI to ServerCore. The DLL can be found in the System32
folder (for example, C:\Windows\System32 ) and should be placed in the same folder on the ServerCore machine.
This should enable the test to run on ServerCore. If you are still experiencing issues, please refer to the next
workaround.
The second workaround is to run on Server GUI and then merge the package with the package containing the
results from Server Core. For info on merging packages, see Merge packages.
The Windows Server Hardware Certification Program requires a Driver Verification Log (DVL) for all driver
submissions. The DVL contains a summary of the results from the Code Analysis (CA) and Static Driver Verifier
(SDV) log files. The DVL does not contain any source information. You must run the Code Analysis tool and Static
Driver Verifier prior to creating a DVL for your driver.
To create a driver verification log
1. Before running the Code Analysis tools, be sure that you can build and link your driver using the latest Windows
Driver Kit (WDK).
2. For the Driver Solution, make sure that you have selected a Release configuration as the Solution Configuration
and x64 as the Solution Platform.
3. Run Static Driver Verifier. For information about creating the log file, see Creating a log file for Static Driver
Verifier and Using Static Driver Verifier to find defects in drivers.
4. Run the Code Analysis tool for drivers. Address and fix any defects that are found. See Creating a log file for the
code analysis tool and How to run Code Analysis for Drivers. For more information about code analysis, see
Analyzing C/C++ Code Quality by Using Code Analysis.
5. Create the Driver Verification Log. From the Driver menu, click Create Driver Verification Log....
6. Verify that both the Code Analysis Log and the Static Driver Verifier Log files are detected. Click Create .
The driver verification log has the file name extension .[Link]. The log is created in the project folder, for
example, \myDriverProject\[Link].
Note SDV performs a clean rebuild of the driver, which removes the Code Analysis log. As such, please be sure to
run SDV before running CA.
Note When you are ready to test your driver using the Windows Hardware Lab Kit, you need to copy the driver
verification log to the %systemdrive%\DVL directory on the test computer. Be sure to delete the contents of the
directory on the test computer before you copy the new driver verification log.
Remarks
For the most up-to-date information about the Code Analysis tool, Static Driver Verifier, and the Driver Verification
Log, refer to the WDK Release Notes. The Release Notes are available on the Windows Driver Kit (WDK) download
page.
Impor tant Timeouts, spaceouts, and other non-successful results in the DVL file are acceptable for certification
submission. This will not cause the Static Tools test in HCK to fail. For HCK 2.0, the Static Tools Test only requires the
presence of DVL file to show Code Analysis and SDV had been run, and does not require all rules to pass.
You can also create the driver verification log from a Visual Studio Command Prompt window, either by the Visual
Studio Native Tools Command Prompt installed with Visual Studio or via the Enterprise Windows Driver Kit
(EWDK):
Related topics
Creating a log file for Static Driver Verifier
Creating a log file for the code analysis tool
Hardware Certification Program
Analyzing Driver Quality by Using Code Analysis Tools
How to run Code Analysis for drivers
Using Static Driver Verifier to find defects in drivers
minutes to read • Edit Online
The Windows Server 2012 Hardware Certification Program requires a Driver Verification Log (DVL) for all
applicable driver submissions. You must run the Code Analysis tool prior to creating a DVL for your driver. The DVL
contains a summary of the results from the Code Analysis and Static Driver Verifier log files. The log files do not
contain source code information.
To run code analysis on the driver
1. In Microsoft Visual Studio Ultimate 2012, select the driver project file and then right-click to open the project
properties. Select Windows 8 Release as the Configuration and x64 as the Platform .
2. From the Analyze or Build menu, click Run Code Analysis on Solution .
3. If errors or warnings are found, use the Code Analysis Repor t window to investigate the cause of the errors.
Use the warning messages to fix those problems. For more information about the Code Analysis tool, see How
to run Code Analysis for drivers and Analyzing C/C++ Code Quality by Using Code Analysis.
The Code Analysis tool for drivers writes the results to the file [Link] in the build
configuration and platform sub-directory of your project, for example, \Windows 8Release\x64.
Remarks
Code Analysis for Drivers is a compile-time static verification tool that detects basic coding errors in C and C++
programs and includes a specialized module that is designed to detect errors in (primarily) kernel-mode driver
code. In previous versions of the WDK, the driver-specific module for code analysis was part of a stand-alone tool
called PREfast for Drivers (PFD).
You can also run the Code Analysis tool from a Visual Studio Command Prompt window. Set up the environment
by running one of the following batch files.
-Or-
For the most up-to-date information about the requirements for the Driver Verification Log, refer to the WDK
Release Notes.
Related topics
Creating a driver verification log
Creating a log file for Static Driver Verifier
Code Analysis for Drivers
Hardware Certification Program
Analyzing C/C++ Code Quality by Using Code Analysis
How to run Code Analysis for drivers
minutes to read • Edit Online
The Windows Server 2012 Hardware Certification Program requires a Driver Verification Log (DVL) for all
applicable driver submissions. You must run Static Driver Verifier (SDV) prior to creating a DVL for your driver. The
DVL contains a summary of the results from the Code Analysis and Static Driver Verifier log files. The log files do
not contain source code information.
For best results, run the Code Analysis tool before you run Static Driver Verifier.
To create a log file for Static Driver Verifier
1. In Microsoft Visual Studio Ultimate 2012, select the driver project file and then right-click to open the project
properties. Select Windows 8 Release as the Configuration and x64 as the Platform .
2. If you have already run the Code Analysis tool, follow these instructions for running Static Driver Verifier. For
more information about using SDV, see Using Static Driver Verifier to Find Defects in Drivers
3. If SDV finds defects in your driver, click the defect in the Results pane to view a trace of the code path that led to
the rule violation. Fix any defects found in the driver and run SDV again.
Static Driver Verifier writes the results to the file [Link] in the SDV sub-directory of your project, for
example, \myDriverProject\SDV.
Remarks
For the most up-to-date information about Static Driver Verifier and the Driver Verification Log, refer to the WDK
Release Notes. The Release Notes are available on the Windows Driver Kit (WDK) download page.
Impor tant Timeouts, spaceouts, and other non-successful results in the DVL file are acceptable for certification
submission. This will not cause the Static Tools test in HCK to fail. For HCK 2.0, the Static Tools Test only requires the
presence of DVL file to show Code Analysis and SDV had been run, and does not require all rules to pass.
You can also run Static Driver Verifier from a Visual Studio Command Prompt window. Set up the environment by
running one of the following batch files.
-Or-
Related topics
Creating a driver verification log
Static Driver Verifier
Using Static Driver Verifier to Find Defects in Drivers
Hardware Certification Program
minutes to read • Edit Online
This topic describes how to securely distribute your driver package. This information includes how to distribute a
driver package through the Microsoft Windows Update program. This topic also describes how Windows protects
system files.
Windows Update
Driver packages that pass Windows Hardware Certification Kit (HCK) testing can be digitally-signed by WHQL. If
your driver package is digitally-signed by WHQL, it can be distributed through the Windows Update program or
other Microsoft-supported distribution mechanisms.
Obtaining a WHQL release signature is part of the Windows Hardware Certification Kit (HCK). A WHQL release
signature consists of a digitally-signed catalog file. The digital signature does not change the driver binary files or
the INF file that you submit for testing.
You can distribute a driver package through the Windows Update program if the driver package:
Passes the WHQL test program and receives a WHQL release signature.
Qualifies for the Windows Certification Program.
Meets additional requirements that ensure that Windows Update can determine the correct driver package
for the user's device, can legally distribute it, and can automatically download it.
Because the requirements of the Windows Update program are frequently updated, you should regularly check the
Windows Update driver publishing Web site.