下载 Windows 驱动程序工具包 (WDK)Download the Windows Driver Kit (WDK)

WDK 用于开发、测试和部署 Windows 驱动程序。The WDK is used to develop, test, and deploy Windows drivers.

加入 Windows 预览体验计划以获取 WDK Insider Preview 版本Join the Windows Insider Program to get WDK Insider Preview builds. 有关 Windows Insider Preview 版本的安装说明,请参阅安装 Windows 驱动程序工具包 (WDK) 的预览版本For installation instructions for the Windows Insider Preview builds, see Installing preview versions of the Windows Driver Kit (WDK).

运行时要求Runtime requirements

可以在 Windows 7 及更高版本上运行 Windows 10 版本 2004 WDK,并使用它来开发这些操作系统的驱动程序:You can run the Windows 10, version 2004 WDK on Windows 7 and later, and use it to develop drivers for these operating systems:

客户端 OSClient OS 服务器 OSServer OS
Windows 10Windows 10 Windows Server 2019、Windows Server 2016Windows Server 2019, Windows Server 2016
Windows 8.1Windows 8.1 Windows Server 2012 R2Windows Server 2012 R2
Windows 8Windows 8 Windows Server 2012Windows Server 2012
Windows 7Windows 7 Windows Server 2008 R2 SP1Windows Server 2008 R2 SP1

适用于 Windows 10 版本 2004 的 WDKWDK for Windows 10, version 2004

“下载”图标 步骤 1:安装 Visual Studio 2019Step 1: Install Visual Studio 2019

WDK 需要 Visual Studio。The WDK requires Visual Studio. 有关 Visual Studio 系统要求的详细信息,请参阅 Visual Studio 2019 系统要求For more information about system requirements for Visual Studio, see Visual Studio 2019 System Requirements.

以下版本的 Visual Studio 2019 支持针对此发行版进行驱动程序开发:The following editions of Visual Studio 2019 support driver development for this release:

安装 Visual Studio 2019 时,选择“使用 C++ 的桌面开发”工作负荷。When you install Visual Studio 2019, select the Desktop development with C++ workload. Windows 10 软件开发工具包 (SDK) 会自动包括在内,并显示在右侧的“摘要”窗格中。The Windows 10 Software Development Kit (SDK) is automatically included, and is displayed in the right-hand Summary pane. 请注意,与适用于 Windows 10 版本 2004 的 WDK 兼容的 SDK 版本可能不是默认的 SDK。Note that the version of the SDK that is compatible with the WDK for Windows 10, version 2004 may not be the default SDK. 若要选择正确的 SDK:To select the correct SDK:

在 Visual Studio 安装程序中的“单个组件”选项卡上,搜索“Windows 10 SDK (10.0.19041.0)”,选择此版本,然后继续安装。In Visual Studio Installer , on the Individual components tab, search for Windows 10 SDK (10.0.19041.0), select this version and continue with install. 请注意,Visual Studio 将在计算机上自动安装 Windows 10 SDK (10.0.19041.1)。Note that Visual Studio will automatically install Windows 10 SDK (10.0.19041.1) on your machine.

如果已安装 Visual Studio 2019,则可以使用 Visual Studio 安装中的“修改”按钮来安装 Windows 10 SDK (10.0.19041.1)。If you already have Visual Studio 2019 installed, you can install the Windows 10 SDK (10.0.19041.1) by using the Modify button in Visual Studio install.

WDK 默认启用了 Spectre 缓解,但需要为要开发的每个体系结构将 Spectre 缓解库安装在 Visual Studio 中。WDK has Spectre mitigation enabled by default but requires spectre mitigated libraries to be installed with Visual Studio for each architecture you are developing for. 此外,开发适用于 ARM/ARM64 的驱动程序还需要这些体系结构的生成工具也安装在 Visual Studio 中。Additionally, developing drivers for ARM/ARM64 require the build tools for these architectures to also be installed with Visual Studio. 若要查找这些项,需要知道系统上安装的 MSVC 的最新版本。To locate these items you will need to know the latest version of MSVC installed on your system.

若要查找系统上安装的最新版 MSVC,请在 Visual Studio 安装程序中转到“工作负荷”页,在右侧窗格的“安装详细信息”下展开“使用 C++ 的桌面开发”,然后找到“MSVC v142 - VS 2019 C++ x64/x86 生成工具(V14.xx)”(请注意,其中的 xx 应该就是可用的最高版本)。To find the latest version of MSVC installed on your system, in Visual Studio Installer go to workload page , on the right pane under installation details , expand Desktop development with C++ and locate the MSVC v142 - VS 2019 C++ x64/x86 build tools (V14.xx) - note where xx should be the highest version available.

有了此信息 (v14.xx),转到“单个组件”,然后搜索“v14.xx”。With this information (v14.xx), go to Individual components and search for v14.xx . 这会返回所有体系结构的工具集,包括 Spectre 缓解库。This will return the tool sets for all architectures, including Spectre mitigated libs. 选择要为其开发的驱动程序体系结构。Select the driver architecture you are developing for.

例如,搜索 v14.25 返回以下内容:For example, searching for v14.25 returns the following:

MSVC v142 - VS 2019 C++ ARM build tools (v14.25)
MSVC v142 - VS 2019 C++ ARM Spectre-mitigated libs (v14.25)
MSVC v142 - VS 2019 C++ ARM64 build tools (v14.25)
MSVC v142 - VS 2019 C++ ARM64 Spectre-mitigated libs (v14.25)
MSVC v142 - VS 2019 C++ x64/x86 build tools (v14.25)
MSVC v142 - VS 2019 C++ x64/x86 Spectre-mitigated libs (v14.25)

“下载”图标 步骤 2:安装适用于 Windows 10 版本 2004 的 WDKStep 2: Install WDK for Windows 10, version 2004

WDK Visual Studio 扩展包含在默认 WDK 安装中。The WDK Visual Studio extension is included in the default WDK installation.

适用于 Windows 10 版本 2004 的企业版 WDK (EWDK)Enterprise WDK (EWDK) for Windows 10, version 2004

EWDK 是一种用于生成驱动程序的独立自包含命令行环境。The EWDK is a standalone, self-contained command-line environment for building drivers. 其中包括 Visual Studio 生成工具、SDK 和 WDK。It includes the Visual Studio Build Tools, the SDK, and the WDK. EWDK 的最新公共版本包含 Visual Studio 2019 生成工具 16.3.0 和 MSVC 工具集 v14.23。The latest public version of the EWDK contains Visual Studio 2019 Build Tools 16.3.0 and MSVC toolset v14.23. 若要开始使用,请装载 ISO 并运行 LaunchBuildEnvTo get started, mount the ISO and run LaunchBuildEnv .

EWDK 还需要 .NET Framework 版本 4.7.2。The EWDK also requires the .NET Framework version 4.7.2. 有关 .NET Framework 的其他要求的详细信息,请参阅 .NET Framework 系统要求For more information about other requirements for the .NET Framework, see .NET Framework system requirements.

“下载”图标 包含 Visual Studio 生成工具的 EWDKEWDK with Visual Studio Build Tools

你可以将 Visual Studio 界面与 EWDK 中提供的生成工具结合使用。You can use the Visual Studio interface with the build tools provided in the EWDK.

  1. 装载 EWDK ISO。Mount the EWDK ISO.
  2. 运行 LaunchBuildEnv.cmdRun LaunchBuildEnv.cmd.
  3. 在步骤 2 中创建的环境中,键入“SetupVSEnv”,然后按“Enter” 。In the environment created in step 2, type SetupVSEnv , and then press Enter .
  4. 使用完整的文件路径,从同一环境中启动 devenv.exe。Launch devenv.exe from the same environment, using the full file path. 示例: C:\Program Files (x86)\Microsoft Visual Studio\2019\\%Community|Professionial|Enterprise%\Common7\IDE\devenv.exeExample: C:\Program Files (x86)\Microsoft Visual Studio\2019\\%Community|Professionial|Enterprise%\Common7\IDE\devenv.exe

请注意,Visual Studio 主要版本应与 EWDK 中的版本匹配。Note that the Visual Studio major version should match with the version in the EWDK. 例如,Visual Studio 2019 适用于包含 VS16.X 生成工具的 EWDK。For example, Visual Studio 2019 works with the EWDK that contain VS16.X build tools.

Windows 10 驱动程序示例Driver samples for Windows 10

要下载驱动程序示例,请执行以下任一操作:To download the driver samples, do one of the following: